STMicroelectronics application guide for the STM32H7 analog comparator (COMP), covering modes, break signals, blanking, and a low-power watchdog example.
This STMicroelectronics document describes the analog comparator (COMP) in STM32H7 microcontrollers. It covers COMP1 and COMP2 features, operating modes including window comparator mode, break signal generation for timers, and COMP blanking.
It also provides an application example using STM32H743I_EVAL, configuring COMP1 as a low-power analog watchdog that can wake the MCU from stop mode, with CubeMX setup and code changes. This manual is written in Chinese.
| Number of comparators | 2 (COMP1 and COMP2) |
|---|---|
| Window comparator mode | Supported by combining COMP1 and COMP2 |
| Wake from stop mode | Supported |
| Example evaluation board | STM32H743I_EVAL |
| Example COMP1 input pin | PB0 (CN6 pin 29) |
| Example system clock | 400 MHz |
| Example wake threshold | 1.22 V or higher on PB0 |
It indicates whether an analog voltage is lower or higher than the threshold voltage applied to the inverting input of each comparator; the two non-inverting inputs can be connected internally by enabling WINMODE to save an I/O pin.
COMP1/COMP2 outputs can generate break input signals to TIM1 and TIM8 on TIMx_BKIN or TIMx_BKIN2 by configuring the GPIO alternate function.
The ADC powers down in stop mode, while COMP1 can remain powered in stop mode, allowing the MCU to stay in stop mode and wake when the input exceeds VREFINT.
COMP1 interrupt is triggered, the MCU wakes and LED1 turns on; after about 5 seconds LED1 turns off and the MCU returns to stop mode.