Comparator (COMP) RM0440
782/2126 RM0440 Rev 4
24.5 COMP interrupts
The comparator outputs are internally connected to the Extended interrupts and events
controller. Each comparator has its own EXTI line and can generate either interrupts or
events. The same mechanism is used to exit Sleep and Stop low-power modes.
Refer to Interrupt and events section for more details.
To enable the COMPx interrupt, it is required to follow this sequence:
1. Configure and enable the EXTI line corresponding to the COMPx output event in
interrupt mode and select sensitivity to rising edge, falling edge or to both edges
2. Configure and enable the NVIC IRQ channel mapped to the corresponding EXTI lines
3. Enable COMPx
Interrupt events are flagged through COMP_CxCSR flags.
24.6 COMP registers
24.6.1 Comparator x control and status register (COMP_CxCSR)
For x = 1 through 7, the COMP_CxCSR register contains all bits and flags related to the
comparator x.
Address offset: 4(x-1), where x = 1 to 7
System reset value: 0x0000 0000
Low-power sleep No effect. COMP interrupts cause the device to exit the Low-power sleep mode.
Stop
No effect on the comparators.
Comparator interrupts cause the device to exit the Stop mode.
Standby,
Shutdown
The COMP registers are powered down and must be reinitialized after exiting
Standby or Shutdown mode.
Table 198. Comparator behavior in low-power modes (continued)
Mode Description
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
LOCK VALUE Res. SCALEN BRGEN BLANKSEL[2:0] HYST
rw r rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
POL Res. INPSEL INMSEL[2:0] Res. EN
rw rw rw rw rw rw rw