2025-03-20 9:26 AM - edited 2025-03-21 2:35 AM
In my setup, I’m using Comparator 6 (COMP6) on the STM32G474 microcontroller. The non-inverting input of the comparator is connected to a burden resistor from a current transformer, which measures current flow. The inverting input is tied to a fixed 1.5V reference created by a voltage divider. The goal is for the comparator to disable all PWM signals (generated by HRTIM TimerA) when the burden resistor voltage reaches 1.5V, indicating an overcurrent condition (e.g., 10A).
Issue: Despite the burden resistor voltage hitting 1.5V at 10A, the comparator does not trigger, and the PWM remains active.
Solved! Go to Solution.
2025-03-21 3:44 AM
Thanks Andrew ,
I initially misinterpreted the readings, but after carefully rechecking, I confirmed that the current does not exceed 10A.
and my comparator work perfectly.
2025-03-20 9:57 AM
You expect the PWM to be disabled when this voltage reaches 1.5V ?
So, if the voltage is only reaching 1.4V, then you would not expect the PWM to stop.
Your system seems to be operating as expected ?
2025-03-21 2:38 AM
Apologies for the typing mistake—it should be 1.5V, not 1.4V. Even when the current exceeds 1.5V, the PWM does not disable.
2025-03-21 2:52 AM
@waaizkhan wrote:Even when the current exceeds 1.5V, the PWM does not disable.
Have you confirmed if that's because the Comparator doesn't trigger, or your code doesn't act on the trigger?
Have you used the debugger to see what's going on?
and/or added printfs or similar?
2025-03-21 3:14 AM
2025-03-21 3:19 AM
So look at why your code isn't acting on that ...
2025-03-21 3:44 AM
Thanks Andrew ,
I initially misinterpreted the readings, but after carefully rechecking, I confirmed that the current does not exceed 10A.
and my comparator work perfectly.
2025-03-21 4:02 AM
So if it's now all working fine, please mark the solution - see:
https://community.st.com/t5/community-guidelines/help-others-to-solve-their-issues/ta-p/575256