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.

TMS320F28069: EPWM miss cycle while TBPHS change

Part Number: TMS320F28069


Hi

My application needs to gradually drop TBPHS to 0 to turn off the full bridge , topology like this post
But there is a missing waveform in the process of decreases TBPHS(EPWM1 lead,EPWM2 follow, missing wave in EPWM2 )
After reading some post , still can't solve the problem

The settings of the EPWM module are as follows (up-down mode)

void ConfigPWM(){

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

    EPwm1Regs.TBPRD = FreqCounterTop;
    EPwm1Regs.TBPHS.half.TBPHS =0;    //TimeBase Phase Register 0 for now
    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; 
    EPwm1Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;
    EPwm1Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
    EPwm1Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO;
    EPwm1Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO;
    EPwm1Regs.AQCTLA.bit.CAU =AQ_SET;
    EPwm1Regs.AQCTLA.bit.CAD =AQ_CLEAR;
    EPwm1Regs.DBCTL.bit.OUT_MODE=DB_FULL_ENABLE;
    EPwm1Regs.DBCTL.bit.POLSEL=DB_ACTV_HIC;
    EPwm1Regs.DBFED=50; //counter: 1/45M*50~=1.11uS
    EPwm1Regs.DBRED=50;
    EPwm1Regs.CMPA.half.CMPA = FreqCounterTop/2;

    EPwm2Regs.TBPRD = FreqCounterTop;
    EPwm2Regs.TBPHS.half.TBPHS =0;    //TimeBase Phase Register 0 for now
    EPwm2Regs.TBCTL.bit.CTRMODE =TB_COUNT_UPDOWN;    
    EPwm2Regs.TBCTL.bit.PHSEN = TB_ENABLE; 
    EPwm2Regs.TBCTL.bit.PRDLD = TB_SHADOW;
    EPwm2Regs.TBCTL.bit.SYNCOSEL =TB_SYNC_IN; 
    EPwm2Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;
    EPwm2Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
    EPwm2Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO;
    EPwm2Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO;
    EPwm2Regs.AQCTLA.bit.CAU =AQ_SET;
    EPwm2Regs.AQCTLA.bit.CAD =AQ_CLEAR;
    EPwm2Regs.DBCTL.bit.OUT_MODE=DB_FULL_ENABLE;
    EPwm2Regs.DBCTL.bit.POLSEL=DB_ACTV_HIC;
    EPwm2Regs.DBFED=50;
    EPwm2Regs.DBRED=50;
    EPwm2Regs.CMPA.half.CMPA = FreqCounterTop/2;

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

Reduce TBPHS in interrupt routine

OutputAmpCounter-=ChargeInter;
EPwm2Regs.TBPHS.half.TBPHS = OutputAmpCounter;

Frequency Setting

EPwm1Regs.TBPRD =FreqCounterTop;
EPwm2Regs.TBPRD =EPwm1Regs.TBPRD;
EPwm1Regs.CMPA.half.CMPA = EPwm1Regs.TBPRD/2;
EPwm2Regs.CMPA.half.CMPA = EPwm1Regs.CMPA.half.CMPA;

Are there any further suggestions to fix this or is there something wrong with the settings?

  • Hi,

    Looks like you are missing down else. You may need to handle it in your code for this kind of situation. CMP value should be less than TMPHS.

    Thanks & Regards,

    Santosh

  • Hi

    Thanks for your reply


    After some testing
    Increasing the frequency (decreases CMP) while decreases TBPHS does change the timing of missing wave


    For example, I previously used 40ms to decreases TBPHS(phase difference) from 175 degrees to 0 degrees . The error will occur at 20ms (about 90 degrees of phase difference, which is close to the CMP setting)

    But the missing wave occurs at 30ms when I test increasing the frequency while decreasing the TBPHS

    It looks like the error only occurs when the TBPHS "goes through" the CMP?

  • PoWei,

    I think you will need to keep CMP < TBPHS for that situation in this situation.

    Thanks & Regards,

    Santosh