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.

TMS320F28377S: Phase differences problem between ePWM1A and ePWM1B

Part Number: TMS320F28377S


Hi Evereybody,

i try to use ePWM1A and ePWM1B output. when i use them constatly ,there is not any problem.

BUT when i active or passive them there is a problem. i try to explain with picture.

my frequency is 16kHz for ePWM1A and ePWM1B. but i can not use them with together. just one of them can have output.

At t1 : while ePWM1A is cleared ,ePWM1B is set.

At t2: while ePWM1B is cleared ,ePWM1A is set.BUT as you see on picture 1 and 2 are not equal eachother. 2 is just half period, but 1 is one and hald peiod...

and this a problem on my application and i can not understand? why this is happening?

in program i am doing in same place set and clear...

my PWM init code:

    EPwm1Regs.TBPRD = Period;
    EPwm1Regs.CMPA.bit.CMPA= 100;
    EPwm1Regs.CMPB.bit.CMPB = Period-100;
    EPwm1Regs.TBPHS.bit.TBPHS = 0;
    EPwm1Regs.TBCTR = 0x0000;
    EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN;
    EPwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE;
    EPwm1Regs.TBCTL.bit.PRDLD = TB_SHADOW;
    EPwm1Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO;//  Master EPWM1A
    EPwm1Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1;
    EPwm1Regs.TBCTL.bit.CLKDIV = TB_DIV1;
    EPwm1Regs.CMPCTL.bit.SHDWAMODE = CC_IMMEDIATE;
    EPwm1Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
    EPwm1Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO_PRD;
    EPwm1Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO_PRD;

    EPwm1Regs.AQCTLA.bit.CAU = AQ_SET;
    EPwm1Regs.AQCTLA.bit.CAD = AQ_CLEAR;

    EPwm1Regs.AQCTLB.bit.CBU = AQ_CLEAR;
    EPwm1Regs.AQCTLB.bit.CBD = AQ_SET;

  • Hi,

    I believe this is happening because of the configuration you have.
    You are using up-down count mode, but setting PWMs differently.

    EPwm1Regs.AQCTLA.bit.CAU = AQ_SET;
    EPwm1Regs.AQCTLA.bit.CAD = AQ_CLEAR;
    EPwm1Regs.AQCTLB.bit.CBU = AQ_CLEAR;
    EPwm1Regs.AQCTLB.bit.CBD = AQ_SET;

    And when you switch between turning on/off PWMA and PWMB - this could be different time instances w.r.t. the time base of the PWM.
    So, depending on when you make the switch between turning on/off PWMA and PWMB - wave form could very well look like above.
    If you want same t1/t2 you could try using same configuration for  PWMA and PWMB as below.
    EPwm1Regs.AQCTLB.bit.CBU = AQ_SET ;
    EPwm1Regs.AQCTLB.bit.CBD = AQ_CLEAR;

  • Hi,

    thank you for your valuable words.

    may be you are right but i can not change settings. because i need 180 degree phase difference betwwen 1A and 1B , with this settings, there is 180 degree.

    if i change settings w.r.t. yours settings, there will not be phase diff between 1A and 1B.

  • Hi,

    As I see from the waveform, you've only one PWM ON at a given time - either PWMA or PWMB.
    So, what is the phase difference you are mentioning above, if there is only 1 PWM ON at a time?
    For the configuration you've above, the difference in t1 and t2 is expected behavior. 

  • Hi,

    yes you are right. in my application some time just EPWM1A ON (at that time EPWM1B OFF),some time just EPWM1B ON (at that time EPWM1A OFF),and some time both of EPWM 1A and EPWM 1B ON ( allways with phase diff.)

  • Hi,

    Thanks for confirming. As this is the expected behavior - i'll go ahead and mark it as resolved, please close the ticket.