EasyManuals Logo

STMicroelectronics STM32F407 User Manual

STMicroelectronics STM32F407
1731 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #585 background imageLoading...
Page #585 background image
DocID018909 Rev 11 585/1731
RM0090 General-purpose timers (TIM2 to TIM5)
640
Figure 136. Counter timing diagram with prescaler division change from 1 to 4
18.3.2 Counter modes
Upcounting mode
In upcounting mode, the counter counts from 0 to the auto-reload value (content of the
TIMx_ARR register), then restarts from 0 and generates a counter overflow event.
An Update event can be generated 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 TIMx_CR1 register.
This is to avoid updating the shadow registers while writing new values in the preload
registers. Then no update event occurs until the UDIS bit has been written to 0. However,
the counter restarts from 0, as well as the counter of the prescaler (but the prescale rate
does not change). In addition, if the URS bit (update request selection) in TIMx_CR1
register is set, setting the UG bit generates an update event UEV but without setting the UIF
flag (thus no interrupt or DMA request is sent). This is to avoid generating both update and
capture interrupts when clearing the counter on the capture event.
When an update event occurs, all the registers are updated and the update flag (UIF bit in
TIMx_SR register) is set (depending on the URS bit):
The buffer of the prescaler is reloaded with the preload value (content 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.
CK_PSC
00
CNT_EN
Timer clock = CK_CNT
Counter register
Update event (UEV)
0
F9 FA FB FCF7
Prescaler control register
03
Write a new value in TIMx_PSC
Prescaler buffer
03
Prescaler counter
0
1 2 3 0 1 2 3
F8 01

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the STMicroelectronics STM32F407 and is the answer not in the manual?

STMicroelectronics STM32F407 Specifications

General IconGeneral
BrandSTMicroelectronics
ModelSTM32F407
CategoryController
LanguageEnglish

Related product manuals