2017-10-14 04:10 PM
Hello
Why does the HAL library call '__HAL_TIM_CLEAR_IT' before calling the 'HAL_TIM_PeriodElapsedCallback' callback, instead of after?
I previously had a bit of code running before the 'HAL_TIM_IRQHandler(...)' in stm32f0xx_it.c for TIM6, which worked well. But when I refactored it to use the callback and then TIM17 stopped working (specifically a different timer all together stops interrupting!?).
After trying to track down the problem it seems that if I clear the interrupt bit for TIM6 before starting my bit of code, that makes TIM17 stop working. However if I run my code first, then clear the interrupt for TIM6, then TIM17 remains unaffected. Also, I can short down the code (so that execution is faster), and then equally TIM17 seems unaffected..
Why does this happen? Why is __HAL_TIM_CLEAR_IT called by HAL before the Callback is ran?
Thanks for any help!
#interrupt-issue #timer-interrupts #stm32f051r72017-10-14 04:33 PM
Found the problem: My timer was interrupting quicker than the code of the ISR executed, thus TIM17 which has equal priority never gets to run... TIM6 ISR ran continously always behind.