Figure 166. Control Circuit In Reset Mode - ST STM32F101 series Reference Manual

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

Advertisement

General-purpose timers (TIM9 to TIM14)
Slave mode: Reset mode
The counter and its prescaler can be reinitialized in response to an event on a trigger input.
Moreover, if the URS bit from the TIMx_CR1 register is low, an update event UEV is
generated. Then all the preloaded registers (TIMx_ARR, TIMx_CCRx) are updated.
In the following example, the upcounter is cleared in response to a rising edge on TI1 input:
1.
Configure the channel 1 to detect rising edges on TI1. Configure the input filter duration
(in this example, we don't need any filter, so we keep IC1F='0000'). The capture
prescaler is not used for triggering, so you don't need to configure it. The CC1S bits
select the input capture source only, CC1S = '01' in the TIMx_CCMR1 register.
Program CC1P and CC1NP to '00' in TIMx_CCER register to validate the polarity (and
detect rising edges only).
2.
Configure the timer in reset mode by writing SMS='100' in TIMx_SMCR register. Select
TI1 as the input source by writing TS='101' in TIMx_SMCR register.
3.
Start the counter by writing CEN='1' in the TIMx_CR1 register.
The counter starts counting on the internal clock, then behaves normally until TI1 rising
edge. When TI1 rises, the counter is cleared and restarts from 0. In the meantime, the
trigger flag is set (TIF bit in the TIMx_SR register) and an interrupt request can be sent if
enabled (depending on the TIE bit in TIMx_DIER register).
The following figure shows this behavior when the auto-reload register TIMx_ARR=0x36.
The delay between the rising edge on TI1 and the actual reset of the counter is due to the
resynchronization circuit on TI1 input.
Slave mode: Gated mode
The counter can be enabled depending on the level of a selected input.
In the following example, the upcounter counts only when TI1 input is low:
1.
Configure the channel 1 to detect low levels on TI1. Configure the input filter duration
(in this example, we don't need any filter, so we keep IC1F='0000'). The capture
prescaler is not used for triggering, so you don't need to configure it. The CC1S bits
select the input capture source only, CC1S='01' in TIMx_CCMR1 register. Program
CC1P='1' and CC1NP= '0' in TIMx_CCER register to validate the polarity (and detect
low level only).
2.
Configure the timer in gated mode by writing SMS='101' in TIMx_SMCR register.
Select TI1 as the input source by writing TS='101' in TIMx_SMCR register.
3.
Enable the counter by writing CEN='1' in the TIMx_CR1 register (in gated mode, the
counter doesn't start if CEN='0', whatever is the trigger input level).
435/1128

Figure 166. Control circuit in reset mode

TI1
UG
Counter clock = ck_cnt = ck_psc
Counter register
TIF
DocID13902 Rev 15
30
31
32 33 34 35 36
00
01 02 03 00 01 02 03
RM0008

Advertisement

Table of Contents
loading

This manual is also suitable for:

Stm32f107 seriesStm32f102 seriesStm32f103 seriesStm32f105 seriesStm32f101 series

Table of Contents