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.

CCS/LAUNCHXL-F280049C: Change One-Shot PWM to Cycle-by-Cycle

Part Number: LAUNCHXL-F280049C

Tool/software: Code Composer Studio

Hi

I would like to change the code of digital buck converter PWM from one-shot to cycle by cycle. I have reviewed a code on example epwm_ex1_trip_zone CCS project. I copy these code from the project to buck_F28004x but not successful. Any hint how to do it?

BR

HK Woo

  • HK Woo,

    You will need to be more specific about your desired behavior, what you have tried to modify, and what the observed outcome is.

    This EPWM Video may be helpful with introducing the various EPWM features.

    -Tommy

    HK Woo

  • Hi Tommy

    Good to see you again. Actually, I would like to change EPWM2A and EPWM2B behavior from one-shot-trip to cycle-by-cycle. I have changed the code as below from    

    EPWM_enableTripZoneSignals(BUCK_DRV_EPWM_BASE,
                                   EPWM_TZ_SIGNAL_DCAEVT1);

        EPWM_enableTripZoneSignals(EPWM2_BASE,
                                     EPWM_TZ_INTERRUPT_DCAEVT1);

    to

        EPWM_enableTripZoneSignals(BUCK_DRV_EPWM_BASE,
                                   EPWM_TZ_SIGNAL_DCAEVT2);

        EPWM_enableTripZoneSignals(EPWM2_BASE,
                                     EPWM_TZ_INTERRUPT_DCAEVT2);

     

    Add in buck_main.c

    __interrupt void epwm2TZISR(void);

     

        Interrupt_enable(INT_EPWM2_TZ);

        Interrupt_register(INT_EPWM2_TZ, &epwm2TZISR);

     

        EINT; // Add it before main for loop
        ERTM; // Add it before main for loop

     

    __interrupt void epwm2TZISR(void)
    {
        //
        // Toggle GPIO to notify when TZ is entered
        //
        GPIO_togglePin(11);

        //
        // Clear the flags - we will continue to take this interrupt until the TZ
        // pin goes high.
        //
        EPWM_clearTripZoneFlag(EPWM2_BASE, (EPWM_TZ_INTERRUPT | EPWM_TZ_FLAG_CBC));

        //
        // Acknowledge this interrupt to receive more interrupts from group 2
        //
        Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP2);
    }

     

    it seems that EPWM2 was tripped but can't generate interrupt to my ISR routine "epwm2TZISR" function. I have modified a code as below but still can't generate an interrupt.

        //
        // Enable DCAEVT1 OST and configure ePWM to output on trip:
        //   H-DRV = LOW (Turn off Vin to L switch)
        //   L-DRV = DO NOTHING (Continue actuation of Gnd to L switch)
        //
        EPWM_enableTripZoneSignals(BUCK_DRV_EPWM_BASE,
                                   EPWM_TZ_SIGNAL_DCAEVT2);
    /* Orginal code
        EPWM_enableTripZoneSignals(EPWM2_BASE,   
                                     EPWM_TZ_INTERRUPT_DCAEVT2);
    */

     

    // New code change EPWM_enableTripZoneSignals() to EPWM_enableTripZoneInterrupt()


        EPWM_enableTripZoneInterrupt(EPWM2_BASE,
                                     EPWM_TZ_INTERRUPT_DCAEVT2);
        
          Please advice how to fix it.

    Furthermore, I have done some works to study more Trip feature of EPWM.

     

    I have commented the code of below in red in order to disable trip from CMPSS1L, I guessed, but EPWM2 still be tripped. Did I mis-understand something?

    void BUCK_HAL_setupSyncBuckOverCurrentTripAction(void)
    {
        //
        // Select CMPSS trip signal from ePWM XBAR as source for DCAL and DCBL
        //
        XBAR_setEPWMMuxConfig(BUCK_OC_CMPSS_XBAR_TRIP, BUCK_OC_CMPSS_XBAR_MUX_VAL);
        XBAR_enableEPWMMux(BUCK_OC_CMPSS_XBAR_TRIP, BUCK_OC_CMPSS_XBAR_MUX);

        EPWM_selectDigitalCompareTripInput(BUCK_DRV_EPWM_BASE,
                                           BUCK_DRV_EPWM_DC_TRIP_OC,
                                           EPWM_DC_TYPE_DCAL);

        EPWM_setTripZoneDigitalCompareEventCondition(BUCK_DRV_EPWM_BASE,
                                                     EPWM_TZ_DC_OUTPUT_A1,
                                                     EPWM_TZ_EVENT_DCXL_HIGH);
    /*

        EPWM_setDigitalCompareEventSyncMode(BUCK_DRV_EPWM_BASE,
                                            EPWM_DC_MODULE_A,
                                            EPWM_DC_EVENT_1,
                                            EPWM_DC_EVENT_INPUT_NOT_SYNCED);

        //
        // Select signal input source for DCAEVT1
        //
        #if(BUCK_CTL_MODE == BUCK_CTL_MODE_VMC)
            //
            // Use blanking window filtered DCAEVT1 signal for VMC
            //
            EPWM_setDigitalCompareEventSource(BUCK_DRV_EPWM_BASE,
                                              EPWM_DC_MODULE_A,
                                              EPWM_DC_EVENT_1,
                                              EPWM_DC_EVENT_SOURCE_FILT_SIGNAL);
        #elif(BUCK_CTL_MODE == BUCK_CTL_MODE_PCMC)
            //
            // Use native DCxEVT1 signal for PCMC
            //
            EPWM_setDigitalCompareEventSource(BUCK_DRV_EPWM_BASE,
                                              EPWM_DC_MODULE_A,
                                              EPWM_DC_EVENT_1,
                                              EPWM_DC_EVENT_SOURCE_ORIG_SIGNAL);
        #endif


        //
        // Enable DCAEVT1 OST and configure ePWM to output on trip:
        //   H-DRV = LOW (Turn off Vin to L switch)
        //   L-DRV = DO NOTHING (Continue actuation of Gnd to L switch)
        //
        EPWM_enableTripZoneSignals(BUCK_DRV_EPWM_BASE,
                                   EPWM_TZ_SIGNAL_DCAEVT2);

        EPWM_enableTripZoneSignals(EPWM2_BASE,
                                     EPWM_TZ_INTERRUPT_DCAEVT2); // HK Woo "EPWM_T_INTERRUPT_DCAEVT2 is not input parameter according to manual.

        EPWM_setTripZoneAction(BUCK_DRV_EPWM_BASE,
                               EPWM_TZ_ACTION_EVENT_TZA,
                               EPWM_TZ_ACTION_LOW);

        EPWM_setTripZoneAction(BUCK_DRV_EPWM_BASE,
                               EPWM_TZ_ACTION_EVENT_TZB,
                               EPWM_TZ_ACTION_DISABLE);
    */



    }

     

    It is because I comment the statement "EPWM_enableTripZoneSignals()" functions. I supposed that trip action never occur. Furthermore, it is found that the code uses 2 EPWM_enableTripZoneSignals(). Parameters for second one is "EPWM_TZ_INTERRUPT_DCAEVT2", however it is not an input parameters for the function according to the user manual of driverlib.

     

    BR

    HK Woo

     

  • HK Woo,

    I am not able to follow everything that you have posted.  The amount of text and overlapping activity is overwhelming to me.

    Generally, I recommend that you carefully differentiate between the EPWM_enableTripZoneInterrupt() vs EPWM_enableTripZoneSignals() functions and their supported parameters.

    For system debug, you can break the problem down into small links of a signal chain.  After executing the driverlib configuration calls, you can halt CCS execution at a breakpoint and manually interact with the EPWM signal chain to identify where the problem is coming from.  There are also manual force triggers that can be used to simulate trip events.  Use the TRM figures as a guide.

    For example, you can simulate a DCAEVT2 event using the TZFRC register from the Expressions Window to validate that the signal is propagating into the downstream status registers.

    After that checks out, you can continue tracing the signal to the interrupt generation logic.

    -Tommy