STM32L412 interrupt latency and jitter
I am running STM32L412 on 48MHz MSI, Timer 2 is configured in One-Pulse mode to output a 2ms Pulse. This is done by setting Timer 2 in PWM mode and with a prescaler of 47, ARR = 1999 and CCR = 1, Polarity=LOW
An interrupt is generated on update Event, i.e. when the pulse goes low.
In the ISR I set a GPIO to high, then clear the interrupt flag
void TIM2_IRQHandler(void)
{
if(LL_TIM_IsActiveFlag_UPDATE(TIM2))
{
LL_GPIO_SetOutputPin(BTS_5V_GPIO_Port, BTS_5V_Pin);
LL_TIM_ClearFlag_UPDATE(TIM2);
}
}Configuration is done with CubeIDE
Now, when observing the signals on a scope, I see that there is very unsteady interrupt latency that jitters from fairly good (750ns) to quite poor(2,6µs) and all this in quite neat 166ns intervals
I am quite new to the STM32, but this very coars jitter seem just not right to me and the total timespan would be something like over 100 clock cycles.
I have the feeling that I am missing something out on the configuration...
Up to now there is no application code running, just timers and some interrupts
Any help welcome to solve this mistery...
Cheers,
Bob
