I am working on STM32 discovery board to develop a counter functionality of the timer1 using internal clock cycles.
The update interrupt flag goes high every time the (CNT ==0) also as soon as I enable the counter the it starts from 0(overriding any previous value written on CNT) setting the update interrupt flag high as soon as the counter has started. What is the use of UIF then?
My observations -
As I step over the line
TIMx->CR1 |= TIM_CR1_CEN; and observe the registers
the UIF flag in the SR register goes high and CNT register shows 0x39(for prescalar 0xfff0).
When pre scalar is changed to 0x3fff the stepping over sets the UIF flag and CNT is holding 0xee.
One can correlate the timings that when pre scalar is halved counter value almost doubles. If there is some mistake in my understanding please correct.
Controller used - STM32F051R8T6(Discovery board)
IDE used - Attolic truestudio
Thanks and regards