EasyManuals Logo

STMicroelectronics STM32WL5 Series User Manual

STMicroelectronics STM32WL5 Series
1450 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #861 background imageLoading...
Page #861 background image
RM0453 Rev 5 861/1450
RM0453 General-purpose timer (TIM2)
892
Figure 232. Master/slave connection example with 1 channel only timers
Note: The timers with one channel only (see Figure 232) do not feature a master mode. However,
the OC1 output signal can be used to trigger some other timers (including timers described
in other sections of this document). Check the “TIMx internal trigger connection” table of any
TIMx_SMCR register on the device to identify which timers can be targeted as slave.
The OC1 signal pulse width must be programmed to be at least 2 clock cycles of the
destination timer, to make sure the slave timer detects the trigger.
For instance, if the destination's timer CK_INT clock is 4 times slower than the source timer,
the OC1 pulse width must be 8 clock cycles.
Using one timer as prescaler for another timer
For example, TIM1 can be configured to act as a prescaler for TIM2. Refer to Figure 231. To
do this:
1. Configure TIM1 in master mode so that it outputs a periodic trigger signal on each
update event UEV. If MMS=010 is written in the TIM1_CR2 register, a rising edge is
output on TRGO each time an update event is generated.
2. To connect the TRGO output of TIM1 to TIM2, TIM2 must be configured in slave mode
using ITR0 as internal trigger. This is selected through the TS bits in the TIM2_SMCR
register (writing TS=00000).
3. Then the slave mode controller must be put in external clock mode 1 (write SMS=111 in
the TIM2_SMCR register). This causes TIM2 to be clocked by the rising edge of the
periodic TIM1 trigger signal (which correspond to the TIM1 counter overflow).
4. Finally both timers must be enabled by setting their respective CEN bits (TIMx_CR1
register).
Note: If OCx is selected on TIM1 as the trigger output (MMS=1xx), its rising edge is used to clock
the counter of TIM2.
Using one timer to enable another timer
In this example, we control the enable of TIM2 with the output compare 1 of Timer 1. Refer
to Figure 231 for connections. TIM2 counts on the divided internal clock only when OC1REF
of TIM1 is high. Both counter clock frequencies are divided by 3 by the prescaler compared
to CK_INT (f
CK_CNT
= f
CK_INT
/3).
MSv65225V1
Compare 1
Output
control
Slave
mode
control
CounterPrescaler
CK_PSCtim_itrtim_oc1
SMS
TS
Input
trigger
selection
TIM_mstr TIM_slv
CounterPrescaler
Clock
TIM_CH1

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

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

STMicroelectronics STM32WL5 Series Specifications

General IconGeneral
BrandSTMicroelectronics
ModelSTM32WL5 Series
CategoryMicrocontrollers
LanguageEnglish

Related product manuals