Figure 95. External Trigger Input Block; Figure 96. Control Circuit In External Clock Mode 2 - ST STM32F40 Series Reference Manual

Hide thumbs Also See for STM32F40 Series:
Table of Contents

Advertisement

Advanced-control timers (TIM1&TIM8)
External clock source mode 2
This mode is selected by writing ECE=1 in the TIMx_SMCR register.
The counter can count at each rising or falling edge on the external trigger input ETR.
Figure 95

Figure 95. External trigger input block

ETR pin
For example, to configure the upcounter to count each 2 rising edges on ETR, use the
following procedure:
1.
As no filter is needed in this example, write ETF[3:0]=0000 in the TIMx_SMCR register.
2.
Set the prescaler by writing ETPS[1:0]=01 in the TIMx_SMCR register
3.
Select rising edge detection on the ETR pin by writing ETP=0 in the TIMx_SMCR
register
4.
Enable external clock mode 2 by writing ECE=1 in the TIMx_SMCR register.
5.
Enable the counter by writing CEN=1 in the TIMx_CR1 register.
The counter counts once each 2 ETR rising edges.
The delay between the rising edge on ETR and the actual clock of the counter is due to the
resynchronization circuit on the ETRP signal.

Figure 96. Control circuit in external clock mode 2

369/1422
gives an overview of the external trigger input block.
ETR
0
divider
/1, /2, /4, /8
1
ETP
ETPS[1:0]
TIMx_SMCR
TIMx_SMCR
f
CNT_EN
Counter clock = CK_CNT = CK_PSC
Counter register
Doc ID 018909 Rev 4
ETRP
filter
downcounter
f
DTS
ETF[3:0]
TIMx_SMCR
CK_INT
ETR
ETRP
ETRF
34
RM0090
TI2F
or
or
TI1F
or
encoder
mode
external clock
TRGI
mode 1
ETRF
external clock
mode 2
CK_INT
internal clock
mode
(internal clock)
ECE
SMS[2:0]
TIMx_SMCR
35
36
CK_PSC

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32F40 Series and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Stm32f41 seriesStm32f42 seriesStm32f43 seriesRm0090

Table of Contents

Save PDF