AnsweredAssumed Answered

Clear of EXTI-PR Flag at the the end of ISR doesn´t work

Question asked by wild.andreas on Mar 21, 2014
Latest reply on Mar 21, 2014 by Clive One
Hello all,

I am using a STM32F2xx chip.

I found I strange behaviour in the interrupt service routine for the external interupts.
Due to possible glitches in the edges triggering the external interrupt, I clear the pending bit of the edge detector at the end of the service routine. Thus during the ISR the edge detector cannot detect any new edges, therefore the NVIC will not set a pending bit during the current external interrupt is served.
My last instruction in the ISR is:
EXTI->PR = EXTI_Line3;

And now the big issue:
If I do it like this, the ISR is immediately recalled again, even though I checked at the end of the ISR there is no pending bit in the NVIC (NVIC->ISPR[0] = 0).
However if I insert ANY instruction after "EXTI->PR = EXTI_Line3; " everthing works fine!!
It seems to me that there is too little time between the clearance of the EXTI->PR Bit and the return from ISR, so once the cpu is returned from ISR, the NVIC triggers an interrupt because due to some reason the NVIC didn´t see the already cleared EXTI->PR Bit.

I disabled Flash prefetch, Instruction cache and Data cache in FLASH->ACR, but no success.

Any hints would be much appreciated