Tim9/12 External Trigger Synchronization - ST STM32F101 series Reference Manual

Advanced arm-based 32-bit mcus
Hide thumbs Also See for STM32F101 series:
Table of Contents

Advertisement

RM0008
For example you may want to generate a positive pulse on OC1 with a length of t
after a delay of t
Use TI2FP2 as trigger 1:
1.
Map TI2FP2 to TI2 by writing CC2S='01' in the TIMx_CCMR1 register.
2.
TI2FP2 must detect a rising edge, write CC2P='0' and CC2NP = '0' in the TIMx_CCER
register.
3.
Configure TI2FP2 as trigger for the slave mode controller (TRGI) by writing TS='110' in
the TIMx_SMCR register.
4.
TI2FP2 is used to start the counter by writing SMS to '110' in the TIMx_SMCR register
(trigger mode).
The OPM waveform is defined by writing the compare registers (taking into account the
clock frequency and the counter prescaler).
The t
The t
value (TIMx_ARR - TIMx_CCR1).
Let's say you want to build a waveform with a transition from '0' to '1' when a compare
match occurs and a transition from '1' to '0' when the counter reaches the auto-reload
value. To do this you enable PWM mode 2 by writing OC1M='111' in the TIMx_CCMR1
register. You can optionally enable the preload registers by writing OC1PE='1' in the
TIMx_CCMR1 register and ARPE in the TIMx_CR1 register. In this case you have to
write the compare value in the TIMx_CCR1 register, the auto-reload value in the
TIMx_ARR register, generate an update by setting the UG bit and wait for external
trigger event on TI2. CC1P is written to '0' in this example.
You only want 1 pulse (Single mode), so you write '1 in the OPM bit in the TIMx_CR1
register to stop the counter at the next update event (when the counter rolls over from the
auto-reload value back to 0). When OPM bit in the TIMx_CR1 register is set to '0', so the
Repetitive Mode is selected.
Particular case: OCx fast enable
In One-pulse mode, the edge detection on TIx input set the CEN bit which enables the
counter. Then the comparison between the counter and the compare value makes the
output toggle. But several clock cycles are needed for these operations and it limits the
minimum delay t
If you want to output a waveform with the minimum delay, you can set the OCxFE bit in the
TIMx_CCMRx register. Then OCxRef (and OCx) are forced in response to the stimulus,
without taking in account the comparison. Its new level is the same as if a compare match
had occurred. OCxFE acts only if the channel is configured in PWM1 or PWM2 mode.
16.3.11

TIM9/12 external trigger synchronization

The TIM9/12 timers can be synchronized with an external trigger in several modes: Reset
mode, Gated mode and Trigger mode.
as soon as a positive edge is detected on the TI2 input pin.
DELAY
is defined by the value written in the TIMx_CCR1 register.
DELAY
is defined by the difference between the auto-reload value and the compare
PULSE
min we can get.
DELAY
DocID13902 Rev 15
General-purpose timers (TIM9 to TIM14)
and
PULSE
434/1128
460

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32F101 series and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Stm32f107 seriesStm32f102 seriesStm32f103 seriesStm32f105 seriesStm32f101 series

Table of Contents