English
Language : 

RM0313 Datasheet, PDF (481/900 Pages) STMicroelectronics – This reference manual targets application developers
RM0313
Basic timers (TIM6/7/18)
20.3.2
Counting mode
The counter counts from 0 to the auto-reload value (contents of the TIMx_ARR register),
then restarts from 0 and generates a counter overflow event.
An update event can be generate at each counter overflow or by setting the UG bit in the
TIMx_EGR register (by software or by using the slave mode controller).
The UEV event can be disabled by software by setting the UDIS bit in the TIMx_CR1
register. This avoids updating the shadow registers while writing new values into the preload
registers. In this way, no update event occurs until the UDIS bit has been written to 0,
however, the counter and the prescaler counter both restart from 0 (but the prescale rate
does not change). In addition, if the URS (update request selection) bit in the TIMx_CR1
register is set, setting the UG bit generates an update event UEV, but the UIF flag is not set
(so no interrupt or DMA request is sent).
When an update event occurs, all the registers are updated and the update flag (UIF bit in
the TIMx_SR register) is set (depending on the URS bit):
• The buffer of the prescaler is reloaded with the preload value (contents of the
TIMx_PSC register)
• The auto-reload shadow register is updated with the preload value (TIMx_ARR)
The following figures show some examples of the counter behavior for different clock
frequencies when TIMx_ARR = 0x36.
Figure 155. Counter timing diagram, internal clock divided by 1
&.B36&
&17B(1
7LPHUFORFN &.B&17
&RXQWHUUHJLVWHU

            
&RXQWHURYHUIORZ
8SGDWHHYHQW 8(9
8SGDWHLQWHUUXSWIODJ
 8,)
069
DocID022448 Rev 4
481/900
490