2018-09-21 02:35 AM
Hi,
I am using STM32F051R8T6 (of Discovery board). In my application I am using two timers: TIMER3 and TIMER15.
TIMER3 is used to count number of pulses. Hence, I have used it as an external clock source based timer.
TIMER15( based on internal clock source) is used to interrupt at certains ms(say 10ms) of time. I am toggling a GPIO pin inside the Timer15 interrupt, so that I can verify if the timer is right (by verifying the ON & OFF time of the GPIO pin with the configured TIMER15 time of 10ms).
The problem is, when there is no external clock source for TIMER3, the TIMER15 interrupt works fine and the GPIO pin inside the interrupt is toggled at regular timer interval. But, whenever there is an external clock source for TIMER3 , the TIMER15 is affected(i.e the GPIO toggling inside the interrupt becomes irregular).
Interrupt priority of TIMER3 is set to 1 and that of TIMER15 is 2.
Why is this happening? Where I should I check for error?
Solved! Go to Solution.
2018-10-06 03:40 AM
> Interrupt priority of TIMER3 is set to 1 and that of TIMER15 is 2.
Well swap the priorities. A higher value of priority means lower prioirty (hence 0 is the highest priority for an external interrupt). Maybe your TIMER3 interrupts take too long and that's why TIMER15 is affected. Also try not to do many things in the interrupt handler, just set some flag and do the work from regular code once the flag is set.
2018-09-21 02:43 AM
Is TIM3 interrupting? How is it configured?
2018-09-21 10:16 PM
Yes. Basically it is being used for counting external pwm pulses. Hence, it is configured to external clock source on TI1 and it generates an interrupt when the set ARR value is reached(this is working fine).
2018-10-06 03:24 AM
Any suggestions?
2018-10-06 03:40 AM
> Interrupt priority of TIMER3 is set to 1 and that of TIMER15 is 2.
Well swap the priorities. A higher value of priority means lower prioirty (hence 0 is the highest priority for an external interrupt). Maybe your TIMER3 interrupts take too long and that's why TIMER15 is affected. Also try not to do many things in the interrupt handler, just set some flag and do the work from regular code once the flag is set.
2018-10-06 03:42 AM
Yes. I am aware of this. But, is this normal? that one timer interrupt can be affected by another?
2018-10-06 04:52 AM
Of course, if your TIMER3's interrupt has higher priority than TIMER15's interrupt, and it takes too long, for example 300us, and you expect your TIMER15 interrupt to work every 200us, then you'll have problems.