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.

Problem on using CLA C library for power inverter implementation.

Hi all,

I am now using F28069 Piccolo Experimenter's Kit to drive a half bridge inverter with SPWM control by using CLA C library: PWMDRV_ComplPairDB_CLA_C().

 

I have no problem during normal operation.

 

If I would like to turn off my inverter, both PWMA and PWMB signal should be zero. However, since it is a complementary channel, I cannot force both PWMA and PWMB to be zero.

 

My question is how can I set both PWMA and PWMB to be zero if I want to turn off my inverter?

 

Here is my code in CLA task:

 

// CLA_PlantInfo_EnableGatePWM ==1, turn on inverter; else turn off inverter

if ( CLA_PlantInfo_EnableGatePWM ) {

                PWMDRV_ComplPairDB_CLA_C(EPwm1Regs, EPwm1Regs.TBPRD, CLA_Duty1);

} else {

        //Here, I wanna set both PWMA and PWMB to be logic zero

        // seems that the following code cannot meet my target:

        //PWMDRV_ComplPairDB_CLA_C(EPwm1Regs, EPwm1Regs.TBPRD, 0);

}

Many thanks in advanced.

BR,

Barry

  • Barry,

    You will need to configure the TZ module if you want to force both of them low, for this you will need to enable the TZ module and configure the action in case of a trip.

    EALLOW;

    // Adding one shot trip for over-current protection on the inverter TZ2
    EPwm1Regs.TZSEL.bit.OSHT2 = 0x1;

    // What do we want the OST/CBC events to do?
    // TZA events can force EPWMxA
    // TZB events can force EPWMxB

    EPwm1Regs.TZCTL.bit.TZA = TZ_FORCE_LO; // EPWMxA will go low
    EPwm1Regs.TZCTL.bit.TZB = TZ_FORCE_LO; // EPWMxB will go low

    EDIS;

    Next you can software force a trip on the PWM whenever you like, 

    // Force a trip event on all the PWM modules for safety
    EPwm1Regs.TZFRC.bit.OST = 0x1;

    Regards

    Manish Bhardwaj

  • Dear Manish,

     

    Thank you for your prompt reply. I can control both of the PWMA and PWMB to zero after using your code. However, I cannot resume it to normal if I want my inverter get back to normal operation.

     

               if (PlantCtl.EnableGatePWM) {

                         CLA_PlantInfo_EnableGatePWM = 1;

                         //The following code cannot set my inverter to the normal operation:

                         EALLOW;

                         EPwm1Regs.TZFRC.bit.OST = 0x0;

                         EDIS;

               } else {

                         CLA_PlantInfo_EnableGatePWM = 0;

                         EALLOW;

                         EPwm1Regs.TZFRC.bit.OST = 0x1;

                         EDIS;

               }

     

    I find there is a interrupt generated after setting OST=1, does it means that I have to clear that interrupt and would you please tell how to do this?

     

    OST Trip-zone One-Shot Interrupt Enable

    0 Disable one-shot interrupt generation

    1 Enable Interrupt generation; a one-shot trip event will cause a EPWMx_TZINT PIE interrupt.

     

    BR,

    Barry