PWM signal control
AN3248
12/19
Doc ID 17758 Rev 1
4
PWM signal control
In STM32L15xxx devices, the COMP2 output can be redirected to the output compare
reference clear signal (OCREFCLR) of the embedded timers: TIM2, TIM3, and TIM4 (refer
to
Figure 7: COMP2 with output redirection feature
).
The possibility of redirecting the
COMP2 output can be used to provide a fast response time that is independent from the
system frequency when an analog event occurs. This application case controls a PWM
signal for motor control when the current sensor output is connected to the COMP2 non-
inverting input. In this situation, the reference voltage is connected to the COMP2 inverting
input. When the current sensor output exceeds the selected threshold, the COMP2 output
goes high and the PWM signals switch to safe state.
Figure 9.
PWM signal control: COMP2 output redirection to timer
1.
In the pulse width measurement application, COMP1 cannot be used since its output CMP1OUT (internal
output) is not connected to the embedded timers.
Note:
When the current sensor voltage reaches the reference voltage, the COMP2 output goes
high. Consequently, the PWM and output compare reference signals go low (to safe state).
4IME
07-SIGNAL
4IME
07-SIGNALATSAFESTATELOWLEVEL
4IME
#/-0OUTPUTISATHIGHLEVEL
,OWLEVEL
(IGHLEVEL
#/-0OUTPUT
#URRENTSENSOROUTPUT
2EFERENCEVOLTAGE
AI