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.

MCU-PLUS-SDK-AM263X: how to activate 3 trip zones symultaneously

Part Number: MCU-PLUS-SDK-AM263X
Other Parts Discussed in Thread: AM2632

I successfully configured 3 pwm modules for space vector modulation needed for motor control.

In case of protection triggering I activate the trip zone with this commands:

EPWM_forceTripZoneEvent(&hepwm0, EPWM_TZ_FORCE_EVENT_OST);

EPWM_forceTripZoneEvent(&hepwm2, EPWM_TZ_FORCE_EVENT_OST);

EPWM_forceTripZoneEvent(&hepwm11, EPWM_TZ_FORCE_EVENT_OST);

In previous projects with TMS320F18335 I was able to use only 1 command to activate all trip zones simultaneously.

Please, can you provide an example of triggering multiple trip zones symulaneously with access to only 1 uC register? 

  • Hi,

    I'm looking into this and will get back with you shortly.

    Regards,
    Frank

  • Hi,

    Could you tell me if you are using ADC sensed signals or any external signal to activate the EPWM trip?

    Usually the trip zone for every EPWM is configured in its Trip Zone subsection of the syscfg.

    Like this, you need to configure your one shot trip source for every EPWM instance.

    The DCAEVT1 and DCBEVT1 is configured in the Digital Compare subsection of the EPWM.

    For more information, you can refer the below example:

    https://software-dl.ti.com/mcu-plus-sdk/esd/AM263X/latest/exports/docs/api_guide_am263x/EXAMPLES_DRIVERS_EPWM_TRIP_ZONE.html

    The above example trips using external GPIO trigger.

    Another example using ADC sensing -> CMPSS Trip:

    https://software-dl.ti.com/mcu-plus-sdk/esd/AM263X/latest/exports/docs/api_guide_am263x/EXAMPLES_DRIVERS_CMPSS_ASYNCHRONOUS_TRIP.html

    Let me know if this is what you are looking for.

    Regards

    Sri Vidya

  • Hi,

    I don't want to use a GPIO to generate the "TRIP ZONE ONE SHOT INTERRUPT" as in example https://software-dl.ti.com/mcu-plus-sdk/esd/AM263X/latest/exports/docs/api_guide_am263x/EXAMPLES_DRIVERS_EPWM_TRIP_ZONE.html .

    I need to activate simultaneously the 3 EPWM trips by software. 

    Is it possible to generate the 3 interrupts by software at the same time for the 3 EPWM that we use to impement the space vector modulation?

    Best Regards.

    GS

  • Hi,

    Yes you can generate 3 different interrupts. After you configure your required One shot Trip Zone event, or Digital Compare event (highlighted below)

    The below is how you can configure Digital Compare events for Trip

    The below is how you can configure one shot Trip Source

    Then You can choose your interrupt source depending on the event you want to raise the interrupt for.

    This interrupt needs to be configured in the INT XBAR

     0

    All these configurations need to be made individually for all the 3 EPWMs.

    After the interrupts are configured, these interrupts needs to be constructed in the code to which you can add your ISR routine.

    int32_t  status;
        HwiP_Params  hwiPrms;
    
        /* Register & enable interrupt */
        HwiP_Params_init(&hwiPrms);
        hwiPrms.intNum      = CSLR_R5FSS0_CORE0_CONTROLSS_INTRXBAR0_OUT_0;
        hwiPrms.callback    = &epwm0ISR;
        hwiPrms.isPulse     = APP_INT_IS_PULSE;
        status              = HwiP_construct(&gEpwmHwiObject, &hwiPrms);
        EPWM_clearEventTriggerInterruptFlag(CSL_CONTROLSS_G0_EPWM0_U_BASE);

    You can refer to examples for detailed implementation, but you will have to combine two or more examples to come up with this system -

    1. Initially for Configuring the Trip Signal - ADC to EPWM Trip through CMPSS - https://software-dl.ti.com/mcu-plus-sdk/esd/AM263X/latest/exports/docs/api_guide_am263x/EXAMPLES_DRIVERS_CMPSS_ASYNCHRONOUS_TRIP.html

    2. Now set up the interrupt source and then the INT XBAR as explained above

    3. Then Construct the Interrupt by adding your callback routine.

    Regards

    Sri Vidya

  • Hi,

    in example https://software-dl.ti.com/mcu-plus-sdk/esd/AM263X/latest/exports/docs/api_guide_am263x/EXAMPLES_DRIVERS_CMPSS_ASYNCHRONOUS_TRIP.html 

    pin CMPIN1P must be wired to a voltage source to trigger the interrupt.

    I don't want to use any hardware pin.

    Is it possible to trigger the  CSLR_R5FSS0_CORE0_CONTROLSS_INTRXBAR0_OUT_0 by software without wiring the CMPIN1P pin?

    Can you provide an example?

    BR

    GS

  • Hi

    Yes it is possible.

    1. You can configure the One shot event.

    2. Set Up the interrupt for this event as explained above.

    3. You can use this API - EPWM_forceTripZoneEvent to create a software trip

    //*****************************************************************************
    //
    //! Force Trip Zone events.
    //!
    //! \param base is the base address of the EPWM module.
    //! \param tzForceEvent is the forced Trip Zone event.
    //!
    //! This function forces a Trip Zone event.
    //! Valid values for tzForceEvent are:
    //!   - EPWM_TZ_FORCE_EVENT_CBC     - Force Trip Zones Cycle By Cycle event
    //!   - EPWM_TZ_FORCE_EVENT_OST     - Force Trip Zones One Shot Event
    //!   - EPWM_TZ_FORCE_EVENT_DCAEVT1 - Force Digital Compare A Event 1
    //!   - EPWM_TZ_FORCE_EVENT_DCAEVT2 - Force Digital Compare A Event 2
    //!   - EPWM_TZ_FORCE_EVENT_DCBEVT1 - Force Digital Compare B Event 1
    //!   - EPWM_TZ_FORCE_EVENT_DCBEVT2 - Force Digital Compare B Event 2
    //!
    //! \return None.
    //
    //***************************************************************************
    static inline void
    EPWM_forceTripZoneEvent(uint32_t base, uint16_t tzForceEvent)

    Regards

    Sri Vidya

  • Hi

    I succesfully managed to activate 3 trip zones with one pin following the examples.

    but the API EPWM_forceTripZoneEvent was the one that I used before (see initial request) and works only for 1 pwm.

    In fact, the first argument is the base addres of 1 pwm module, but I have 3 modules to stop. 

    I don't want to wire a pin.

    Can you provide a solution?

    Best Regards.

    GS

  • Hi

    I am sorry, I dint get your question? 

    you are able to trip the PWMs using EPWM_forceTripZoneEvent , But you have to call the API three times.

    You want to configure it in just one API call for multiple PWMs?

    static inline void
    EPWM_forceTripZoneEvent(uint32_t base, uint16_t tzForceEvent)
    {
        //
        // Check the arguments
        //
        DebugP_assert((tzForceEvent & 0xFF01U)== 0U);
    
        //
        // Force a Trip Zone event
        //
        HW_WR_REG16(base + CSL_EPWM_TZFRC,
            (HW_RD_REG16(base + CSL_EPWM_TZFRC) | tzForceEvent));
    }

    Thanks & Regards

    Sri Vidya

  • Hi,

    My code is:

    EPWM_forceTripZoneEvent(&hepwm0, EPWM_TZ_FORCE_EVENT_OST);

    EPWM_forceTripZoneEvent(&hepwm2, EPWM_TZ_FORCE_EVENT_OST);

    EPWM_forceTripZoneEvent(&hepwm11, EPWM_TZ_FORCE_EVENT_OST);

    because i have to stop immediately HEPWM0 HEPWM2 HEPWM11 .

    Each call stops one PWM forcing the trip zone.

    There will be some nanosecond delay between the 3 actions and this delay may be influenced by ISR routines that may be triggered in the middle.

    If possible, it would be preferable to stop simultaneously the HEPWM0 HEPWM2 HEPWM11 to open all switches simultaneously.

    This should be possible writing only 1 register (not 3).

    Is it possible in AM2632?

    Best Regards.

    GS

  • Hi

    Yes it should be possible using the TripZone Options. I will look into it and update soon.

  • Hi 

    1. Initialize the EPWM_enableTripZoneOutput(CONFIG_EPWM0_BASE_ADDR, EPWM_TZ_SELECT_TRIPOUT_OST). This will create a TRIPOUT signal.

    2. Configure a EPWM XBAR OUT with TRIPOUT signal as source.

    3. Use this EPWM XBAR OUT as Trip Inputs to EPWM2 and EPWM11 One shot Trip through DCAEVT1.

    4. Hence, when force trip occurs -> EPWM0 will be tripped, then TripOut Signal goes high and Trips EPWM2 and EPWM11.

    The following are the captured waveforms and there seems to be Tripped below your 1usec requirement

  • To setup PWM Xbar from the EPWM0 force TripOut:

    To setup Trip Source for EPWM2 and EPWM11 from EPWM0_TRIPOUT signal

    For Testing purpose, you can bring EPWM0_TRIPOUT signal out to an output xbar like this

    Regards

    Sri Vidya