Forced Output Mode; Figure 187. Pwm Input Mode Timing - ST STM32F412 Reference Manual

Advanced arm-based 32-bit mcus
Table of Contents

Advertisement

General-purpose timers (TIM9 to TIM14)
1.
Select the active input for TIMx_CCR1: write the CC1S bits to '01' in the TIMx_CCMR1
register (TI1 selected).
2.
Select the active polarity for TI1FP1 (used both for capture in TIMx_CCR1 and counter
clear): program the CC1P and CC1NP bits to '00' (active on rising edge).
3.
Select the active input for TIMx_CCR2: write the CC2S bits to '10' in the TIMx_CCMR1
register (TI1 selected).
4.
Select the active polarity for TI1FP2 (used for capture in TIMx_CCR2): program the
CC2P and CC2NP bits to '11' (active on falling edge).
5.
Select the valid trigger input: write the TS bits to '101' in the TIMx_SMCR register
(TI1FP1 selected).
6.
Configure the slave mode controller in reset mode: write the SMS bits to '100' in the
TIMx_SMCR register.
7.
Enable the captures: write the CC1E and CC2E bits to '1' in the TIMx_CCER register.
TIMx_CNT
TIMx_CCR1
TIMx_CCR2
1. The PWM input mode can be used only with the TIMx_CH1/TIMx_CH2 signals due to the fact that only
TI1FP1 and TI2FP2 are connected to the slave mode controller.
18.3.7

Forced output mode

In output mode (CCxS bits = '00' in the TIMx_CCMRx register), each output compare signal
(OCxREF and then OCx) can be forced to active or inactive level directly by software,
independently of any comparison between the output compare register and the counter.
To force an output compare signal (OCXREF/OCx) to its active level, one just needs to write
'101' in the OCxM bits in the corresponding TIMx_CCMRx register. Thus OCXREF is forced
high (OCxREF is always active high) and OCx get opposite value to CCxP polarity bit.
For example: CCxP='0' (OCx active high) => OCx is forced to high level.
The OCxREF signal can be forced low by writing the OCxM bits to '100' in the
TIMx_CCMRx register.
Anyway, the comparison between the TIMx_CCRx shadow register and the counter is still
performed and allows the flag to be set. Interrupt requests can be sent accordingly. This is
described in the output compare mode section below.
558/1163

Figure 187. PWM input mode timing

TI1
0004
0000
IC1 capture
IC2 capture
reset counter
0001
0002
0004
0002
RM0402 Rev 6
0003
0004
0000
IC2 capture
IC1 capture
pulse width
period
measurement
measurement
RM0402
ai15413

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Questions and answers

Table of Contents

Save PDF