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.

CCS/TMS320F28379D: F28379D ePWM Synchronization

Part Number: TMS320F28379D

Tool/software: Code Composer Studio

Hello,

I'm trying to understand how the ePWM synchronization works for the F28379D microcontroller.  Unfortunately, the technical reference manual is rather vague and doesn't have much explanation to go along with Figure 15-7.

A few questions I have:

1.  I know that if TBCTL[PHSEN] = 1, then when a synchronization event occurs, then (TBCTR) will be loaded with the phase (TBPHS).   In examples that I've looked at, I've typically seen one "master" ePWM with TBCTL[PHSEN] = 0 and the other "slave" ePWMs TBCTL[PHSEN] = 1.  Is it possible to have all ePWMs have TBCTL[PHSEN] = 1, or it necessary to have one "master" with TBCTL[PHSEN] = 0  ?

2.  Can you synchronize ePWM3 and ePWM2 with ePWM1 even if all three ePWMs have different periods?  If so, when is this synchronization done?  For example, if TBPHS of ePWM2 is changed, when will this take effect?

3.  If I understand correctly, by default the sync output of ePWM1 goes to the sync input of ePWM2, and the sync output of ePWM2 goes to the sync input of ePWM3.  Is there a way to make the sync output of ePWM1 go to the sync input of ePWMx, bypassing the ones in between?  If so, how is this done?

Thank you,

Kevin

  • Can anyone help with these questions?

    Thanks,

    Kevin

  • Hi,


    Kevin Bachovchin said:
    1.  I know that if TBCTL[PHSEN] = 1, then when a synchronization event occurs, then (TBCTR) will be loaded with the phase (TBPHS).   In examples that I've looked at, I've typically seen one "master" ePWM with TBCTL[PHSEN] = 0 and the other "slave" ePWMs TBCTL[PHSEN] = 1.  Is it possible to have all ePWMs have TBCTL[PHSEN] = 1, or it necessary to have one "master" with TBCTL[PHSEN] = 0  ?


    There is no restriction that you've to have master" with TBCTL[PHSEN] = 0. But that would be the common way of using it as you would have a master time base that would synchronize the rest of the timers to it's time base.
    Why would you want to have master" with TBCTL[PHSEN] = 1? If so, what would you synchronize this to?

    Kevin Bachovchin said:
    2.  Can you synchronize ePWM3 and ePWM2 with ePWM1 even if all three ePWMs have different periods?  If so, when is this synchronization done?  For example, if TBPHS of ePWM2 is changed, when will this take effect?


    Theoretically, you could synchronize even in different periods. Synchronization would occur based on you configuration of the sync pulse output in the master. For ex: if you had chosen counter zero as the synchronization pulse in the master ePWM1, on every counter zero of ePWM1 a synchronization pulse will be transmitted to the slave timers. When different PWMs are operating with periods, you could synchronize but you've to be clear about the consequences.
    Again, why would you want to do this?
    TBPHS takes effect and gets loaded into the TBCTR when the synchronization pulse occurs.

    Kevin Bachovchin said:
    3.  If I understand correctly, by default the sync output of ePWM1 goes to the sync input of ePWM2, and the sync output of ePWM2 goes to the sync input of ePWM3.  Is there a way to make the sync output of ePWM1 go to the sync input of ePWMx, bypassing the ones in between?  If so, how is this done?


    If you would just like to bypass ePWM2 and send sync from ePWM1 to ePWM3
    Set TBCTL[SYNCOSEL] to zero - thats the default as well, in ePWM2
    Disable PHSEN in ePWM2.
     

  • Thanks for your helpful reply.  The only reason I would want to synchronize PWMs with a different period would just be because to "pass through" the synchronization, but I suppose that it is not a good way to do it.

    For my application, I want to synchronize ePWM4 with ePWM1 (which both have the same period) and I want to synchronize ePWM3, ePWM5, and ePWM6 with ePWM2 (which all four have the same period, but a different period than ePWM1 and ePWM4).    How would I set TBCTL[SYNCOSEL] to be able to accomplish this in a clean way?

    I suppose the best way to do this is not to set TBCTL[SYNCOSEL] = 1 for  ePWM1 and then TBCTL[SYNCOSEL] = 0 for ePWM2-6.

  • Hi,

    please refer to Figure 15-7. Time-Base Counter Synchronization Scheme
    of the device TRM.
    There are certain restrictions sue to the structure of the Sync Chain as depicted in this diagram.
    For ex, ePWM2 can not independently generate sync to ePWM5, and ePWM6.
    Please follow the diagram and create Sync chains accordingly.

  • Could you elaborate on what you mean about the restrictions?  I have been studying Figure 15-7, but as a new user it is very confusing to me.  Are only ePWM1,4,7,10, etc able to be "masters"?  Those are the only ones in the figure that have "EPWMSYNCOUT".  Also, the effect of TBCTL[SYNCOSEL] is not shown in the figure. 

    Are you saying that ePWM2 can be the "master" for ePWM3, just not for ePWM5 and 6?

    Also, for my application where I want to synchronize ePWM1 and 4, and synchronize ePWM2, 3, 5, and 6, would setting TBCTL[SYNCOSEL] = 1 for  ePWM1 and then TBCTL[SYNCOSEL] = 0 for ePWM2-6  to synchronize them all together work?  Or would this create a problem?

    Thanks,

    Kevin

  • Hi Subrahmanya,

    Could you elaborate on what you mean about the restrictions?  I have been studying Figure 15-7, but as a new user it is very confusing to me.  Are only ePWM1,4,7,10, etc able to be "masters"?  Those are the only ones in the figure that have "EPWMSYNCOUT".  Also, the effect of TBCTL[SYNCOSEL] is not shown in the figure. 

    Are you saying that ePWM2 can be the "master" for ePWM3, just not for ePWM5 and 6?

    Also, for my application where I want to synchronize ePWM1 and 4, and synchronize ePWM2, 3, 5, and 6, would setting TBCTL[SYNCOSEL] = 1 for  ePWM1 and then TBCTL[SYNCOSEL] = 0 for ePWM2-6  to synchronize them all together work?  Or would this create a problem?

    Thanks,

    Kevin

  • Hi,

    Kevin Bachovchin said:
    I have been studying Figure 15-7, but as a new user it is very confusing to me.  Are only ePWM1,4,7,10, etc able to be "masters"? 


    These modules, as you can see from the diagram, can send Sync pulse across different chains. In the diagram wherever there are links, it means sync pulse can propagate.

    Kevin Bachovchin said:

    Are you saying that ePWM2 can be the "master" for ePWM3, just not for ePWM5 and 6?



    That's correct, because there is no link from ePWM2 to ePWM5 directly or via other modules.

    Kevin Bachovchin said:
    for my application where I want to synchronize ePWM1 and 4,

    Synchronizing 1 and 4 is not a problem as i've already clarified and also obvious from the diagram.

    Kevin Bachovchin said:
    synchronize ePWM2, 3, 5, and 6, would setting TBCTL[SYNCOSEL] = 1 for  ePWM1 and then TBCTL[SYNCOSEL] = 0 for ePWM2-6  to synchronize them all together work?  Or would this create a problem?


    ePWM2 can not be a master and propagate its own sync pulse to 5 and 6. It can only propagate to 3. This can be seen from the diagram I mentioned above. Looks like that was your interpretation too.

    SYNCOSEL simply determines what would be the Sync pulse coming out of a certain module.
    For more details on this, you can refer to Figure 15-3. ePWM modules and Critical Internal Signal Interconnects

  • Thanks, this was very helpful.

    Just to clarify, could I accomplish what I want (synchronizing ePWM 2, 3, 5, and 6 together and synchronizing 1 and 4 together) by synchronizing all six together with EPWM1 as the master and EPWM2-6 as slaves?  Would this still work even though 1 and 4 will have different switching frequencies than 2, 3, 5, and 6 ?  (For my application, I need to be able to phase shift 1 and 4 relative to each other, and phase shift 2, 3, 5, and 6 relative to each other.  The phase shift between 1/4 relative to 2/3/5/6 does not matter to me.)

  • Hi Subrahmanya,

    Thanks for your helpful replies.

    Just to clarify, could I accomplish what I want (synchronizing ePWM 2, 3, 5, and 6 together and synchronizing 1 and 4 together) by synchronizing all six together with EPWM1 as the master and EPWM2-6 as slaves?  Would this still work even though 1 and 4 will have different switching frequencies than 2, 3, 5, and 6 ?  (For my application, I need to be able to phase shift 1 and 4 relative to each other, and phase shift 2, 3, 5, and 6 relative to each other.  The phase shift between 1/4 relative to 2/3/5/6 does not matter to me.)

  • Hi,

    There is nothing that stops Synchronization from occurring just because your are operating PWMs at different frequencies.
    If you are synchronizing PWMs operating at different frequencies - make sure that result is what you intended, as it could result in random waveform if the frequencies are not integral multples etc. So, i would say that there is no restriction from MCU to prevent synchronization for modules operating at different frequencies but as a user you need to be aware of the consequences and make sure the outputs are as intended by your application.