This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Phase shift of pwm channels with different frequency



Hello,

I have a question regarding phase shift for PWM channels with different frequency.

Im using a Piccolo F28035 device (60Mhz).

I have the first 6 PWM channels configured to run 25kHz (2400 period), where ePWM1 is the master, running in phase with ePWM2.

ePWM3 and ePWM4 are phase shifted 120 deg., that is 800 counts, where ePWM5 and ePWM6 are phase shifted with 240 deg. (1600 counts).

Everything is working as it should for ePWM1..6

Then I have configured ePWM7 to run 300kHz (200 period count), which is also phase enabled (phase shifted with 50 cycles), referenced to the ePWM1 master with 2400 count period. The reason for phase shifting ePWM7 is so that the ADC will not overlap with the sampling of the other channels.

When i measure the ePWM7 signal, the phase shift is working, but it varies with 184ns (11 cycles), that means that the measured phase is

either 833ns but sometimes can be measured to 1017ns. 

Is there a good reason for this?

 

 

Thank you in advance.

  • Hi Pavel,

    I think I have a possible explanation for this. From your PWM frequencies it looks like you are probably using up-down count mode of operation for PWMs 1 - 6 and up-count operation for PWM 7. If this is true, then you need to be careful when programming the period (TBPRD) values for these PWMs to make sure they are the right frequencies and that they maintain a correct phase-shift between each other.

    For PWMs 1-6 in up-down mode to generate a 25 KHz PWM, you should use a TBPRD = 1200. For PWM 7 in up-count mode to generate a 300 KHz PWM, you should use a value of 199

     If you are not using these values, you might be off by one CPU (sysclk) cycle in every PWM cycle. This means after 12 cycles (300k/25k) you will be off by ~11-12 cycles then what you expect.

    Let me know if this is not the case or if this still doesn't work for you.

    - Hrishi

  • Im using up-count mode for all the pwm channels.

    Changing the TPBRD to a value of 199 has solved my problem for PWM7.

    Thank you very much for your help.

     

    Regards,

    Pavel

     

  • Great! I am glad it helped.

    Hrishi