PWM shift phase on teensy 4.1

SaeedB

New member
Is there any code that shows how to shift the phase of a pwm on teensy 4.1? analogWrite has no shift phase attribute.
 
Yes, I want to generate 2 pwms that have shift phases relative to each other.

To do this, you have to get into the low-level details of the FlexPWM module (chapter 55 of the iMXRT1062 reference manual). Take a look at this thread for an example (https://forum.pjrc.com/threads/68600-Teensy-4-1?p=292562&viewfull=1#post292562)

Maybe that example is enough, but if you have specific requirements, let us know a little more. For example, if you only need to generate square waves that are phase-shifted relative to each other, the example above may be sufficient. If you need multiple PWM that are phase-shifted and also have independent duty cycle, that will require a deeper dive into FlexPWM.
 
Back
Top