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.

TMS320F280048-Q1: Force TripZoneEvent and initial turn-off PWMs

Part Number: TMS320F280048-Q1
Other Parts Discussed in Thread: PMP23126

Hi,

1) In my PCMC based PSFB converter, that is designed based on PMP23126, I turn-off my PWM gating signals by using below lines at initial startup sequence. Then I clear PWMs in order to use them.

EPWM_forceTripZoneEvent(EPWM1_BASE, EPWM_TZ_FORCE_EVENT_OST);
EPWM_forceTripZoneEvent(EPWM2_BASE, EPWM_TZ_FORCE_EVENT_OST);
EPWM_forceTripZoneEvent(EPWM3_BASE, EPWM_TZ_FORCE_EVENT_OST);

PWM1 and PWM3 works fine but PWM2A or PWM2B doesn't get OFF. How can I resolve this issue?

2) At initial start up of my board, I want to init PWMs but never see any PWM signals at oscilloscope. I followed PMP23126 and applied following sequence. However, they are turned on at an instant and later immediately turned off during start. (PWM2A or PWM2B (one of it) always provides PWM signals as my question 1)

DisablePWMCLKCounting

Inits

Force TripzoneEvent as OST

EnablePWMCLKCounting

Setting Pins as PWM

Thanks in advance.

  • Hi Gokhan,

    Can you set a breakpoint in between each of the configurations you listed(enable pwm clock, settings pins as PWM, etc.) and set a trigger on your scope to confirm when the glitch on your output occurs in relation to your code?

    A.K.A. can you determine whether the glitch occurs immediately after enablePWMCLKCounting, or not until you've configured your pins to be PWM?

    Thank you,

    Luke

  • Hi Luke,

    PWM waveforms start to produce after this line and the waveform of PWM is like below. They all got high.

        PSFB_setPinsAsPWM();            // safe to setup PWM pins
        
        void PSFB_setPinsAsPWM(void)
    {
    
        // GPIO0    - O_UC_PWM_L1H
        // GPIO1    - O_UC_PWM_L1L
        // GPIO0 is the PWM1A pin.
        // GPIO1 is the PWM1B pin.
        GPIO_setPinConfig(GPIO_0_EPWM1_A);
        GPIO_setPadConfig(0, GPIO_PIN_TYPE_STD);
        GPIO_setQualificationMode(0, GPIO_QUAL_ASYNC);
        GPIO_setDirectionMode(0, GPIO_DIR_MODE_OUT);
        GPIO_setMasterCore(0, GPIO_CORE_CPU1);
    
        GPIO_setPinConfig(GPIO_1_EPWM1_B);
        GPIO_setPadConfig(1, GPIO_PIN_TYPE_STD);
        GPIO_setQualificationMode(1, GPIO_QUAL_ASYNC);
        GPIO_setDirectionMode(1, GPIO_DIR_MODE_OUT);
        GPIO_setMasterCore(1, GPIO_CORE_CPU1);
    ....


    Can you also comment on my first question?

    Thanks in advance.

  • Hello Gokhan,

    I saw this post and wanted to comment. 

    PWM1 and PWM3 works fine but PWM2A or PWM2B doesn't get OFF. How can I resolve this issue?

    Can you point out which PWM is being used as the phase shifted PWM? This PWM would be taking the trip input from the PCMC comparator, and hence would be using the CBC trip. In this case, it is is not possible to also use the OST trip. I believe we discussed this in another thread. Also, what are the trip zone actions you have configured for PWM2A and PWM2B?

  • Hi Gus,

    Thank you for reply. I apologize for repeating the same question. I remembered after you remind.

    PWM1 is master and PWM2 is slave. PWM2 uses CBC and it doesn't take any OST. Is there any other method to use OST at PWM2?

    Green is my PWM2 and others is PWM1. How can I solve inital turn on of my PWMs?

    PWM2 trip zone action is like below.

        EPWM_selectCycleByCycleTripZoneClearEvent(EPWM2_BASE,
                                                  EPWM_TZ_CBC_PULSE_CLR_CNTR_ZERO_PERIOD);
        
            //
        // Trip-zone event actions
        // What do we want the CBC events to do?
        // TZAx events can force EPWMxA
        // TZBx events can force EPWMxB
        //
        EPWM_setTripZoneAdvAction(EPWM2_BASE, EPWM_TZ_ADV_ACTION_EVENT_TZA_D,
                                  EPWM_TZ_ADV_ACTION_LOW);
        EPWM_setTripZoneAdvAction(EPWM2_BASE, EPWM_TZ_ADV_ACTION_EVENT_TZA_U,
                                  EPWM_TZ_ADV_ACTION_DISABLE);
        EPWM_setTripZoneAdvAction(EPWM2_BASE, EPWM_TZ_ADV_ACTION_EVENT_TZB_U,
                                  EPWM_TZ_ADV_ACTION_LOW);
        EPWM_setTripZoneAdvAction(EPWM2_BASE, EPWM_TZ_ADV_ACTION_EVENT_TZB_D,
                                  EPWM_TZ_ADV_ACTION_DISABLE);
        EPWM_setTripZoneAction(EPWM2_BASE, EPWM_TZ_ACTION_EVENT_TZA,
                               EPWM_TZ_ACTION_DISABLE);
        EPWM_setTripZoneAction(EPWM2_BASE, EPWM_TZ_ACTION_EVENT_TZB,
                               EPWM_TZ_ACTION_DISABLE);

    Does this below line clear OST?

    EPWM_selectCycleByCycleTripZoneClearEvent(EPWM2_BASE,
                                                  EPWM_TZ_CBC_PULSE_CLR_CNTR_ZERO_PERIOD);
        

  • Hi Gokhan,

    This code would clear the OST for EPWM2:

    EPWM_clearTripZoneFlag(EPWM2_BASEEPWM_TZ_FLAG_OST);
    Do you still see the EPWM2 outputs not getting cleared by the forced trip event, or was this issue resolved by following Gus' recommendation?
    Thank you,
    Luke
  • Hi Luke,

    I cannot trip my EPWM2. Gus says that if any ePWM is progrramed as CBC, it cannot be OST. My ePWM2 is CBC and I cannot trip it using OST. If it is impossible to trip using OST, I need to know it. Then OK.

    Other than that, I need further guidance to improve initial turn on of my pwms at oscilloscope other than epwm2. My question 2 in my first question is valid.

  • I cannot trip my EPWM2. Gus says that if any ePWM is progrramed as CBC, it cannot be OST. My ePWM2 is CBC and I cannot trip it using OST. If it is impossible to trip using OST, I need to know it. Then OK.

    There is only one trip-zone module shared by CBC and OST logic. If you force OST, then the trip actions you specified for CBC will be triggered. 

    Other than that, I need further guidance to improve initial turn on of my pwms at oscilloscope other than epwm2. My question 2 in my first question is valid.

    I noticed something on the PMP23126 firmware that is technically not correct. In PSFB_HAL_setupDevice() there is a call to Device_init() which calls Device_enableAllPeripherals(). In there the TBCLKSYNC is set. Make sure you don't do this in your code. This will start the PWM counting which technically should not be done until _after_ you have configured the PWMs. Just comment out any code that sets TBCLKSYNC (and GTBCLKSYNC if using a multi-core device). TBCLKSYNC is set in PSFB_HAL_enablePWMCLKCounting().

    Regarding your issue, you can also use CCS to check the EPWM TBCTR register and see if it is incrementing. If it is not, then the PWM is not counting and this is the reason why the PWM pins are not toggling.