2023-05-26 03:11 PM
EDIT: Hello, everyone. My code issue seems to have resolved itself after much changing, but I never did find out what was happening. My real question was answered: There are no likely circumstances that a higher-priority interrupt should not pre-empt a lower priority interrupt, even if they are both timer interrupts. Thank you all for your help. I'll leave the original thread alone.
I have a priority 2 timer TIM1, a priority 6 timer TIM4, and priority 5 EXTI9_5.
TIM1 occurs every 1 ms. It clears the interrupt then increments uwTick then returns.
EXTI9_5 operates when I push a button. It is a while(1) loop which does not clear the interrupt so it just locks up.
TIM4 occurs every 30 seconds. It is a while(1) loop so it just locks up. The following scenario occurs regardless of whether or not the interrupt is cleared before the while(1) loop.
If I debug and press the button before the 30 second mark, I can see that TIM1 continues to operate. However, if I debug and simply wait for TIM4 to interrupt (and I debug to verify that it is interrupting), then TIM1 no longer interrupts, even though it has the higher preemption (lower number, higher priority).
How can I get TIM1 to preempt TIM4? Thanks.
2023-05-30 07:46 AM
Hi, Pavel. Thank you for responding. I have enabled the Preemption Priority, which is why I'm confused. "I have a priority 2 timer TIM1, a priority 6 timer TIM4, and priority 5 EXTI9_5." TIM1 will preempt EXTI9_5, but not TIM4. It's very weird to me. EXTI is a rising edge-interrupt, but it doesn't really matter. The fact is that the code goes to while(1) for EXTI5, but TIM1 still fires. However, if TIM4 enters its while(1) loop, TIM1 does not fire again. This is what is causing problems for me. Do you have any ideas or suggestions? Thanks.
2023-05-30 12:23 PM
No idea then, sorry. There are very few things that a creative person cannot break.
2023-05-30 03:02 PM
How exactly do you observe the interrupts?
Post a minimal but complete compilable code exhibiting the problem.
JW
2023-05-30 03:57 PM
I'll take that as a compliment!
2023-05-30 03:59 PM
Hi, JW. I should have made a video at the time because it was really quite straight-forward. However, now I no longer see the problem and I don't know what I did to change it.