Behaviour of STM32H743 general purpose timer
Hello,
I'm using TIM2 on STM32H743 (Nucleo, rev Y, Keil 5.31).
Just before setting the bit TIM_CR1_EN the setting of the timer is the following:
- DIER : bit UIE set
- PSC: expected value (0x4E1F)
- ARR expected value (0x4E20). it is almost the same as PSC but normal
- all other registers are 0, including CNT
TIM2 interrupt is enabled. No pending interrupt at this time.
As you can see it is a pretty simple setup.
When I set the bit CEN , I get the first TIM2 interrupt way too quickly (the timer is supposed to trig an update event every 2s).
At this first interrupt the status register is 0x0000001F (bit UIF set + bits CCxIF).
The next interrupts are happening at the correct frequency, around 2s.
I've checked the timer duration using CYCCNT register (and after having set the timer freeze functionality during break). Except for the first interrupt, I indeed measure 800M cycles with CYCCNT (cpu @ 400MHz).
But the first interrupt happens around 40 k cycles after the set of CEN bit.
Any idea ?
