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.

TMS320F280039C: Unable to trip to low both ePWMA and ePWMB when worging with CMPSS and DC submodules for one-shot event

Part Number: TMS320F280039C

Hi there,

I'm trying to get the ePWM1 outputs A and B to go to low state when a digital compare event is triggered as a one-shot event. I'm configuring the following submodules: CMPSS, XBAR, DC, TZ.

I can see that the CMPSS event does happen from both the status bits (Cmpss4Regs.COMPSTS.COMPLSTS) and the X-Bar (XbarRegs.XBARFLG1.CMPSS4_CTRIPL). Also, the trip does happen and the PWM A and B outputs do stop switching at the desired threshold values, however, they do not both transition to low state. They have somewhat of a random behaviour: in some cases one goes high and the other low and vice versa, sometimes they do transition both low. Every time I reset and restart the micro to try again. Strangely to me, when I do a software forced event, they do trigger both to low.

The CMPSS and ePWM config is below.

I'd appreciate some help.

Thanks,

Lucas

CMPSS_enableModule(SETS_OC_CMPSS_BASE);
ASysCtl_selectCMPLPMux(ASYSCTL_CMPLPMUX_SELECT_4, 1);
CMPSS_configDAC(SETS_OC_CMPSS_BASE, CMPSS_DACVAL_SYSCLK | CMPSS_DACREF_VDDA);
CMPSS_setDACValueLow(SETS_OC_CMPSS_BASE, SETS_USER_DEFAULT_TRIP_A);
CMPSS_configLowComparator(SETS_OC_CMPSS_BASE, CMPSS_INSRC_DAC);
CMPSS_configFilterLow(SETS_OC_CMPSS_BASE, 0, 24, 23);
CMPSS_initFilterLow(SETS_OC_CMPSS_BASE);
CMPSS_configOutputsLow(SETS_OC_CMPSS_BASE, CMPSS_TRIP_FILTER);
CMPSS_setHysteresis(SETS_OC_CMPSS_BASE, 2);

XBAR_setEPWMMuxConfig(XBAR_TRIP4, XBAR_EPWM_MUX07_CMPSS4_CTRIPL);
XBAR_enableEPWMMux(XBAR_TRIP4, XBAR_MUX07);

EPWM_selectDigitalCompareTripInput(SETS_DRV_EPWM_BASE, EPWM_DC_TRIP_TRIPIN4, EPWM_DC_TYPE_DCAH);
EPWM_selectDigitalCompareTripInput(SETS_DRV_EPWM_BASE, EPWM_DC_TRIP_TRIPIN4, EPWM_DC_TYPE_DCBH);
EPWM_enableTripZoneSignals(SETS_DRV_EPWM_BASE, EPWM_TZ_SIGNAL_DCAEVT1);
EPWM_enableTripZoneSignals(SETS_DRV_EPWM_BASE, EPWM_TZ_SIGNAL_DCBEVT1);
EPWM_setTripZoneDigitalCompareEventCondition(SETS_DRV_EPWM_BASE, EPWM_TZ_DC_OUTPUT_A1, EPWM_TZ_EVENT_DCXH_HIGH);
EPWM_setTripZoneDigitalCompareEventCondition(SETS_DRV_EPWM_BASE, EPWM_TZ_DC_OUTPUT_B1, EPWM_TZ_EVENT_DCXH_HIGH);
EPWM_setDigitalCompareEventSyncMode(SETS_DRV_EPWM_BASE, EPWM_DC_MODULE_A, EPWM_DC_EVENT_1, EPWM_DC_EVENT_INPUT_NOT_SYNCED);
EPWM_setDigitalCompareEventSyncMode(SETS_DRV_EPWM_BASE, EPWM_DC_MODULE_B, EPWM_DC_EVENT_1, EPWM_DC_EVENT_INPUT_NOT_SYNCED);
EPWM_setDigitalCompareEventSource(SETS_DRV_EPWM_BASE, EPWM_DC_MODULE_A, EPWM_DC_EVENT_1, EPWM_DC_EVENT_SOURCE_ORIG_SIGNAL);
EPWM_setDigitalCompareEventSource(SETS_DRV_EPWM_BASE, EPWM_DC_MODULE_B, EPWM_DC_EVENT_1, EPWM_DC_EVENT_SOURCE_ORIG_SIGNAL);
EPWM_setTripZoneAction(SETS_DRV_EPWM_BASE, EPWM_TZ_ACTION_EVENT_TZA, EPWM_TZ_ACTION_LOW);
EPWM_setTripZoneAction(SETS_DRV_EPWM_BASE, EPWM_TZ_ACTION_EVENT_TZB, EPWM_TZ_ACTION_LOW);

  • Hi,

     

    Our expert will get back ASAP.

     

    Thanks,

    Saravanan

  • Hello Lucas,

    The first thing that I would suggest when seeing odd but seemingly almost correct behavior on the ePWM when you don't have a relevant input synchronized is to test the system's behavior when it is synchronized (referring to EPWM_setDigitalCompareEventSyncMode() here). Then, for this issue in particular, I'd also test the system behavior when you control the trip zone behavior not via EPWM_TZ_ACTION_EVENT_TZx, but rather through EPWM_TZ_ACTION_EVENT_DCxEVTy, where y=1 in your case (referring to EPWM_setTripZoneAction() here). The latter of these suggestions in particular shouldn't have an effect on your system, but it's always good to lower the number of potential influencing factors as much as you can!

    Even though these steps may not solve an issue outright, they can often isolate it to be more easily identifiable and fixable moving forward.

    Regards,

    Jason Osborn

  • Hi Jason,

    Thank you for your reply and suggestions. I have followed both of them by implementing the configurations stated below.

    The ill-behaviour is still present. The PWM output A sometimes goes low and sometimes high, and the output B does the oposite, as you can see from the images below.

    Synced & Using DCxEVT1 ***********************

    EPWM_selectDigitalCompareTripInput(SETS_DRV_EPWM_BASE, EPWM_DC_TRIP_TRIPIN4, EPWM_DC_TYPE_DCAH);
    EPWM_selectDigitalCompareTripInput(SETS_DRV_EPWM_BASE, EPWM_DC_TRIP_TRIPIN4, EPWM_DC_TYPE_DCBH);
    EPWM_enableTripZoneSignals(SETS_DRV_EPWM_BASE, EPWM_TZ_SIGNAL_DCAEVT1);
    EPWM_enableTripZoneSignals(SETS_DRV_EPWM_BASE, EPWM_TZ_SIGNAL_DCBEVT1);
    EPWM_setTripZoneDigitalCompareEventCondition(SETS_DRV_EPWM_BASE, EPWM_TZ_DC_OUTPUT_A1, EPWM_TZ_EVENT_DCXH_HIGH);
    EPWM_setTripZoneDigitalCompareEventCondition(SETS_DRV_EPWM_BASE, EPWM_TZ_DC_OUTPUT_B1, EPWM_TZ_EVENT_DCXH_HIGH);
    EPWM_setDigitalCompareEventSyncMode(SETS_DRV_EPWM_BASE, EPWM_DC_MODULE_A, EPWM_DC_EVENT_1, EPWM_DC_EVENT_INPUT_SYNCED);
    EPWM_setDigitalCompareEventSyncMode(SETS_DRV_EPWM_BASE, EPWM_DC_MODULE_B, EPWM_DC_EVENT_1, EPWM_DC_EVENT_INPUT_SYNCED);
    EPWM_setDigitalCompareEventSource(SETS_DRV_EPWM_BASE, EPWM_DC_MODULE_A, EPWM_DC_EVENT_1, EPWM_DC_EVENT_SOURCE_ORIG_SIGNAL);
    EPWM_setDigitalCompareEventSource(SETS_DRV_EPWM_BASE, EPWM_DC_MODULE_B, EPWM_DC_EVENT_1, EPWM_DC_EVENT_SOURCE_ORIG_SIGNAL);
    EPWM_setTripZoneAction(SETS_DRV_EPWM_BASE, EPWM_TZ_ACTION_EVENT_DCAEVT1, EPWM_TZ_ACTION_LOW);
    EPWM_setTripZoneAction(SETS_DRV_EPWM_BASE, EPWM_TZ_ACTION_EVENT_DCBEVT1, EPWM_TZ_ACTION_LOW);

    Synced ***********************

    EPWM_selectDigitalCompareTripInput(SETS_DRV_EPWM_BASE, EPWM_DC_TRIP_TRIPIN4, EPWM_DC_TYPE_DCAH);
    EPWM_selectDigitalCompareTripInput(SETS_DRV_EPWM_BASE, EPWM_DC_TRIP_TRIPIN4, EPWM_DC_TYPE_DCBH);
    EPWM_enableTripZoneSignals(SETS_DRV_EPWM_BASE, EPWM_TZ_SIGNAL_DCAEVT1);
    EPWM_enableTripZoneSignals(SETS_DRV_EPWM_BASE, EPWM_TZ_SIGNAL_DCBEVT1);
    EPWM_setTripZoneDigitalCompareEventCondition(SETS_DRV_EPWM_BASE, EPWM_TZ_DC_OUTPUT_A1, EPWM_TZ_EVENT_DCXH_HIGH);
    EPWM_setTripZoneDigitalCompareEventCondition(SETS_DRV_EPWM_BASE, EPWM_TZ_DC_OUTPUT_B1, EPWM_TZ_EVENT_DCXH_HIGH);
    EPWM_setDigitalCompareEventSyncMode(SETS_DRV_EPWM_BASE, EPWM_DC_MODULE_A, EPWM_DC_EVENT_1, EPWM_DC_EVENT_INPUT_SYNCED);
    EPWM_setDigitalCompareEventSyncMode(SETS_DRV_EPWM_BASE, EPWM_DC_MODULE_B, EPWM_DC_EVENT_1, EPWM_DC_EVENT_INPUT_SYNCED);
    EPWM_setDigitalCompareEventSource(SETS_DRV_EPWM_BASE, EPWM_DC_MODULE_A, EPWM_DC_EVENT_1, EPWM_DC_EVENT_SOURCE_ORIG_SIGNAL);
    EPWM_setDigitalCompareEventSource(SETS_DRV_EPWM_BASE, EPWM_DC_MODULE_B, EPWM_DC_EVENT_1, EPWM_DC_EVENT_SOURCE_ORIG_SIGNAL);
    EPWM_setTripZoneAction(SETS_DRV_EPWM_BASE, EPWM_TZ_ACTION_EVENT_TZA, EPWM_TZ_ACTION_LOW);
    EPWM_setTripZoneAction(SETS_DRV_EPWM_BASE, EPWM_TZ_ACTION_EVENT_TZB, EPWM_TZ_ACTION_LOW);

    Scope captures *******************

  • Hello Lucas,

    I am presently looking into this and will get back to you by end of day Nov 3rd, CST.

    Regards,

    Jason Osborn

  • Hi Jason,

    I finally resolved this issue. The problem was that another section of my code was enabling the advanced trip zone event action at EPWM_TZCTL2_ETZE from register EPWM_O_TZCTL2 (PWM_enableTripZoneAdvAction(SETS_DRV_EPWM1_BASE)).

    Thanks for your help anyway.

    L.

  • Lucas,

    Ah! Thanks for letting me know that the problem was resolved. I'd been going through what I could of the setup this morning trying to replicate the behavior, and was actually going to type up a reply explaining that I had been unable to and asking for more details on your ePWM registers very shortly. Again, very glad you were able to solve the problem!

    Regards,

    Jason Osborn