RM0016 16-bit advanced control timer (TIM1)
Doc ID 14587 Rev 8 161/449
Using one timer to start another timer
Example 1
The enable of timer B is set with the UEV of timer A (refer to Figure 55 for connections).
Timer B starts counting from its current value (which can be non-zero) on the divided
internal clock as soon as the UEV is generated by timer A. When timer B receives the trigger
signal, its CEN bit is automatically set and the counter counts until 0 is written to the CEN bit
in the TIM1_CR1 register. Both counter clock frequencies are divided by four by the
prescaler compared to f
MASTER
(f
CK_CNT
= f
MASTER
/4).
1. Configure timer A master mode to send its UEV as trigger output (MMS = 010 in the
TIM1_CR2 register).
2. Configure the timer A period (TIM1_ARR registers)
3. Configure timer B to get the input trigger from timer A (TS = 001 in the TIM1_SMCR
register).
4. Configure timer B in trigger mode (SMS = 110 in TIM1_SMCR register)
5. Start timer A by writing 1 in the CEN bit (TIM1_CR1 register)
Figure 58. Triggering timer B with the UEV of timer A (TIMERA-UEV)
Timer B-TIF
Write TIF=0
FD
FE FF
00
01
45 47 48
f
MASTER
Timer A-UEV
Timer A-CNT
Timer B-CNT
02
46
Timer B-CEN = CNT_EN