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/F28M36P63C2: EPWM outputs issue

Part Number: F28M36P63C2

Tool/software: Code Composer Studio

Hello,

I have been using the concerto family device F28M36P63C2 to design a switch mode power supply battery charger. i have been trying to set up the pwm waveform output. I am using the EPWM submodules 1 and 2 achieve this.

This is how i configure the action events for the the 2 PWM modules. The counter is in updown mode.

    // Action Qualifier SubModule Registers for EPWM1


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

    EPwm1Regs.AQCTLB.bit.CAD = AQ_NO_ACTION;
    EPwm1Regs.AQCTLB.bit.ZRO = AQ_NO_ACTION;
    EPwm1Regs.AQCTLB.bit.CAU = AQ_NO_ACTION;

// Action Qualifier SubModule Registers for EPWM2

    EPwm2Regs.AQCTLA.bit.CAD = AQ_NO_ACTION;
    EPwm2Regs.AQCTLA.bit.ZRO = AQ_NO_ACTION;
    EPwm2Regs.AQCTLA.bit.CAU = AQ_NO_ACTION;

    EPwm2 Regs.AQCTLB.bit.CAD = AQ_SET;
    EPwm2Regs.AQCTLB.bit.ZRO = AQ_NO_ACTION;
    EPwm2Regs.AQCTLB.bit.CAU = AQ_CLEAR;

I do this because i want to see PWM outputs for EPWM1A and EPWM2B , but i don't want to see anything in EPWM1B and EPWM2A. But for some reason when i look at the scope outputs for the PWM's, they are showing me unexpected results. Please take a look at the attached pictures.

EPWM 1A

 

EPWM 1B

EPWM 2A

 


 

EPWM 2B

 

 

Any suggestion or help is greatly appreciated. Thank you for your time,

Srini

  • Srini,

    my guess is you have reconfigured your Action Qualifier, Additionally you may have configured ePWM1 to output a complementary waveform on ePWM1b.

    Why did you select ePWM1B on the output mux if you didnt want to output the signal? You could have left it as a 'GPIO'.

    Finally check the GPIO configuration for ePWM2 A and B, have you provided access to the c28x? have you chosen the correct mux position?

    Thanks,
    Cody 

  • Hey cody,

    I haven't configured the waveforms to be complementary to each other. I have the polsel bit set to 0.

    And i have selected to output mux the epwm 1B because i will need it for another event.

    What i am trying to accomplish is

    void EventFunc(void)
    {
    if(Event==0)
    {
    InitEPwm1Example(); //This function sets identical output to EPWM 1A and EPWM 2B while disabling EPWM 1B and EPWM 2A

    Event+=1;
    EventChecker=100; // for debug purposes

    //delay
    for(delay = 0; delay < 2000000; delay++)
    {
    }
    for(delay = 0; delay < 2000000; delay++)
    {
    }
    }
    else
    {
    InitEPwm2Example(); //This function sets identical output to EPWM 1B and EPWM 2A while disabling EPWM 1A and EPWM 2B

    Event-=1;
    EventChecker=99; // for debug purposes

    //delay
    for(delay = 0; delay < 2000000; delay++)
    {
    }
    for(delay = 0; delay < 2000000; delay++)
    {
    }
    }
    }

    Thanks,
    Srini
  • Hey cody,

    This is my revised code to:

    Disable EPWM 1B and Enable EPWM 1A output.

    Am i doing something wrong here in your opinion???

    EPwm1Regs.TBCTL.bit.PRDLD = TB_SHADOW;
    EPwm1Regs.TBPRD = TPWM1-1;          // 150MHz/ISR_FREQ/24-1
    EPwm1Regs.TBPHS.half.TBPHS = 0x0000; // Phase is 0
    EPwm1Regs.TBCTR = 0x0000; // Clear counter

    // Setup TBCLK
    EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Count updown
    EPwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE; // Disable phase loading
    EPwm1Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO; //sync down stream modules

    //prescale
    EPwm1Regs.TBCTL.bit.HSPCLKDIV = 0x3;
    EPwm1Regs.TBCTL.bit.CLKDIV = TB_DIV2;

    EPwm1Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW; // Load registers every ZERO
    EPwm1Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
    EPwm1Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO;
    EPwm1Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO;

    // Counter Compare Submodule Registers
    EPwm1Regs.CMPA.half.CMPA = 0; // set duty 0% initially
    EPwm1Regs.CMPB = 0; // set duty 0% initially
    EPwm1Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;
    EPwm1Regs.CMPCTL.bit.LOADAMODE = CC_CTR_PRD;


    // Action Qualifier SubModule Registers
    EPwm1Regs.AQCTLA.bit.CAD = AQ_SET;
    EPwm1Regs.AQCTLA.bit.ZRO = AQ_NO_ACTION;
    EPwm1Regs.AQCTLA.bit.CAU = AQ_CLEAR;

    EPwm1Regs.AQCTLB.bit.CBD = AQ_CLEAR;
    EPwm1Regs.AQCTLB.bit.ZRO = AQ_NO_ACTION;
    EPwm1Regs.AQCTLB.bit.CBU = AQ_CLEAR;

    //EPwm1Regs.AQCSFRC.bit.CSFB = 1; // I tried this line as well to disable output on EPWM 1B. But to no avail.

    /* Set Dead Band*/
    EPwm1Regs.DBCTL.bit.OUT_MODE = DB_FULL_ENABLE;
    EPwm1Regs.DBCTL.bit.POLSEL = DB_ACTV_HI ; //Neither A or B is inverted, Active high mode.
    EPwm1Regs.DBCTL.bit.IN_MODE = DBA_ALL;

    // Define an event (OST) based on TZ1 and (CBC) based on TZ2
    EALLOW;
    EPwm1Regs.TZSEL.bit.OSHT1 = TZ_ENABLE; //Enable TZ1 as a one-shot trip source
    EPwm1Regs.TZSEL.bit.CBC2 = TZ_ENABLE; //Enable TZ2 as a CBC trip source
    EPwm1Regs.TZCTL.bit.TZA = TZ_FORCE_LO;
    EPwm1Regs.TZCTL.bit.TZB = TZ_FORCE_LO;
    EDIS;




    I have similar configuration functions to
    1) Enable 1B and Disable 1A
    2) Enable 2A and Disable 2B
    3) Enable 2B and Disable 2A


    And i call the above functions in one function called EventFunc(). This EventFunc() function is placed in an infinite loop in the main function of my project.


    Below is my revised Event function,

    void EventFunc(void)
    {
    if(Event==0)
    {
    InitEPwm1AExample(); //ENABLES 1A and DISABLES 1B
    InitEPwm2BExample(); //ENABLES 2B and DISABLES 2A

    Event+=1; // A toggle variable that runs the events one after the other
    EventChecker=100; // Debug watch window variable

    //delay to give time to observe the scope outputs clearly
    for(delay = 0; delay < 2000000; delay++)
    {
    }
    for(delay = 0; delay < 2000000; delay++)
    {
    }
    }
    else
    {
    InitEPwm1BExample(); //ENABLES 1B and DISABLES 1A
    InitEPwm2AExample(); //ENABLES 2A and DISABLES 2B

    Event-=1; // A toggle variable that runs the events one after the other
    EventChecker=99; // Debug watch window variable


    //delay to give time to observe the scope outputs clearly
    for(delay = 0; delay < 2000000; delay++)
    {
    }
    for(delay = 0; delay < 2000000; delay++)
    {
    }
    }
    }


    As always any suggestion or advice is welcome and appreciated. Thank you for your time

    Srini