RM0041
When a rising edge occurs on TI2, the counter starts counting on the internal clock and the
TIF flag is set.
The delay between the rising edge on TI2 and the actual start of the counter is due to the
resynchronization circuit on TI2 input.
Counter clock = CK_CNT = CK_PSC
Slave mode: External Clock mode 2 + trigger mode
The external clock mode 2 can be used in addition to another slave mode (except external
clock mode 1 and encoder mode). In this case, the ETR signal is used as external clock
input, and another input can be selected as trigger input when operating in reset mode,
gated mode or trigger mode. It is recommended not to select ETR as TRGI through the TS
bits of TIMx_SMCR register.
In the following example, the upcounter is incremented at each rising edge of the ETR
signal as soon as a rising edge of TI1 occurs:
1.
Configure the external trigger input circuit by programming the TIMx_SMCR register as
follows:
–
–
–
2.
Configure the channel 1 as follows, to detect rising edges on TI:
–
–
–
–
3.
Configure the timer in trigger mode by writing SMS=110 in TIMx_SMCR register. Select
TI1 as the input source by writing TS=101 in TIMx_SMCR register.
A rising edge on TI1 enables the counter and sets the TIF flag. The counter then counts on
ETR rising edges.
The delay between the rising edge of the ETR signal and the actual reset of the counter is
due to the resynchronization circuit on ETRP input.
Figure 126. Control circuit in trigger mode
CNT_EN
Counter register
ETF = 0000: no filter
ETPS = 00: prescaler disabled
ETP = 0: detection of rising edges on ETR and ECE=1 to enable the external clock
mode 2.
IC1F = 0000: no filter.
The capture prescaler is not used for triggering and does not need to be
configured.
CC1S = 01 in TIMx_CCMR1 register to select only the input capture source
CC1P = 0 and CC1NP = 0 in TIMx_CCER register to validate the polarity (and
detect rising edge only).
General-purpose timers (TIM2 to TIM5)
TI2
TIF
RM0041 Rev 6
34
35 36
37 38
MS37386V1
315/709
341
Need help?
Do you have a question about the STM32F100 Series and is the answer not in the manual?
Questions and answers