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.

ePWM Synchronization for F28335

Other Parts Discussed in Thread: TMS320F28335

Dear All,

I am using TMS320F28335, Can anyone please let me know that. Is it possible to synchronize ePWM2, ePWM3 & ePWM5?

if Yes then Shall this setting be ok for SYNCHRONOUS Register?

EPwm1Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_IN;

EPwm2Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO; //master

EPwm3Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_IN;

EPwm4Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_IN;

EPwm5Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_IN;

EPwm6Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO;

Please make sure our hardware Limitation is  to only utilize EPwm2, EPwm3 & EPwm5  for Three Phase synchronization.

Best Regards,

Prem Prakash Shukla

 

  • Prem,

    You certainly can synchronize ePWM2, 3 & 5 together.  The only limitation is that you will only be able to synchronize ePWM4 with ePWM3 or use no synchronization on ePWM4.

    It looks like you've got the SYNCOSEL bits for each respective PWM correct.  The following must also be configured (in addition to the SYNCOSEL bit) to get everything working:
    - the PHSEN bit of TBCTL also needs to be set correctly on each PWM (disable for the master, enable for the slaves)
    - Each PWMs' TBPHS should be configured correctly
    - TBCLKSYNC needs to be called and clocks need to be enabled.  The order in which you configure register bits does matter some here.  The PWM user's guide for your device will go through the proper procedure.


    Thank you,
    Brett

  • Thanks Brett for your reply.

    Does F28335 Hardware Allow ePWM4,5 to synchronize with ePWM2,3.... when ePWM2 is configured as master?

    we are NOT considering ePWM1 as Master. Can you please look into of page no: 29 of datasheet at below Link.

    http://www.ti.com/lit/ug/spru791f/spru791f.pdf

    Regards,

    Prem Prakash

  • Prem,

    Sorry, you are correct.  I was thinking of a different device.  The figure that you've referenced in the user guide is correct, and you will be unable to synchronize ePWM's 2, 3, and 5 together unless you can use ePWM1 as the synchronization source.

    Not that it matters in this particular case, but you should be looking at the F2833x's PWM User Guide:
    http://www.ti.com/lit/sprug04


    Thank you,
    Brett

  • Hi Brett,

    One More concern.

    Is it necessary Slave should be operating higher OR equal frequency compare to frequency of  Master PWM during synchronization.

    for example: ePWM2_(Master), ePWM3_(Slave) during PWM synchronization, Frequency of ePWM3 >= Frequency of ePWM2. If Yes then why?

    Best Regards,

    Prem

  • Prem,

    Synchronization occurs when an upstream PWM reaches its ZRO event (or maybe CMPB). 

    Let's assume that you're synchronizing PWM2 and PWM3 together.  

    Case 1: If PWM2 runs at 50kHz and PWM3 runs at 100kHz, PWM2 will generate a synchronization event every 50kHz.  PWM3 will finish 2 full periods before it gets the upstream synchronization event which forces it to a certain value.  Everything should work nicely.

    Case 2: If you want PWM2 to run at 100kHz and PWM3 to run at 50kHz, PWM2 will generate a synchronization event every 100kHz.  However, PWM3 will never finish a full period before the upstream synch event occurs which will force it back to a certain value.  Because of this, PWM2 and PWM3 will effectively be 100kHz signals.  Note that this really isn't an issue as long as you expect it.

    In most application cases, you'd want the frequency of PWM3 to be an integer multiple of PWM2.  (as long as you understand what the module is doing, other ideas are possible though)

    Hopefully this answers your question.  Let me know if it doesn't.


    Thank you,
    Brett

  • Dear Brett

    Now I encounterd some problems in ePWM module. I want to start multiple ePWM (like ePWM1,ePWM2,ePWM3,....) channels at  absolutely the same time, and they end them at the absolutely same time, furthermore different ePWM can have different frequency. How can I achieve it? 

    Really need your help!

    Best Regards!

  • Dear Zeng,

     

    Case-1. starting Multiple PWM  at ABSOLUTELY same time, and they end them at absolutely same time:

                  Do you have any constraint of Phase synchronization?

                  If YES, then It is not at all possible.

                  If NO, then Case-1 is 100% possible.

    Case-2. different ePWM can have different frequency:

                   Disable phase Synchronization  bit (SYNCOSEL) in TBCTL register for all the PWM -> configure frequency in individual register through TBPRD register->clear counter.

    Hope this should work.

    Best Regards,

    Prem

     

  • Dear Prem

        Thank you for your reply!

    Case-1

        The answer is NO. Please tell some details for starting Multiple PWM  at ABSOLUTELY same time, and then end them at absolutely same time.

        Thanks for your concern again!

        Best Regards!

       Zeng

  • Dear Zeng,

    Apologies...this I do needs to test in hardware. need some time. probly my answer in this regard might be wrong.

    Case-1:

    Can you please try this setting:

    1. To synchronization; Keep Phase register enable. Do this setting

    EPwm1Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO; // synchronize at TBCTR = 0

    EPwm2Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_IN;// follow Previous PWM

    EPwm3Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_IN;

    EPwm4Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_IN;

    EPwm5Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_IN;

    EPwm6Regs.TBCTL.bit.SYNCOSEL  = TB_SYNC_IN;

    2. Keep TBPHS = 0; for all the PWMs since as of now phase shift is Zero among PWMs

    3. Can you please try to configure different PWMs at different frequency....if they get configured then we can get  answer (YES/NO).

    Can you please help me to reply the result in case if u test it on hardware... :)

     

    Best Regards,

    Prem

  • Dear Prem,

    Your answer have enlightened me, thank you!

    I have achieve diffrent chanels of ePWM started at the same time, and they can have different frequency.When the required numbers of pulse obtained, I stop these chanels of ePWM at the same time.

    My setting:

    EPwm1Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_IN; // synchronize when external signal come in

    EPwm2Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_IN;// follow Previous PWM

    EPwm3Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_IN;

    EPwm4Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_IN;

    EPwm5Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_IN;

    EPwm6Regs.TBCTL.bit.SYNCOSEL  = TB_SYNC_IN;

    //to start them

    EALLOW;
    SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1;
    EDIS;

    //to stop them

    EALLOW;
    SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0;
    EDIS;

    and they have different frequency. Since the phase  synchronization is not the focus, I just want diffrent ePWM start at the same time and stop at the same time, so I will never give a external singnal to force the phase synchronization. 

    I have test my configuration on the hardware and use the oscilloscope watch the ePWMs, the result is acceptable(several numbers of PWM pulses error).

    If you have any confusion due to my bad explaination, just tell me.

    Best Regards,

    ZENG

  • Hi, 

    I have EPWM1 as master and other EPWMs are sychronized to it. EPWM1 is the reference and other EPWM channels are phase shifted from it.

    I want to update the TBPHS register for the SYNC-IN EPWM channels from an interrupt routine.

    The interrupt routine is called twice in a PWM cycle, at CTR_ZERO and at CTR_PRD using a UPDOWN_COUNTER. But the TBPHS register is getting updated only once at CTR_ZERO.

    I need to update TBPHS twice in a cycle.

    Can anybody help on this?

    Thanks

    Ritwik

  • Prem,

    Have you looked at figure 9 in the ePWM Reference Guide? This describes the sync chain.

    How have you configured PHSEN for all PWMs? This will determine how the syncpulses propagate through the system.

    It should be possible to sync ePWM2/3/5 to ePWM1, but I don't think you could sync ePWM5 to ePWM2 directly.

    Regards,

    Cody

  • Hi Prem/brett/TI experts,

    My requirement is also exactly same as described in Case 2 .
    In my case , the PWM channels are as follows:-

    ePWM 4 must be Master whose frequency is 25 kHz.
    ePWM 1 must be Slave whose frequency is 50 kHz.

    It is required to adjust the phase shift of ePWM1 with respect to ePWM 4.
    How to get different frequencies for ePWM 4 as master & ePWM 1 as slave (whose phase should be adjusted with respect to ePWM4)?

    Also,pls read the following thread which i already posted

    e2e.ti.com/.../2299160

    By making ePWM6 as slave will solve the problem.
    But,my hardware has some limitation as i cannot use ePWM 6 or ePWM 5 as slave instead of ePWM 1 .

    Kindly suggest how to synchronize ePWM 1 with 50 kHz(phase shifted) & ePWM 4 with 25 kHz.

    regards,

    Ramesh P
  • Hi Ramesh,

    We'll continue discussion of your situation in your thread:
    https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/623241


    Thank you,
    Brett