Comparator (COMP) RM0453
626/1450 RM0453 Rev 5
21.4 COMP low-power modes
21.5 COMP interrupts
The comparator outputs are internally connected to the extended interrupts and events
controller (EXTI). Each comparator has its own EXTI line and can generate either interrupts
or events. The same mechanism is used to exit from low-power modes.
Refer to the “Interrupt and events” section for more details.
The following sequence enables the COMPx interrupt through EXTI block:
1. Configure and enable the EXTI line corresponding to the COMPx output event in
interrupt mode and select the rising, falling or both edges sensitivity.
2. Configure and enable the NVIC IRQ channel mapped to the corresponding EXTI lines.
3. Enable the COMPx.
Table 126. Comparator behavior in the low-power modes
Mode Description
Sleep
No effect on the comparators
Comparator interrupts cause the device to exit the Sleep mode.
LPRun No effect
LPSleep
No effect on the comparators
Comparator interrupts cause the device to exit the LPSleep mode.
Stop 0
No effect on the comparators
Comparator interrupts cause the device to exit the Stop mode.
Stop 1
Stop 2
Standby
COMP registers are powered down and must be reinitialized after exiting
Standby or Shutdown mode.
Shutdown
Table 127. Interrupt control bits
Interrupt event Event flag
Enable control
bit
Exit from Sleep
mode
Exit from Stop
modes
Exit from
Standby mode
COMP1 output
VALUE in
COMP1_CSR
Through EXTI Yes Yes Not applicable
COMP2 output
VALUE in
COMP2_CSR
Through EXTI Yes Yes Not applicable