50.4. The phase shifting of PWM

50.4.1. Overiew

PWM supports the function of phase-shifting. This example demonstrates the operation of phase-shifting the PWM wave upon receiving an external trigger input

50.4.2. Configurations

  • Oscilloscope

  • Install the serial terminal, view board information , and configure the serial terminal parameters

  • PWM_P0, PWM_P2 pins Check the information according to the board model

50.4.3. Running the Demo

  • After power on, P0 and P2 output waveforms with the same phase. Every 3 seconds, the phase of P2 will shift by 10 degrees. The first phase change results in a 60 degree difference.

  • Serial port printing information:

pwmv2 two pwm submodule phase sync example
choose PWM output channel [P0 P2]


>> P0 and P2 generate same phase firstly
Two waveforms will be generated
Please press trigger pin, P2 phase will shift
P0 is a reference

P0 and P2 now have a phase difference of 60 degrees

P0 and P2 now have a phase difference of 70 degrees

P0 and P2 now have a phase difference of 80 degrees

P0 and P2 now have a phase difference of 90 degrees

P0 and P2 now have a phase difference of 100 degrees
...