2013-04-10 05:13 AM
Hi all,
I have a specific needs for a project. In this project I use a STM8AL3L66 but my question is a general question about the interrupt in the STM8 family. Is that an interrupt can be interrupted by the same interrupt (itself) ? I know (according to the datasheet) that an interrupt can interrupt an other interrupt (in nested mode) :2013-04-10 05:31 AM
The answer to your question is YES: an interrupt handler can be interrupted by another interrupt handler and even by itself.
This behaviour is obtained when your interrupt handler enables interrupt within its body. Please, be informed that you must be careful in doing this, because this action corrupts the stack if you doesn't clear the interrupt source flag before enabling interrupts again. Regards, EtaPhi2013-04-10 05:38 AM
Ok, thus, when the program enter in the interrupt handler, I have to :
- clear the corresponding interrupt flag - and activate the interrupt -----> because interrupt are disable when the program jump in an interrupt handler ? Just for example, it could be done by this way : INTERRUPT_HANDLER(TIM1_UPD_OVF_TRG_COM_IRQHandler, 23) { TIM1->SR1 &= 0xFE; // Clear Timer 2 overflow flag enableInterrupts(); ......... }2013-04-10 06:26 AM
After some tests, everythings works fine.
As Etaphi says, I had to enabled interrupt in coressponding interrupt handler. Thanks, Regards.