2007-09-19 08:27 AM
Timer 0 Interrupt entered 2 times
2011-05-17 12:43 AM
When an interrupt is acknowledged immediatly prior to the return from the handler, the interrupt may still be present at the interrupt controller at the time the interrupt level is reenabled, due internal delays.
2011-05-17 12:43 AM
i all,
i have the following problem: I run the timer 0 in Output Compare 1 Mode with the interrupt enabled cause i need an 1ms Clock. Now, when an Interrupt occurs, i toggle an LED and i see on my Scope, that the IRQ-Routine is entered 2 times directley next to each other. I have attached my Source-Code. Thanks for Help And i also work not with the complicated Libs from ST, i directly uses the Register !!! Michi2011-05-17 12:43 AM
So, what can i do? Takes it so much time to delete the Interrupt-Flag?
2011-05-17 12:43 AM
did you try to move the
TIM0_SR &=~ TIM0_SR_OCF1; at the end of irq routine? I presume that for some reason the code inside the irq generate a spurius irq. I use a different configuration for the timer irq: I configured the timer as pwm: in this way I don't need to re-arm the counter..... Ste2011-05-17 12:43 AM
Stev, thanks a lot. I use the PWM-Mode and when i clear the TIM_SR register at the end of the interrupt-routine, it works fine. But when i clear the bit at the beginning of the interrupt-routine, it will request also 2 times the isr.
thanks :)2011-05-17 12:43 AM
Does any one know exactly how many cycles you need to delay clearing the timer interrupt flag? ''At the end'' is sort of vague...
-Mark2012-06-26 01:10 AM
Hi Michi...
We are also facing exactly the same problem with timer in OCM mode..interrupt code executed twice w.r.t one interrupt..have u found solution for your problem. If yes, please share.