2023-07-14 2:11 PM
Hi,
I am trying to create to PWM outputs with a variable phase shift between them. They are of fixed frequency, 50% duty and exactly the same shape but with variable phase shift. I need to dynamically change the phase shift between them as a control parameter. I am OK with using two timers, but I cannot see how I can realize this.
Thanks
2023-07-14 3:47 PM
Simple trick is to use combined PWM mode. Take one timer, 4 channels would generate 2 PWM, where 1-st ch. defines start time and 2-nd channel - stop time of the first PWM, than 3 and 4 start/ stop second PWM. To shift just change CCR3 & CCR4 as a pair
2023-07-14 11:14 PM - edited 2023-07-14 11:15 PM
With 50% duty, an even simpler trick is to use two channels Output Compare in Toggle mode. Simply changing CCRx of one of them will change their mutual phase.
JW
We’re moving the ST Community to a new platform to give you a better and more reliable community experience.