Skip to main content
Visitor II
July 9, 2025
Question

STM32G431 Comparator Blanking issue

  • July 9, 2025
  • 2 replies
  • 358 views

      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

 

    This topic has been closed for replies.

    2 replies

    Visitor II
    August 2, 2025

    Were you able to resolve the issue? Also I have the exact same problem. Like 1:1. What a coincidence!

     

    ST Employee
    August 5, 2025

    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