This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

EXTernal INTerrupt

I try to use external pin P5.6 to generate an interup but the interupt never apend.
I use REVA board with STR912F MCU
I'm working in debug

Here my code:

#include "STRx.h"

int delaycnt;
int k;
void interrupt_handler (void);
...
...
function
...
...
void interrupt_handler (void)
{ int i,l;

i=1;
l=i;
VIC1->VAR = 0;
}

int main()
{ int i;
int status = 0;
int cote = 0;
int size = 0;
int suivant = 0;
int timerst = 0;
int timerval = 0;
int timerval2 = 0;
float volt;
mg=0;

//init device
initcpu(); //initialise GPI0 0 to 9

// Interupt init

// Clock for VIC
SCU->PRR0 |= 0x0020;
SCU->PCGRO |= 0x0020;

// Connect Pin P5.6 to the external interupt 1
SCU->WKUPSEL &= 0xFFF7;
SCU->WKUPSEL |= 0x0030;

VIC1->VAiR[11] = (unsigned int)interrupt_handler;
VIC1->VCiR[11] = 0x20; // enable interupt vector
VIC1->VCiR[11] |= 0x0B; // specify interupt number
VIC1->INTSR = 0x0000; // Generate IRQ instead of FIQ
VIC1->INTER = 0x0800; // Enable interupt 11 du vic 1
VIC1->VAR = 0; // Acknowledge Interrupt

do
{ i =2;
} while (i = 2);

...

code
...
}

The port 5 is put in input modes as follow:

//GPIO5 init (pin 0-3 N/A)
SCU->PRR1 |= 0x00080000; // release P5 reset
SCU->PCGR1 |= 0x00080000; // clock gating P5
SCU->GPIOIN[5] |= 0x00; //P5.6 = intr 14 default
GPIO5->DIR = 0x00; // Dir input on GPIO5 for pins 0-7

I put a breakpoint in the interupt code but it never hapend.
What is wrong. It should work ???????

help please
Mike