DocID025202 Rev 7
592/1080
RM0365
General-purpose timers (TIM2/TIM3/TIM4)
618
Figure 234. Gating TIM2 with Enable of TIM3
Using one timer to start another timer
In this example, we set the enable of Timer 2 with the update event of Timer 3. Refer to
for connections. Timer 2 starts counting from its current value (which can be
non-zero) on the divided internal clock as soon as the update event is generated by Timer 1.
When Timer 2 receives the trigger signal its CEN bit is automatically set and the counter
counts until we write ‘0 to the CEN bit in the TIM2_CR1 register. Both counter clock
frequencies are divided by 3 by the prescaler compared to CK_INT (f
CK_CNT
= f
CK_INT
/3).
1.
Configure TIM3 master mode to send its Update Event (UEV) as trigger output
(MMS=010 in the TIM3_CR2 register).
2. Configure the TIM3 period (TIM3_ARR registers).
3. Configure TIM2 to get the input trigger from TIM3 (TS=010 in the TIM2_SMCR
register).
4. Configure TIM2 in trigger mode (SMS=110 in TIM2_SMCR register).
5. Start TIM3 by writing ‘1 in the CEN bit (TIM3_CR1 register).
Figure 235. Triggering TIM2 with update of TIM3
069
&.B,17
(
7,0&17B,1,7
7,0&17
$%
7,0&17
7,0&17B,1,7
:ULWH7,)
(
(
7,0&(1 &17B(1
7,0ZULWH&17
7,07,)
069
&.B,17
7,0&17
)'
7,0&17
:ULWH7,)
7,0&(1 &17B(1
7,07,)
)(
))
7,08(9