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.

TMS320F280049: Count up_down problem with EPWMB

Part Number: TMS320F280049
Other Parts Discussed in Thread: SYSCONFIG, C2000WARE

Hello,

I have the EPWM working in up_down mode, and I do the qualifying as follows:

    // ePWMA High when TBCTR=0
    EPWM_setActionQualifierAction(EPWM_BASE[pwm], EPWM_AQ_OUTPUT_A,
     EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);

    // ePWMA Low when up count TBCTR=CMPA
    EPWM_setActionQualifierAction(EPWM_BASE[pwm], EPWM_AQ_OUTPUT_A,
     EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);

    // ePWMA High when down count TBCTR=CMPA
    EPWM_setActionQualifierAction(EPWM_BASE[pwm], EPWM_AQ_OUTPUT_A,
     EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA);

    // ePWMB Low when TBCTR=0
    EPWM_setActionQualifierAction(EPWM_BASE[pwm], EPWM_AQ_OUTPUT_B,
     EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);

    // ePWMB High when up count TBCTR=CMPA
    EPWM_setActionQualifierAction(EPWM_BASE[pwm], EPWM_AQ_OUTPUT_B,
     EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);

    // ePWMB Low when down count TBCTR=CMPA
    EPWM_setActionQualifierAction(EPWM_BASE[pwm], EPWM_AQ_OUTPUT_B,
     EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA);

So, I start with EPMW_A high, when I reach the comparator, I make it low, and then high again when crossing the comparator down. The EPWM_B works complementary.

I get the following spikes on EPWM_B, while _A keeps low (duty cyle = 0)

What can be the issue?

If I use just count_up mode, I don´t have this issue...

Thanks a lot!

Luis

  • Luis,

    I've assigned your post to the subject matter expert, but due to US Holiday, please expect our response by the end of day Monday.

    Best,
    Matthew

  • This should be due to ACTION PRIORITY. Can you check the table in the TRM for the actions with different priorities.

    Alternatively you can set all of the actions for: EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO and EPWM_AQ_OUTPUT_ON_TIMEBASE_PERIOD to be the
    DO NOTHING action option.

  • Hi Nima,

    thanks for your reply, but this does not solve the problem:

        // ePWMA High when TBCTR=0
        EPWM_setActionQualifierAction(EPWM_BASE[pwm], EPWM_AQ_OUTPUT_A,
         EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
    
        // ePWMA Low when up count TBCTR=CMPA
        EPWM_setActionQualifierAction(EPWM_BASE[pwm], EPWM_AQ_OUTPUT_A,
         EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
    
        // ePWMA High when down count TBCTR=CMPA
        EPWM_setActionQualifierAction(EPWM_BASE[pwm], EPWM_AQ_OUTPUT_A,
         EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA);
    
        // ePWMB Low when TBCTR=0
        EPWM_setActionQualifierAction(EPWM_BASE[pwm], EPWM_AQ_OUTPUT_B,
         EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
    
        // ePWMB High when up count TBCTR=CMPA
        EPWM_setActionQualifierAction(EPWM_BASE[pwm], EPWM_AQ_OUTPUT_B,
         EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
    
        // ePWMB Low when down count TBCTR=CMPA
        EPWM_setActionQualifierAction(EPWM_BASE[pwm], EPWM_AQ_OUTPUT_B,
         EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA);
    
        ///////////// check this out!!!!! if this helps!!!
        // ePWMB Low when down count TBCTR=PERIOD
        EPWM_setActionQualifierAction(EPWM_BASE[pwm], EPWM_AQ_OUTPUT_B,
          EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_PERIOD);

    I´m not sure what can it be... Even I was thinking on the Deadtime but this has higher value as specified, so it´s not.

    Thanks!

    BR,

    Luis

  • Luis, the code snippet above, you didnt try what I suggested. Can you try it?

    EPWM_AQ_OUTPUT_NO_CHANGE

    Use the item above for all NON CMPAU and CMPAD actions.

    EPWM_setActionQualifierAction(EPWM_BASE[pwm], EPWM_AQ_OUTPUT_B,
    EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_PERIOD);

  • Sorry, I missundertood.

    Do you mean like this?

        // ePWMA NO CHANGE when TBCTR=0
        EPWM_setActionQualifierAction(EPWM_BASE[pwm], EPWM_AQ_OUTPUT_A,
          EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
    
        // ePWMA Low when up count TBCTR=CMPA
        EPWM_setActionQualifierAction(EPWM_BASE[pwm], EPWM_AQ_OUTPUT_A,
         EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
    
        // ePWMA High when down count TBCTR=CMPA
        EPWM_setActionQualifierAction(EPWM_BASE[pwm], EPWM_AQ_OUTPUT_A,
         EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA);
    
        // ePWMB NO CHANGE when TBCTR=0
        EPWM_setActionQualifierAction(EPWM_BASE[pwm], EPWM_AQ_OUTPUT_B,
          EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
    
        // ePWMB High when up count TBCTR=CMPA
        EPWM_setActionQualifierAction(EPWM_BASE[pwm], EPWM_AQ_OUTPUT_B,
         EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
    
        // ePWMB Low when down count TBCTR=CMPA
        EPWM_setActionQualifierAction(EPWM_BASE[pwm], EPWM_AQ_OUTPUT_B,
         EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA);
    
        // ePWMB NO CHANGE when down count TBCTR=PERIOD
        EPWM_setActionQualifierAction(EPWM_BASE[pwm], EPWM_AQ_OUTPUT_B,
          EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_PERIOD);

    I will try it on Monday :) 

    Thanks

  • Also Luis, if you have C2000Ware 4.01, then use the SysConfig Tool!

    www.ti.com/.../spracx3.pdf

  • Sorry, but the problem persists... 

  • Can you try setting CMPB actions for OUTPUT_A to NO change and vice versa?

    Nima

  • Hello Nima,

    I was doing several tests and then I realized that the problem is when I use the HRPWM module and not with normal EPWM...

      // Calibrate MEP_ScaleFactor
      do {
          sfoStatus = SFO();
      } while(sfoStatus == SFO_INCOMPLETE);
    
      //#MEP steps per coarse step at 180ps(10n/180ps) MEP_scaleFactor=55
      HRPWM_setMEPStep(base, MEP_ScaleFactor);
    
      // HRCAL uses the EPWM1 clock
      SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_EPWM1);
    
      // Turn off high-resolution period control, as we do only duty control.
      HRPWM_disablePhaseShiftLoad(base); //--> Enable this for Phase shift load (DAB)
    
      HRPWM_setMEPControlMode(base, HRPWM_CHANNEL_A,
        HRPWM_MEP_DUTY_PERIOD_CTRL);
      // MEP control on both edges. For channel A
      HRPWM_setMEPEdgeSelect(base, HRPWM_CHANNEL_A,
        HRPWM_MEP_CTRL_RISING_AND_FALLING_EDGE);
      HRPWM_setCounterCompareShadowLoadEvent(base,
        HRPWM_CHANNEL_A, HRPWM_LOAD_ON_CNTR_ZERO_PERIOD);
    
      //Setting of comparator, phase and deadband HR-modes
      HRPWM_setCounterCompareValue(base, HRPWM_COUNTER_COMPARE_A, 0);
    
      HRPWM_enableAutoConversion(base);
    
      HRPWM_enablePeriodControl(base); //-->Enable this for Duty cycle load (Buck/AC/DC)
    
      //synchronization pulse input
      HRPWM_setSyncPulseSource(base, HRPWM_PWMSYNC_SOURCE_ZERO);

    When I initialize the HRPWM in this way, then I get that problem...

  • Are you using the SFO library?

  • You dont need:

    //#MEP steps per coarse step at 180ps(10n/180ps) MEP_scaleFactor=55
    HRPWM_setMEPStep(base, MEP_ScaleFactor);

    The following line of code needs to already be done before SFO or any other intiialization is done.

    // HRCAL uses the EPWM1 clock
    SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_EPWM1);

    When using HRPWM, you have a duty cycle limitation:

    refer to this section of the TRM.