This is a crosspost from: Beitrag "[ARM7] ISR zu langsam -> kein Interrupt mehr"
I'm currently facing a problem using a AT91SAM7X256.
An external interrupt is triggered every millisecond and the
corresponding ISR does some calculations. This setup is working in
general but under certain circumstances I'm facing an unknown problem
which leads to the ISR not being called anymore - the main loop of the
controller still runs smoothly. I did some testing and figured out that
this is caused by my ISR doing too much stuff. If I comment out some
(random) parts or increase the time interval between to IRQs to two
milliseconds it is working again.
This is, I'm able to work around my problem but I want to understand
what causes this issue.
Maybe someone can explain this behavior to me?
By the way: I'm using FreeRTOS.
1 | portENTER_CRITICAL();
|
2 | {
|
3 | // Input on PIN_1
|
4 | AT91F_PIO_CfgInput(AT91C_BASE_PIOA, IOA_PIN_1);
|
5 |
|
6 | // Interrupt on PIN_1
|
7 | AT91F_PIO_InterruptEnable(AT91C_BASE_PIOA, IOA_PIN_1);
|
8 |
|
9 | // Setup interrupt
|
10 | AT91F_AIC_ConfigureIt(AT91C_BASE_AIC,
|
11 | AT91C_ID_PIOA,
|
12 | AT91C_AIC_PRIOR_LOWEST,
|
13 | AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE,
|
14 | isr_pioa_Wrapper);
|
15 |
|
16 | AT91F_AIC_EnableIt(AT91C_BASE_AIC, AT91C_ID_PIOA);
|
17 | }
|
18 | portEXIT_CRITICAL();
|
19 |
|
20 | int dummy = AT91C_BASE_PIOA->PIO_ISR;
|
1 | void isr_pioa_Wrapper(void)
|
2 | {
|
3 | /* Save the context of the interrupted task. */
|
4 | portSAVE_CONTEXT();
|
5 |
|
6 | /* Call the handler to do the work. This must be a separate
|
7 | function to ensure the stack frame is set up correctly. */
|
8 | isr_pioa_Handler();
|
9 |
|
10 | /* Restore the context of whichever task will execute next. */
|
11 | portRESTORE_CONTEXT();
|
12 | }
|
1 | void isr_pioa_Handler(void)
|
2 | {
|
3 | int dummy = AT91C_BASE_PIOA->PIO_ISR;
|
4 | dummy = dummy;
|
5 |
|
6 | isr_counter++;
|
7 |
|
8 | // ...
|
9 |
|
10 | /* Clear the interrupt. */
|
11 | AT91C_BASE_AIC->AIC_EOICR = 0;
|
12 | }
|