2025-07-09 10:23 AM - last edited on 2025-07-09 2:06 PM by mƎALLEm
In my STM32G431CBU6 implementation, COMP1, COMP2 and COMP3 are configured for back-EMF zero-crossing detection with TIM1 CH5 serving as the blanking source. Both rising and falling edge interrupts are enabled on the comparators. TIM1 channels 1, 2 and 3 generate PWM signals for motor MOSFET driving. Despite TIM1 CH5 blanking covering the entire PWM period, the comparator interrupts continue to be erroneously triggered by PWM switching noise
2025-08-02 4:49 PM
Were you able to resolve the issue? Also I have the exact same problem. Like 1:1. What a coincidence!
2025-08-05 5:42 AM
Hello @QVQ & @Lorenzono,
The blanking function in the STM32G431CBU6 only masks the comparator output during the blanking window; it does not disable the comparator itself. So, if TIM1 CH5 blanking covers the entire PWM period, the comparator can still detect noise and generate interrupts due to PWM switching.
You can increase the comparator hysteresis to reduce its sensitivity, (10: Medium hysteresis or 11: High hysteresis)
You can also, enable the deglitching feature in the COMP_CxCSR register
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.