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.

TIDM-1007: Cycle-by-cycle (CBC) protection setting and result

Part Number: TIDM-1007


Dear champs,

I am asking this for our customer.

The user is trying to set a CBC protection for PWM1/2/3/4 for AC drop testing.

The user is modifying the codes in

void setupBoardProtection(uint32_t base1, uint32_t base2, uint32_t base3,
uint32_t base4, float current_limit,
float current_max_sense)

like below:

    EPWM_enableTripZoneSignals(base1, EPWM_TZ_SIGNAL_DCAEVT2);

    EPWM_enableTripZoneSignals(base2, EPWM_TZ_SIGNAL_DCAEVT2);

    EPWM_enableTripZoneSignals(base3, EPWM_TZ_SIGNAL_DCAEVT2);

    EPWM_enableTripZoneSignals(base4, EPWM_TZ_SIGNAL_DCAEVT2);

 

    EPWM_setTripZoneAction(base1, EPWM_TZ_ACTION_EVENT_TZA,EPWM_TZ_ACTION_LOW);

    EPWM_setTripZoneAction(base1, EPWM_TZ_ACTION_EVENT_TZB,EPWM_TZ_ACTION_LOW);

    EPWM_setTripZoneAction(base2, EPWM_TZ_ACTION_EVENT_TZA,EPWM_TZ_ACTION_LOW);

    EPWM_setTripZoneAction(base2, EPWM_TZ_ACTION_EVENT_TZB,EPWM_TZ_ACTION_LOW);

   EPWM_setTripZoneAction(base3, EPWM_TZ_ACTION_EVENT_TZA,EPWM_TZ_ACTION_LOW);

    EPWM_setTripZoneAction(base3, EPWM_TZ_ACTION_EVENT_TZB,EPWM_TZ_ACTION_LOW);

    EPWM_setTripZoneAction(base4, EPWM_TZ_ACTION_EVENT_TZA,EPWM_TZ_ACTION_LOW);

    EPWM_setTripZoneAction(base4, EPWM_TZ_ACTION_EVENT_TZB,EPWM_TZ_ACTION_LOW);

 

    // Clear any spurious trip

 

    EPWM_clearTripZoneFlag(base1,

                           (EPWM_TZ_INTERRUPT_OST|EPWM_TZ_INTERRUPT_DCAEVT2));

    EPWM_clearTripZoneFlag(base2,

                           (EPWM_TZ_INTERRUPT_OST|EPWM_TZ_INTERRUPT_DCAEVT2));

    EPWM_clearTripZoneFlag(base3,

                           (EPWM_TZ_INTERRUPT_OST|EPWM_TZ_INTERRUPT_DCAEVT2));

    EPWM_clearTripZoneFlag(base4,

                           (EPWM_TZ_INTERRUPT_OST|EPWM_TZ_INTERRUPT_DCAEVT2));

But the result seems weird like below.

CH Red  Iin (current to be triggered)

CH Yellow  Slow PWM

CH  Blue    Fast PWM upper-side

CH  Green  Fast PWM lower-side

You can see when the input current goes much higher than the trigger point, the Fast PWM lower-side (Green) and Slow PWM (Yellow) are turned off PWM more slowly than expected, and Fast PWM updder-side (Green) is not turned off, which is not expected.

On the other hand, if the user changes to one-shot trip by EPWM_TZ_SIGNAL_DCAEVT1, then all the three PWM showed below are turned off immediately as expected.

So, our questions:

1. Is there anything wrong about the user's setting with CBC by EPWM_TZ_SIGNAL_DCAEVT2?

2. If (1) is correct, why the PWM could not be turned off immediately or even not be turned off?

Wayne Huang

  • Can you describe the difference between the pictures? The second one is OST turning the signals off, the first one is CBC? or DCEVT?

  • Dear Nima,

    The first figure is by DCAEVT2, but the result was wrong (not as expected)

    The second figure is by DCAEVT1, and the result was correct (as expected).

    The user wants to do it by DCAEVT2 because PWM can be recovered automatically once the over current events disappear.

    Wayne Huang

  • So the user doesnt need any CBC or OST. They just need DCxEVT to directly manipulate the output and turn it off when the signal is present?

  • Dear Nima,

    Yes, the user's wants to use PWM cycle-by-cycle (CBC) as current limiting in this case.

    The current is sensed by the comparator for DCAEVT2.

    From the above codes in the first post, you can see they use DCAEVT2 as the source in TZSEL and so that it can be CBC latched following Figure 18-41. Trip-Zone Submodule Mode Control Logic of the TRM (http://www.ti.com/lit/ug/sprui33c/sprui33c.pdf).

    But the result was not as expected as the figure 1 in the first post, so we are asking this and wonder if there is anything wrong.

    Wayne Huang

  • Dear Nima,

    Do you have any update?

    Wayne Huang

  • I wrote this example to configure the DC module for CBC. Take a look at below:

        //
        // To enable DCAEVT1 as one shot trip sources un-comment below
        // You will need to un-comment the lines in the TZ ISR to re-enable
        // the PWM after a one-shot event has occurred.
        //
        // EPWM_enableTripZoneSignals(EPWM1_BASE, EPWM_TZ_SIGNAL_DCAEVT1);
    
        //
        // Select TRIPIN1 (INPUT XBAR INPUT1) as the source for DCAH
        //
        EPWM_selectDigitalCompareTripInput(
                EPWM1_BASE, EPWM_DC_TRIP_TRIPIN1, EPWM_DC_TYPE_DCAH);
    
        //
        // DCAEVT1 is generated when DCAH is low
        //
        EPWM_setTripZoneDigitalCompareEventCondition(
                EPWM1_BASE, EPWM_TZ_DC_OUTPUT_A1, EPWM_TZ_EVENT_DCXH_LOW);
    
        //
        // DCAEVT1 uses the unfiltered version of DCAEVT1
        //
        EPWM_setDigitalCompareEventSource(
                EPWM1_BASE, EPWM_DC_MODULE_A, EPWM_DC_EVENT_1, EPWM_DC_EVENT_SOURCE_ORIG_SIGNAL);
    
        //
        // DCAEVT1 is asynchronous
        //
        EPWM_setDigitalCompareEventSyncMode(
                EPWM1_BASE, EPWM_DC_MODULE_A, EPWM_DC_EVENT_1, EPWM_DC_EVENT_INPUT_NOT_SYNCED);
    
        //
        // Action on DCAEVT1
        // Force the EPWMA LOW
        //
        EPWM_setTripZoneAction(EPWM1_BASE,
                               EPWM_TZ_ACTION_EVENT_DCAEVT1,
                               EPWM_TZ_ACTION_LOW);

     

    That is for one-shot. It needs to be similar to CBC.

    //
        // To enable DCAEVT2 as CBC trip sources
        //
        EPWM_enableTripZoneSignals(EPWM1_BASE, EPWM_TZ_SIGNAL_DCAEVT2);
    
    
        EPWM_selectCycleByCycleTripZoneClearEvent(EPWM1_BASE , EPWM_TZ_CBC_PULSE_CLR_CNTR_ZERO);
    
        EPWM_disableTripZoneAdvAction(EPWM1_BASE);
    
        //
        // Action on DCAEVT2
        // Force the EPWMA do not change
        //
        EPWM_setTripZoneAction(EPWM1_BASE,
                               EPWM_TZ_ACTION_EVENT_DCAEVT2,
                               EPWM_TZ_ACTION_DISABLE);
    
        //
        // Action on DCAEVT2
        // Force the EPWMA LOW
        //
        EPWM_setTripZoneAction(EPWM1_BASE,
                               EPWM_TZ_ACTION_EVENT_TZA,
                               EPWM_TZ_ACTION_LOW);

    What I think may happen is you have the "high impledance action turned on at the DCAEVT2".

    If it is possible that your understanding on the DCAEVT and CBC are not correct. 

    When to use:

        EPWM_setTripZoneAction(EPWM1_BASE,
                               EPWM_TZ_ACTION_EVENT_DCAEVT2,
                               EPWM_TZ_ACTION_LOW);

    That is if you want the EPWM signal to go low as soon as a DCAEVT2 is available and restore to default when the DCAEVT2 signal disappears.

    When to use:

        EPWM_setTripZoneAction(EPWM1_BASE,
                               EPWM_TZ_ACTION_EVENT_TZA,
                               EPWM_TZ_ACTION_LOW);

    This is if you want the EPWM signal to go low as soon as a DCAEVT2 is available and restore to default only when the CBC CLR PULSE event occurs, maybe at EPWM CTR=ZERO. THIS IS THE CBC mode.

  • Dear Nima,

    You can see the codes I showed on the first post.

    The users follows the CBC mode that you showed in the last post, but it seems there is still something wrong that we are still clarifying.

    I think we can talk offline for more detail.

    Wayne Huang

  • Will post the solution once ready for other customers to view.

  • Wayne,

    Did you try the sample code?

    Nima