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.

LAUNCHXL-F280049C: ePWM Phase Shift Modification in main loop

Part Number: LAUNCHXL-F280049C

Hi, my name is Iulian Popa.

I´m a student from Univerity of Zaragoza in Spain. Im using one of your development board 'LAUNCHXL-F280049C' and I have some questions and problems when I´m trying to control some PWM signals.

First of all, Im using:

-  CodeComposer version 9.3

-  C2000Ware version 3.1.0.00

My problem is related to the use of high-resolution phase shift. With the configuration of the different modules and PWM outputs I can perform a phase shift between the PWM outputs using the function "EPWM_setPhaseShift(EPWMX_BASE, xxxU);" and I can also perform a high-resolution variable phase shift of all PWM signals. The concrete problem is that I am not able to perform a variable phase shift by making the registers "EPwmXRegs.TBPHS.bit.TBPHS" change within the "main loop" or even during the program execution.

Summarizing:
- I can configure the ePWM modules to synchronize and offset only with the own configuration
- I manage to configure the MEP and HRPWM registers for this functionality to work properly.
- I do not understand what I have to do to be able to do the EPWM_setPhaseShift(EPWMX_BASE, xxxU); inside the main loop to get a phase shift that varies (because I can only get the phase shift that I put inside the configuration). Can I write this register once the program is running? Do I have to do something special to be able to write this register

I hope you understand my question/problem :D
A greeting. Iulian

  • So there are multiple things that could be happening Iulian.

    So when you set the TBPHS value, that is fine, it should be written but UNTIL A PHASE event occurs, it will not be loaded. So what is the source for the PHS to be updated? I am guessing you have PHSEN set to 1. If the parent PWM is supposed to generate the PHS load event, it can be CTR=ZERO/PRD based on your setting. Since you are using HR mode, I recommend using SWSYNC to synchronize with the new phase values when needed to avoid jitter.

    Nima

  • Hi Nima, thank for you answer.

    First of all, I have activated "PHSEN = 1". I also have a PWM "master" signal from which I implement phase shifts relative to it.
    For this "master" signal I have activated the synchronization function as mentioned (EPWM_setSyncOutPulseMode(EPWM1_BASE, EPWM_SYNC_OUT_PULSE_ON_COUNTER_ZERO);) (EPWM1_A is the master and the following EPWM2,3,4,5,6_A are "slave") I think my problem is not to have understood very well the synchronization scheme that appears in the manual because in the PWM "slave" signals I have the following function activated during its configuration (EPWM_setSyncOutPulseMode(EPWM3_BASE, EPWM_SYNC_OUT_PULSE_ON_EPWMxSYNCIN);).
    Summing up:
    -I think the PWM modules configuration is well done (except the synchronization events) because I get an initial phase shift and I get a high resolution phase shift handling.
    -I think I am not understanding how I should configure and use the synchronization functions and how I should interpret the synchronization scheme from the microcontroller manual (Figure 18-7. Time-Base Counter Synchronization Scheme)
    - Could you help me to understand how to interpret figure 18-7 and how I should use the "driverlib" functions for the correct configuration of a synchronization chain where the PWM master is EPWM1_A and the slaves are the following 5 PWM (EPWM2,3,4,5,6_A)?

    Thank you very much. Iulian

    Translated with www.DeepL.com/Translator (free version)

  • So the way the synchronization works is:

    The Parent EPWM should:

    • not have it's PHSEN set
    • Have a SYNCOUT pulse EPWM_setSyncOutPulseMode(EPWM1_BASE, EPWM_SYNC_OUT_PULSE_ON_COUNTER_ZERO)

    The child EPWM should:

    • have it's phsen set
    • Have their SYNCIN configure.
    • On EPWM's down the chain of another EPWM, you should be okay. but for EPWMs that have SYNCOSEL muxes above them, they should be configured through their SYNCOSEL

    Also dont forget that the EPWM chain cannot be longer than 3 child epwms + 1 parent epwm

  • Hello Nima, I take note of your recommendation.

    With the last lines of your answer you are telling me that it is not possible to keep 5 PWM modules synchronized with one master module? If this is the case, is there any way I can keep synchronized and implement a phase shift control for 5 child PWM modules?

    Thank You Nima.

    Iulian!!

  • It is possible but your sync chain, you can do

    EPWM1 -> EPWM2 -> EPWM3

    Then you have to do

    EPWM1 -> EPWM4 -> EPWM5

  • Hi Nima,

    That's was exactly I was doing to syncro the 6 PWM.

    I got your recommendations for synchronization settings and synchronization events and it's already working perfectly. Now I can modify the EpwmXRegs.TBPHS.bit.TBPHS during debugging to see how effectively the signals are offset.

    The problem was that there was no correct configuration of the synchronization events of the slave modules with the master module.

    Greetings and thank you very much!