2025-08-02 8:50 AM
I'm programming a STM32H503CBUx Timer3. NVIC settings are such that the count down event is trapped in
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef* htim)
This is a global interrupt routine that takes care for other timer interrupts as well and on has to decide from the handle that is being passed, which interrupt has to be served.
My requirement is that this interrupt has high priority and is handled as fast as possible.
Timer CLK is 250MHz. The timer counts down with pre divider 1 and count down of around 15,000.
In the ISR the counter htim3.Init.Period =14999 is being set to 1000 and should generate the next interrupt. Then follows another chain of such countdowns from 1000.
The interval between the two subsequent interrupts is 4 µs. Can an ISR be served with such time constraints?
How many instructions can be handled by the MCU at 250MHz clock?
Alone the handle testing costs me valuable instruction time. Could I use a timer that has a uniquely asserted ISR?
2025-08-02 8:59 AM
Generally, with HAL, you want to remain under about 100 kHz in terms of interrupt frequency. 4us is likely doable but only with optimization. At 250 MHz clock, you get 1000 ticks per 4 us. That's enough for an interrupt and some code within it.