Timer Synchronization; Figure 134. Control Circuit In External Clock Mode 2 + Trigger Mode; Figure 135. Master/Slave Timer Example - ST STM32F102 Series Reference Manual

Hide thumbs Also See for STM32F102 Series:
Table of Contents

Advertisement

General-purpose timer (TIMx)

Figure 134. Control circuit in external clock mode 2 + trigger mode

Counter clock = CK_CNT = CK_PSC
13.3.15

Timer synchronization

The TIMx timers are linked together internally for timer synchronization or chaining. When
one Timer is configured in Master Mode, it can reset, start, stop or clock the counter of
another Timer configured in Slave Mode.
The following figure presents an overview of the trigger selection and the master mode
selection blocks.
Using one timer as prescaler for the another

Figure 135. Master/Slave timer example

For example, you can configure Timer 1 to act as a prescaler for Timer 2. Refer to
Figure
135. To do this:
Configure Timer 1 in master mode so that it outputs a periodic trigger signal on each
update event UEV. If you write MMS=010 in the TIM1_CR2 register, a rising edge is
output on TRGO1 each time an update event is generated.
To connect the TRGO1 output of Timer 1 to Timer 2, Timer 2 must be configured in
slave mode using ITR1 as internal trigger. You select this through the TS bits in the
TIM2_SMCR register (writing TS=000).
Then you put the slave mode controller in external clock mode 1 (write SMS=111 in the
TIM2_SMCR register). This causes Timer 2 to be clocked by the rising edge of the
periodic Timer 1 trigger signal (which correspond to the timer 1 counter overflow).
Finally both timers must be enabled by setting their respective CEN bits (TIMx_CR1
register).
Note:
If OCx is selected on Timer 1 as trigger output (MMS=1xx), its rising edge is used to clock
the counter of timer 2.
304/690
TI1
CEN/CNT_EN
ETR
Counter register
TIF
TIMER 1
Clock
UEV
Counter
Prescaler
34
MMS
TS
Master
TRGO1
ITR1
mode
control
Input
trigger
selection
35
36
TIMER 2
SMS
Slave
CK_PSC
mode
Prescaler
control
RM0008
Counter

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32F102 Series and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Stm32f101 seriesStm32f103 series

Table of Contents