Hi, i have two HardwareTimer's both configured to 16,000Hz with seperate callbacks.
I'm just wondering what the behaviour of these timers is?
Does one interrupt the other, if so in what order?
What happens when 2 hardware timers are running?
Re: What happens when 2 hardware timers are running?
this is my fancy version of blinky:
1. running one ISR that flips an led at interval X;
2. running another ISR that flips the same led at interval X + Y, where Y is small vs. X.
the net result is that the led's intensity goes in and out,
to your questions: whichever interrupt that gets serviced first will dominate, assuming no priority differences.
1. running one ISR that flips an led at interval X;
2. running another ISR that flips the same led at interval X + Y, where Y is small vs. X.
the net result is that the led's intensity goes in and out,

to your questions: whichever interrupt that gets serviced first will dominate, assuming no priority differences.
Re: What happens when 2 hardware timers are running?
Besides the document that fpiSTM pointed you to, you should read the reference manual for whatever STM32 MCU you are using, section "Interrupts and events", which will possibly point you to programming manual PM0214, available here:
https://www.st.com/resource/en/programm ... ronics.pdf
This document describes in detail in section 4.3 the Nested Vectored Interrupt Controller(NVIC), which handles interrupts in STM32 MCUs. The "nested" word means one interrupt may interrupt another interrupt's service routine, depending on their relative priority.
Do a search with your favorite search engine with the keywords "nested interrupt", there are many good explanations with fancy colorful diagrams and all.
But to answer your question:
- If both interrupts have the same priority, they will be handled sequentially.
- If timer interrupt A has a higher priority than timer interrupt B then interrupt A can interrupt interrupt B, but not vice-versa.
https://www.st.com/resource/en/programm ... ronics.pdf
This document describes in detail in section 4.3 the Nested Vectored Interrupt Controller(NVIC), which handles interrupts in STM32 MCUs. The "nested" word means one interrupt may interrupt another interrupt's service routine, depending on their relative priority.
Do a search with your favorite search engine with the keywords "nested interrupt", there are many good explanations with fancy colorful diagrams and all.
But to answer your question:
- If both interrupts have the same priority, they will be handled sequentially.
- If timer interrupt A has a higher priority than timer interrupt B then interrupt A can interrupt interrupt B, but not vice-versa.