jesperv wrote on Wednesday, August 05, 2009:
I’m using the avr32 port for ap7000 and have made a interrupt that turns a led on and off.
Here’s the code:
void isr_test(void)
{
portENTER_SWITCHING_ISR1();
volatile struct avr32_pio_t *pioa = &AVR32_PIOA;
int status;
status = pioa->pdsr;
status = pioa->isr;
if(status & 0x00000400)
{
controlLED(1, LED_ON);
}
else
{
controlLED(1, LED_OFF);
}
portEXIT_SWITCHING_ISR1();
}
I activate interrupts with:
INTC_register_interrupt( &isr_test, AVR32_PIOA_IRQ, AVR32_INTC_INT1);
gpio_set(&AVR32_PIOA, 10, GPIO_INTERRUPT, GPIO_ON);
gpio_set(&AVR32_PIOA, 11, GPIO_INTERRUPT, GPIO_ON);
The interrupt works fine and the led turns on and off. But if I press the buttons repeatedly the I suddenly get and unrecoverable exception. I have even tried that the watchdog expires and the debuger quits. Here’s the output from gdb after a unrecoverable exception:
0x00013400 in _handle_Unrecoverable_Exception ()
(gdb) bt
#0 0x00013400 in _handle_Unrecoverable_Exception ()
#1 0x48c10230 in ?? ()
(gdb) regs
pc: 00013400 lr: 48c10230 sp: 00000044 r12: c0623002
r11: 3003a122 r10: 0230cfe3 r9: 489f0000 r8: 24007ff0
r7: 00000008 r6: 48ed48f0 r5: e3b00001 r4: d553fece
r3: fffa48df r2: 48d048e1 r1: 0230c062 r0: 48d2a505
Is there something wrong with my interrupt function or is there something else that could be causing the problem?