Showing results for 
Search instead for 
Did you mean: 

Usage of Comparators with PWM Generation


I am trying to design a digital SMPS with an STM32G0.

ST has lots of literature stating that the comparators can be used to control the duty cycle of the PWM from a timer.

I understand the use of a comparator to detect a fault and output to the BKIN input of the timer, but they mention "ETR" being used for "zero cross detection" to turn the timer back on.

It seems to me like what they're implying is that rather than implementing the control loop in software, the comparators can simply bounce the timer back and forth to regulate the output. If this is the case, why is a timer involved?

I must be misunderstanding.

Are there any "standard practices" for using comparators to implement performant and safe SMPS?

Any help is much appreciated, thanks!