You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>STM32W108C8</strong><br />
General-purpose timers<br />
For example, to measure the period in the TIMx_CCR1 register and the duty cycle in the<br />
TIMx_CCR2 register of the PWM applied on TI1, use the following procedure depending on<br />
CK_INT frequency and prescaler value:<br />
● Select the active input for TIMx_CCR1: write the TIM_CC1S bits to 01 in the<br />
TIMx_CCMR1 register (TI1 selected).<br />
●<br />
●<br />
●<br />
Select the active polarity for TI1FP1, used both for capture in the TIMx_CCR1 and<br />
counter clear, by writing the TIM_CC1P bit to 0 (active on rising edge).<br />
Select the active input for TIMx_CCR2by writing the TIM_CC2S bits to 10 in the<br />
TIMx_CCMR1 register (TI1 selected).<br />
Select the active polarity for TI1FP2 (used for capture in the TIMx_CCR2) by writing the<br />
TIM_CC2P bit to 1 (active on falling edge).<br />
● Select the valid trigger input by writing the TIM_TS bits to 101 in the TIMx_SMCR<br />
register (TI1FP1 selected).<br />
● Configure the slave mode controller in reset mode by writing the TIM_SMS bits to 100<br />
in the TIMx_SMCR register.<br />
● Enable the captures by writing the TIM_CC1E and TIM_CC2E bits to 1 in the<br />
TIMx_CCER register.<br />
Figure 32.<br />
PWM input mode timing<br />
10.1.7 Forced output mode<br />
In output mode (CCyS bits = 00 in the TIMx_CCMR1 register), software can force each<br />
output compare signal (OCyREF and then OCy) to an active or inactive level independently<br />
of any comparison between the output compare register and the counter.<br />
To force an output compare signal (OCyREF/OCy) to its active level, write 101 in the<br />
TIM_OCyM bits in the corresponding TIMx_CCMR1 register. OCyREF is forced high<br />
(OCyREF is always active high) and OCy gets the opposite value to the TIM_CCyP polarity<br />
bit. For example, TIM_CCyP = 0 defines OCy as active high, so when OCyREF is active,<br />
OCy is also set to a high level.<br />
Doc ID 018587 Rev 2 124/215