Nations Technologies Inc.
Tel
:
+86-755-86309900
:
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
255
/
631
Figure 11-25 Trigger TIM2 with an update of TIM1
CK_INT
UEV
CNT
CNTEN
65
66
67
CNT
Clear TITF
8D
8F
01
02
TITF
00
8E
68
TIM1
TIM2
Start 2 timers synchronously using an external trigger
In this example, TIM1 is enabled when TIM1's TI1 input rises, and TIM2 is enabled when TIM1 is enabled. To ensure
the alignment of counters, TIM1 must be configured in master/slave mode. For TI1, TIM1 is the slave; for TIM2,
TIM1 is the master.
The configuration steps are shown as below:
Setting TIM1.MMSEL = ‘001’ to use the enable signal as trigger output
Setting TIM1_SMCTRL.TSEL = ‘100’ to configure the TIM1 to slave mode and receive the trigger input of TI1.
Setting TIM1_SMCTRL .SMSEL = ‘110’ to configure TIM1 to trigger mode.
Setting TIM1_SMCTRL .MSMD = ‘1’ to configure TIM1 to master/slave mode.
Setting TIM2_SMCTRL .TSEL = ‘000’ to connect TIM1 trigger output to TIM2.
Setting TIM2_SMCTRL.SMSEL = ‘110’ to configure TIM2 to trigger mode.
When TI1 rising edge arrives, both timers start counting synchronously according to the internal clock, and both
TITF flags are set simultaneously.
The following figure shows a delay between CNTEN and CK_PSC of TIM1 in master/slave mode.