09.12.2012 Views

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>RM0090</strong> General-purpose timers (TIM2 to TIM5)<br />

Particular case: OCx fast enable:<br />

In One-pulse mode, the edge detection on TIx input set the CEN bit which enables the<br />

counter. Then the comparison between the counter and the compare value makes the<br />

output toggle. But several clock cycles are needed for these operations and it limits the<br />

minimum delay t DELAY min we can get.<br />

If you want to output a waveform with the minimum delay, you can set the OCxFE bit in the<br />

TIMx_CCMRx register. Then OCxRef (and OCx) is forced in response to the stimulus,<br />

without taking in account the comparison. Its new level is the same as if a compare match<br />

had occurred. OCxFE acts only if the channel is configured in PWM1 or PWM2 mode.<br />

15.3.11 Clearing the OCxREF signal on an external event<br />

The OCxREF signal for a given channel can be driven Low by applying a High level to the<br />

ETRF input (OCxCE enable bit of the corresponding TIMx_CCMRx register set to '1'). The<br />

OCxREF signal remains Low until the next update event, UEV, occurs.<br />

This function can only be used in output compare and PWM modes, and does not work in<br />

forced mode.<br />

For example, the ETR signal can be connected to the output of a comparator to be used for<br />

current handling. In this case, ETR must be configured as follows:<br />

1. The external trigger prescaler should be kept off: bits ETPS[1:0] in the TIMx_SMCR<br />

register are cleared to 00.<br />

2. The external clock mode 2 must be disabled: bit ECE in the TIM1_SMCR register is<br />

cleared to 0.<br />

3. The external trigger polarity (ETP) and the external trigger filter (ETF) can be<br />

configured according to the application’s needs.<br />

Figure 152 shows the behavior of the OCxREF signal when the ETRF input becomes high,<br />

for both values of the OCxCE enable bit. In this example, the timer TIMx is programmed in<br />

PWM mode.<br />

Figure 152. Clearing TIMx OCxREF<br />

counter (CNT)<br />

ETRF<br />

OCxREF<br />

(OCxCE=0)<br />

OCxREF<br />

(OCxCE=1)<br />

(CCRx)<br />

ETRF<br />

becomes high<br />

ETRF<br />

still high<br />

1. In case of a PWM with a 100% duty cycle (if CCRx>ARR), OCxREF is enabled again at the next counter<br />

overflow.<br />

Doc ID 018909 Rev 3 442/1416

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!