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.

LAUNCHXL-F280049C: EPWM not triping when configured to trip from CMPSS

Part Number: LAUNCHXL-F280049C
Other Parts Discussed in Thread: C2000WARE

Hello,

For my project I want to use the CMPSS to trip the PWM (shutdown the pwms) when there is an over current inthe circuit. But after the configuration and running the code; the PWM does not trip when there is an over current.  I actually verified that the code is running and registers changing as expected.

The cmpss actually gets the signal and the EPWM7 also reacts to this as the TZFLG-> DCBEVT1/DCAEVT1 are both set. But Neither the pwm shutsdown nor is the interrupt called.

Sections of my code the the DC configuration is below

/**< Setup the Output X-BAR to output CTRIP on OUTPUTXBAR! */
XBAR_setEPWMMuxConfig(XBAR_TRIP7, XBAR_EPWM_MUX06_CMPSS4_CTRIPH);
XBAR_enableEPWMMux(XBAR_TRIP7, XBAR_MUX06);

//Interrupt configuration
Interrupt_register(INT_EPWM7_TZ, &epwm::EPWM7ISRDC2ACDCTZ);

/**< Configure DCAH and DCBH to use trip7 */

EPWM_selectDigitalCompareTripInput(EPWM7_BASE, EPWM_DC_TRIP_TRIPIN7, EPWM_DC_TYPE_DCAH);
EPWM_selectDigitalCompareTripInput(EPWM7_BASE, EPWM_DC_TRIP_TRIPIN7, EPWM_DC_TYPE_DCBH);

/**< configure trip zone action for DCAEVT1 and DCBEVT1, trigger when it is high */
EPWM_setTripZoneDigitalCompareEventCondition (EPWM7_BASE, EPWM_TZ_DC_OUTPUT_A1, EPWM_TZ_EVENT_DCXH_HIGH);
EPWM_setTripZoneDigitalCompareEventCondition (EPWM7_BASE, EPWM_TZ_DC_OUTPUT_B1, EPWM_TZ_EVENT_DCXH_HIGH);

/**< enable trip zone signal for DCAEVT1 and DCBEVT1 and for one short tripping */
EPWM_setTripZoneAction(EPWM7_BASE, EPWM_TZ_ACTION_EVENT_TZA, EPWM_TZ_ACTION_LOW); //TODO verify
EPWM_setTripZoneAction(EPWM7_BASE, EPWM_TZ_ACTION_EVENT_TZB, EPWM_TZ_ACTION_LOW); //TODO verify
EPWM_enableTripZoneSignals(EPWM7_BASE, (EPWM_TZ_SIGNAL_DCAEVT1 | EPWM_TZ_SIGNAL_DCBEVT1));

/**< configure for unfiltered and asynchronous operation */ //TODO verify unfiltered
// EPWM_setDigitalCompareEventSource(EPWM7_BASE, EPWM_DC_MODULE_A, EPWM_DC_EVENT_1, EPWM_DC_EVENT_SOURCE_ORIG_SIGNAL);
// EPWM_setDigitalCompareEventSyncMode(EPWM7_BASE, EPWM_DC_MODULE_B, EPWM_DC_EVENT_1, EPWM_DC_EVENT_INPUT_NOT_SYNCED);

//EPWM_enableTripZoneInterrupt(EPWM7_BASE, EPWM_TZ_INTERRUPT_DCAEVT1);



Interrupt_enable(INT_EPWM7_TZ);

EPWM_clearTripZoneFlag(EPWM7_BASE, (EPWM_TZ_INTERRUPT | EPWM_TZ_FLAG_DCAEVT1 | EPWM_TZ_FLAG_DCBEVT1 | EPWM_TZ_FLAG_OST));

The code below sends the device into interrupt trap. I find this strange. Should this be so?
EPWM_enableTripZoneInterrupt(EPWM7_BASE, EPWM_TZ_INTERRUPT_DCAEVT1);

What am i missing or what am I doing wrongly.

Thanks

                

  • Hi Abayomi,

    Have you already referenced our C2000Ware examples? There are DriverLib examples that show proper set up for interrupts and the digital compare module (examples located at {C2000Ware}\driverlib\f28004x\examples\epwm and specifically the epwm_ex4_digital_compare example - it doesn't utilize CMPSS but the principle is similarly implemented using INPUTXBAR). Please take a look at this example as a reference (you could start with the example and modify it to fit your need or compare the configurations to yours) and let me know if it helps!

    Best Regards,

    Allison

  • Hello Allison,

    Thanks for your reply.

    I have checked the example and followed all the steps but the EPWM7 still does not shutdown nor the interrupt called.

    A snapshot of the Register isn enclosed

    The TZFLG bits are set to 1 but the pwm does not trip.  Pls what am I missing or wrongly configuring.

    The entire code for the initialisation of the PWM7&8 is below in the zip file.

    pwm_7_8.rar

    Some other initialization are done in an earlier function call.  This codes are below

    //setup of PWM for inverter DC2AC
    //EPWM7
    SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_EPWM7);
    SysCtl_resetPeripheral(SYSCTL_PERIPH_RES_EPWM7); /**< reset peripheral before initialization */
    Interrupt_register(INT_EPWM7, &epwm::EPWM7ISRDC2AC);
    Interrupt_register(INT_EPWM7_TZ, &epwm::EPWM7ISRDC2ACDCTZ);

    //EPWM8
    SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_EPWM8);
    SysCtl_resetPeripheral(SYSCTL_PERIPH_RES_EPWM8); /**< reset peripheral before initialization */
    Interrupt_register(INT_EPWM8, &epwm::EPWM8ISRDC2AC);

    /**< disable sync and clock to PWM */
    SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);

    Can you reveiw my code for me if there is an ommission or an error in it.

    Thanks.

  • Hi Abayomi,

    At first glance I see that your TZA and TZB of TZCTL register are both set to '11'. This means that EPWM channel A and EPWM channel be will take no action on a trip. TZA configures what trip action will happen on Channel A and TZB configures what trip action will happen on Channel B:

    This is likely why the flag is getting set but nothing is happening - there is no action set up to occur on the channels in response to the trip source. Please configure these to your desired action ('10' will trip the designated PWM channel low).

    For the interrupts, I see the TZEINT register is all 0's right now. If you want to trigger an interrupt based on the event, you need to enable it accordingly.

    You can also check through this by referencing the register descriptions on the TRM located at the end of the EPWM chapter to be sure the TZ registers are set up the way you are targeting. Detailed descriptions of generating Trip Zone interrupts is also in the TRM (18.9.3 Generating Trip Event Interrupts).

    Let me know when you are able to implement the changes above and if this changes the behavior you see.

    Best Regards,

    Allison

  • Hi Alison,

    Thanks for your reply.

    I have solved it using the recommendations in the chat and exactly following the example.

    Thanks