Nations Technologies Inc.
Tel
:
+86-755-86309900
:
info@nationstech.com
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
237
/
631
External clock source mode 1
Figure 11-9 TI2 external clock connection example
This mode is selected by configuring TIMx_SMCTRL.SMSEL=111. The counter can be configured to count on the
rising or falling edge of the clock at the selected input.
For example, to configure up-counting mode to count on the rising edge of the clock at the TI2 input, the configuration
steps are as follows:
Configure TIMx_CCMOD1.CC2SEL equal to ‘01’, CC2 channel is configured as input, IC2 is mapped to TI2
Configure TIMx_CCEN.CC2P equal to ‘0’, select clock rising edge polarity
To select input filter bandwidth by configuring TIMx_CCMOD1.IC2F[3:0] (if filter is not needed, keep IC2F
bit at ‘0000’)
Configure TIMx_SMCTRL.SMSEL equal to ‘111’, select timer external clock mode 1
Configure TIMx_SMCTRL.TSEL equal to ‘110’, select TI2 as the trigger input source
Configure TIMx_CTRL1.CNTEN equal to ‘1’ to start the counter
Note: The capture prescaler is not used for triggering, so it does not need to be configured
When the rising edge of the timer clock occurs at TI2=1, the counter counts once and the TIMx_STS .TITF flag is
pulled high.
The delay between the rising edge of TI2 and the actual clock of the counter depends on the resynchronization circuit
at the input of TI2.
TI2
Filter
Edge Detector
CK_PSC
TIMx_SMCTRL.
TSEL[2:0]
Encoder mode
External clock mode 1
External clock mode 2
Internal clock mode
ITRx
TI1_ED
TI1FP1
TI2FP2
ETRF
(TIMx_CCMOD1.ICF[3:0])
or
TI2F rising or falling
TIMx_SMCTRL.
EXCEN
TRGI rising
ETRF rising
CK_INT rising
TIMx_SMCTRL.S
MSEL[2:0]
TI1F rising or falling
Polarity Selection
(
TIMx_CCEN.CC2P
)