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.

TMS320F28374D: Control for both Duty Cycle and Phase shift

Part Number: TMS320F28374D
Other Parts Discussed in Thread: C2000WARE

Tool/software:

Hi Team, 

I received this inquiry from a customer, asking for a mode that would provide precise control of both duty cycle and phase shift: 

"

I am using F2837xD MCU for my project to generate PWM signals. I plan to get the data from ADC and use it to control the duty cycle of PWM. Also, there are two PWM channels that their phase difference should be controlled precisely. In other words, I need both high-resolution duty cycle control and phase shift control. I was reading “TMS320x280x, 2801x, 2804x High Resolution Pulse Width Modulator (HRPWM)” app note SPRU924F and it says:

 

Edge Mode: — The MEP can be programmed to provide precise position control on the rising edge (RE), falling edge (FE) or both edges (BE) at the same time. FE and RE are used for power topologies requiring duty cycle control, while BE is used for topologies requiring phase shifting, e.g., phase shifted full bridge.

Control Mode: — The MEP is programmed to be controlled either from the CMPAHR register (duty cycle control) or the TBPHSHR register (phase control). RE or FE control mode should be used with CMPAHR register. BE control mode should be used with TBPHSHR register.

Apparently none of these configure modes for HRPWM can provide precise control for both duty cycle and phase shift. Can you confirm this or correct me by suggesting a configure mode that I can use for both duty cycle control and phase shift control at the same time?"

Can you help with this? 

-RT

  • Hi RT,

    This is correct, the MEP which controls the high resolution edge of the HRPWM module cannot be controlled by both duty and phase control. In instances where HR control, you can implement modes to switch control of the MEP between duty and phase. For instance, we have implemented this in our TIDM-2013 design which you can reference.

    Alternately, you can keep the HRPWM in duty control mode and calculate the phase shift manually to make use of HR. We don’t have example code that demonstrates this but it is possible

    Regards,

    Peter

  • Dear Peter, 

    Can you share the concept for calculate the phase shift manually? 

    Best Regards,

    Eric Chen

  • Hi Eric

    Peter is referring to you manually calculating and updating your counter compare values to account for both phase shift and duty cycle. At a high level, here is an example where the PWM begins with rising/falling edges on CMPA = 15 and CMPB = 65. "Phase shift" is applied by updating CMPA and CMPB values to CMPA = 10 and CMPB = 60 rather than writing to TBPHS. This calculation is equivalent to using phase shift of TBPHS = 5. Here's a quick diagram in case it helps:

    Best Regards,

    Allison

  • Dear Allison, 

    Ops! I understood what you mean. 

    Thanks for the diagram, very clearly! 

    Best Reagrds,

    Eric 

  • Hi Eric,

    Just responding here to state we are following up via email. We can post again if further information should be provided on the thread.

    Best Regards,

    Allison

  • Hi Eric,

    Just wanted to check if there was any follow up from the customer regarding this thread per my last email?

    Best Regards,

    Allison

  • Dear Allison,

    Thanks for checking with me about the status. 

    According to the discussion per your email, the customer has no questions for this topic. 

    You may close the thread, Thank you!

    Best Regards,

    Eric

  • Hi Eric,

    Thanks for the follow up! I will post a few notes from our mail thread here in case this thread is referred to in the future Slight smile

    • Regarding my first response above, the diagram posted was not specific to HR as CMPAHR is only for channel A and CMPBHR is for channel B.
    • The desired use case was actually that channel B is phase shifted relative to the channel A (rather than EPWMx to EPWMy level), so phase shift and duty cycle adjustment will be done on one channel. The phase shift and duty cycle changes are also variable, not static and will be updated frequently ~every cycle. 
    • My input is that the EPWM phase shift hardware (TBPHS and TBPHSHR) is only applied between two separate EPWM modules, not between EPWM channels A and B. I don’t see an easy way to implement both HR phase shift and duty control at the same time for two separate PWM modules given the HR control mode registers.  However, since the customer is using a single EPWM module, they could implement “phase shift” between channels A and B using half-cycle clocked Dead Band and then apply duty control using CMPAHR/BHR.
    • Also, we do not have a specific example showcasing this, but there is an example applying regular dead band while also using HR duty control in the latest C2000Ware (C2000WARE_ROOT\driverlib\f2837xd\examples\cpu1\hrpwm\hrpwm_ex9_dutyhr_updown_deadband_sfo.

    Feel free to mark this as resolved to help close the thread!

    Best Regards,

    Allison