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.

TMS320F28388D: Variable switching frequency for PWM

Part Number: TMS320F28388D
Other Parts Discussed in Thread: C2000WARE

Hi TI,

I am using TMS320F28388D controller in my application and i want to use variable switching frequency for PWM.

In ADC_A1 ISR i am updating the PWM compare values, now in run time can i change the period of TBPRD of PWM.

Any other settings i need to modify or any challenges will be there to achieve this??

Thanks,

Saikumar.

  • Hello Saikumar,

    For a basic configuration of the ePWM, you have everything you need. CMPx values must be updated for the new TBPRD, and both CMPx values and TBPRD should be utilizing the shadow-load functionality to ensure stability.

    Keep in mind that if you change the TBPRD, your CMPx values will be incorrect until your next ISR, and so (depending on how dramatically the value for TBPRD was changed) you may get an unexpected waveform on your ePWM outputs. If possible, I recommend keeping a constant TBPRD while adjusting the CMPx values for variable duty. The configuration requirements for this are simpler and faster- though obviously this is not going to be possible in every application. The global load functionality can be utilized to ensure that TBPRD and the CMPx values are updated at the same time- see ePWM ex14 in C2000Ware, though if you'd like I can also try and expand on it in an another reply here.

    If you're using either of the following configuration options, you may also need to make adjustments;

    • Time-Base (TB) Submodule's Phase Shift Load feature
      • If there are any ePWMs in this system with a phase shift, the TBPHS value will require adjustment relative to TBPRD to ensure the phase shift remains.

    • Dead-Band (DB) Submodule RED/FED features
      • Rising and Falling-Edge Delay are typically assigned relative to the frequency of the PWM to achieve certain amount of actual delay. Although these values will typically not require adjustment unless at very low duty, it's important to keep them in mind.

    I hope that helps! 

    Regards,
    Jason Osborn
    Note: Key takeaways from this post are bolded.

  • Hi Jason Osborn,

    Thank you for your quick response.

    I didn't quite understand about this statement "If possible, I recommend keeping a constant TBPRD while adjusting the CMPx values for variable duty" eventhough i change CMPx values the switching frequency will remain same right. Can you provide more details on this.

    Thanks,

    Saikumar.

  • Hello Saikumar,

    That was meant to be a general note that I tend to try and avoid variable frequency in favor of variable duty % wherever possible due to simpler configuration requirements.

    However, as I noted, this is obviously not going to be possible in every application, and if you need variable frequency, you can ignore that comment. Everything else in the previous post is in reference to variable frequency.

    Regards,
    Jason Osborn
    Note: Key takeaways from this post are bolded.