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.

TMS320F280049C: PWM Tz faults + J2-pin 13

Guru 56093 points
Part Number: TMS320F280049C


Oddly we assume from viewing launch pad schematic J2 pin 13 is GPIO-30. Yet we disable GPIO 30 motor SDK software (hal.c) and calls to it and still goes high state runt pulses synchronous to ePWM drives.  How is that possible when flash was erased then firmware with disable GPIO 30 was not configured? Project was cleaned, compiled perhaps GPIO 30 is being xBAR cross linked or schematic is wrong?

We today also find ePWM Xbar Tz action (7,8,9) ePWM fault trip zones were configured for low action when ePWM DC compare faults action was set for high. And disablePWM() still does not put drives in high impedance state via call to force triggering one shot trips of combinational 3 zones. The fault trip zones was missing below call but it still not disable via Tz action oneshot into 3 combinational trip zones hal.c HAL_faultsetup. The ePWM drives 1A/B 2A/B 4A/B remain high state do not change to high impedance state as configured. It seems like errata in this area!

        // What do we want the OST/CBC events to do?
        EPWM_disableTripZoneAdvAction(obj->pwmHandle[cnt]);
        // TZA events can force EPWMxA
        // TZB events can force EPWMxB
        EPWM_setTripZoneAction(obj->pwmHandle[cnt],
                               EPWM_TZ_ACTION_EVENT_TZA,
                               EPWM_TZ_ACTION_LOW); //_ACTION_HIGH_Z
        EPWM_setTripZoneAction(obj->pwmHandle[cnt],
                               EPWM_TZ_ACTION_EVENT_TZB,
                               EPWM_TZ_ACTION_LOW);// _ACTION_HIGH_Z
    // turns off the outputs of the EPWM peripherals which will put the power
    // switches into a high impedance state.
    EPWM_forceTripZoneEvent(obj->pwmHandle[0], EPWM_TZ_FORCE_EVENT_OST);
    EPWM_forceTripZoneEvent(obj->pwmHandle[1], EPWM_TZ_FORCE_EVENT_OST);
    EPWM_forceTripZoneEvent(obj->pwmHandle[2], EPWM_TZ_FORCE_EVENT_OST);

  

  • Somehow believed J4, J2 were not reversed in schematic and reversed on quick start guide booster pack pin map card. I tested J4 pin 39 last week for GPIO 30 signal and it was remaining low during LED5 blink rate, oddly today it toggles as expected.

    I don't know what has changed that now GPIO 30 works to indicate mainISR() decimation times. Now to fix why ePWM drives are to be disabled by forcing a one shot trip event that oddly fails via the HAL_setupFaults() configuration hal.c. Otherwise ePWM 1AB, 2AB, 4AB drives remain high DRV8320RS output test points and motor phases. 

        //
        // disable the PWM
        //
        HAL_disablePWM(halHandle);

  • Much review x49c technical reference regarding fault handling via CCMPn(2,4,6) into xBAR Tzn (7,8,9) Mux(2,6,10) checks OK (table 18-13). Even advanced DCA/B (18.11.4.1) has no effect to control ePWM-A/B fault event states, OSHT or DCA/B configurations (SDK hal.c). Why ePWM-A/B remain high when forced into fault state? Neither configuration can control the ePWM A/B outputs from ePWM xBAR Mux as it was and now is configured.

        ASysCtl_selectCMPHPMux(ASYSCTL_CMPHPMUX_SELECT_2, 4);
        ASysCtl_selectCMPLPMux(ASYSCTL_CMPLPMUX_SELECT_2, 4);
    
        ASysCtl_selectCMPHPMux(ASYSCTL_CMPHPMUX_SELECT_4, 4);
        ASysCtl_selectCMPLPMux(ASYSCTL_CMPLPMUX_SELECT_4, 4);
    
        ASysCtl_selectCMPHPMux(ASYSCTL_CMPHPMUX_SELECT_6, 4);
        ASysCtl_selectCMPLPMux(ASYSCTL_CMPLPMUX_SELECT_6, 4);
    
        // Configure TRIP9 to be CTRIP1H and CTRIP1L using the ePWM X-BAR
        XBAR_setEPWMMuxConfig(XBAR_TRIP9, XBAR_EPWM_MUX06_CMPSS4_CTRIPH_OR_L);
        XBAR_enableEPWMMux(XBAR_TRIP9, XBAR_MUX06);
    
        // Configure TRIP7 to be CTRIP1H and CTRIP1L using the ePWM X-BAR
        XBAR_setEPWMMuxConfig(XBAR_TRIP7, XBAR_EPWM_MUX02_CMPSS2_CTRIPH_OR_L);
        XBAR_enableEPWMMux(XBAR_TRIP7, XBAR_MUX02);
    
        // Configure TRIP8 to be CTRIP1H and CTRIP1L using the ePWM X-BAR
        XBAR_setEPWMMuxConfig(XBAR_TRIP8, XBAR_EPWM_MUX10_CMPSS6_CTRIPH_OR_L);
        XBAR_enableEPWMMux(XBAR_TRIP8, XBAR_MUX10);
    
            // Configure the DCA path to be un-filtered and asynchronous
            // Unfiltered: EPWM_DC_EVENT_SOURCE_ORIG_SIGNAL
            //
            EPWM_setDigitalCompareEventSource(obj->pwmHandle[cnt],
                                              EPWM_DC_MODULE_A,
                                              EPWM_DC_EVENT_1,
                                              EPWM_DC_EVENT_SOURCE_FILT_SIGNAL);
    
            // Configure the DCB path to be un-filtered and asynchronous
            EPWM_setDigitalCompareEventSource(obj->pwmHandle[cnt],
                                              EPWM_DC_MODULE_B,
                                              EPWM_DC_EVENT_1,
                                              EPWM_DC_EVENT_SOURCE_FILT_SIGNAL);

    // Trigger event when DCAH is High
    EPWM_setTripZoneDigitalCompareEventCondition(obj->pwmHandle[cnt],
    EPWM_TZ_DC_OUTPUT_A1, EPWM_TZ_EVENT_DCXH_HIGH);

    // Trigger event when DCBH is High
    EPWM_setTripZoneDigitalCompareEventCondition(obj->pwmHandle[cnt],
    EPWM_TZ_DC_OUTPUT_B1, EPWM_TZ_EVENT_DCXL_HIGH);       

      // Enable DCA/DCB as Combinational OSHT event
     EPWM_enableTripZoneSignals(obj->pwmHandle[cnt],
     EPWM_TZ_SIGNAL_DCAEVT1 | EPWM_TZ_SIGNAL_DCBEVT1);

            /* Advanced TzCTLDCA TripZones for ePWM-A digital comparator events */
           EPWM_setTripZoneAdvDigitalCompareActionA(obj->pwmHandle[cnt],
    	EPWM_TZ_ADV_ACTION_EVENT_DCxEVT1_U,
            EPWM_TZ_ADV_ACTION_LOW); //EPWM_TZ_ADV_ACTION_HIGH_Z
            EPWM_setTripZoneAdvDigitalCompareActionA(obj->pwmHandle[cnt],
    	EPWM_TZ_ADV_ACTION_EVENT_DCxEVT1_D,
    	EPWM_TZ_ADV_ACTION_LOW); //EPWM_TZ_ADV_ACTION_HIGH_Z
            /* Advanced TzCTLDCB TripZones for ePWM-B digital comparator events */
            EPWM_setTripZoneAdvDigitalCompareActionB(obj->pwmHandle[cnt],
    		EPWM_TZ_ADV_ACTION_EVENT_DCxEVT1_U,
    		EPWM_TZ_ADV_ACTION_LOW); //EPWM_TZ_ADV_ACTION_HIGH_Z
            EPWM_setTripZoneAdvDigitalCompareActionB(obj->pwmHandle[cnt],
    		EPWM_TZ_ADV_ACTION_EVENT_DCxEVT1_D,
    		EPWM_TZ_ADV_ACTION_LOW); //EPWM_TZ_ADV_ACTION_HIGH_Z
    
            // What do we want the OST/CBC events to do?
            /* Disable the TripZone Advanced Action */
            //EPWM_disableTripZoneAdvAction(obj->pwmHandle[cnt]);
            // TZA events can force EPWMxA
            // TZB events can force EPWMxB
            EPWM_setTripZoneAction(obj->pwmHandle[cnt],
                   EPWM_TZ_ACTION_EVENT_TZA,
    	       EPWM_TZ_ACTION_LOW); //EPWM_TZ_ACTION_HIGH_Z
            EPWM_setTripZoneAction(obj->pwmHandle[cnt],
                   EPWM_TZ_ACTION_EVENT_TZB,
    	       EPWM_TZ_ACTION_LOW); //EPWM_TZ_ACTION_HIGH_Z
    
    
    // Force a commanded ePWM fault A/B outputs:
    
        EPWM_forceTripZoneEvent(obj->pwmHandle[0], EPWM_TZ_FORCE_EVENT_OST |
        EPWM_TZ_FORCE_EVENT_DCAEVT1 | EPWM_TZ_FORCE_EVENT_DCBEVT1);
        EPWM_forceTripZoneEvent(obj->pwmHandle[1], EPWM_TZ_FORCE_EVENT_OST |
        EPWM_TZ_FORCE_EVENT_DCAEVT1 | EPWM_TZ_FORCE_EVENT_DCBEVT1);
        EPWM_forceTripZoneEvent(obj->pwmHandle[2], EPWM_TZ_FORCE_EVENT_OST |
        EPWM_TZ_FORCE_EVENT_DCAEVT1 | EPWM_TZ_FORCE_EVENT_DCBEVT1);
     

      

  • Where do you select the DCAH/L, DCBH/L sources and actions?

  • This code is from SDK hal.c and I only test tripping fault another way to force trip faults via DCA. Top code is direct register writes to force DCA action do not need the bottom configuration but it is there too. Both ways normal and advanced fail to trip faults via hal.c.

    18.11.4.1: The TZn signals, when used as a DCEVT tripping functions, are treated as a normal input signal and can be defined to be active high or active low inputs. ePWM outputs are asynchronously tripped when either the TZn, DCAEVTx.force, or DCBEVTx.force signals are active. For the condition to remain latched, a minimum of 3*TBCLK sync pulse width is required. If pulse width is < 3*TBCLK sync pulse width, the trip condition may or may not get latched by CBC or OST latches.

    //! \brief      Disables the PWM device
    //! \details    Turns off the outputs of the EPWM peripherals which will put
    //!             the power switches into a high impedance state.
    //! \param[in]  handle  The hardware abstraction layer (HAL) handle
    static inline void HAL_disablePWM(HAL_Handle handle)
    {
        HAL_Obj *obj = (HAL_Obj *)handle;
    
        EPWM_forceTripZoneEvent(obj->pwmHandle[0], //EPWM_TZ_FORCE_EVENT_OST);
        EPWM_TZ_FORCE_EVENT_DCAEVT1 | EPWM_TZ_FORCE_EVENT_DCBEVT1);
        EPWM_forceTripZoneEvent(obj->pwmHandle[1], //EPWM_TZ_FORCE_EVENT_OST);
        EPWM_TZ_FORCE_EVENT_DCAEVT1 | EPWM_TZ_FORCE_EVENT_DCBEVT1);
        EPWM_forceTripZoneEvent(obj->pwmHandle[2], //EPWM_TZ_FORCE_EVENT_OST);
        EPWM_TZ_FORCE_EVENT_DCAEVT1 | EPWM_TZ_FORCE_EVENT_DCBEVT1);
    
        obj->flagEnablePWM = false;
    
    
        return;
    } // end of HAL_disablePWM() function
    
            //enable DC TRIP combinational input
            // 18.1.3 CMPSS: 
            EPWM_enableDigitalCompareTripCombinationInput(obj->pwmHandle[cnt],
                   ( EPWM_DC_COMBINATIONAL_TRIPIN7 |
                    EPWM_DC_COMBINATIONAL_TRIPIN8 | EPWM_DC_COMBINATIONAL_TRIPIN9),
                    EPWM_DC_TYPE_DCAH); 
            EPWM_enableDigitalCompareTripCombinationInput(obj->pwmHandle[cnt],
                   (EPWM_DC_COMBINATIONAL_TRIPIN7 |
    				EPWM_DC_COMBINATIONAL_TRIPIN8 | EPWM_DC_COMBINATIONAL_TRIPIN9),
                    EPWM_DC_TYPE_DCAL); 
            EPWM_enableDigitalCompareTripCombinationInput(obj->pwmHandle[cnt],
                   ( EPWM_DC_COMBINATIONAL_TRIPIN7 |
                    EPWM_DC_COMBINATIONAL_TRIPIN8 | EPWM_DC_COMBINATIONAL_TRIPIN9),
                    EPWM_DC_TYPE_DCBH);
            EPWM_enableDigitalCompareTripCombinationInput(obj->pwmHandle[cnt],
                   ( EPWM_DC_COMBINATIONAL_TRIPIN7 |
                    EPWM_DC_COMBINATIONAL_TRIPIN8 | EPWM_DC_COMBINATIONAL_TRIPIN9),
                    EPWM_DC_TYPE_DCBL); 

  • I added the advanced compare tripping configuration as to select DCA_ A/B_ H/L. It was configured for DCA/B via OST forced tripping events, calling HAL_disablePWM () did nothing via the original code in is05_motor_id.c.

    This is a bit concerning and explains why original fault code smoked my nice Nidec motor when it should have tripped some kind of fault. Even the DRV8320RS OC did not trip nFault GPIO input Tz2 as it should have prior to adding above snips. It seems the ePWM DC trip select via sub module (18-11,Fig.18-48) has issues not discussed 0x49c errata document. 

  • Hi Nima,

    I just want to be clear that the original SDK Tz2 was setting the nFault bit in the FaultFlagsNow parameter and not tripping ePMW A/B output low.

    Above calls was configured DCB-2 CBC and DCA-1 event OHST and Force DCA/B faults had no effect on either ePWM A or B. The main issue being DC interrupts were not actually configured yet being cleared as if they had been enabled for faults handling top hal.h. There is no global interrupt clear ALL for all interrupt flags, there is only 1 interrupt clear source Fig18-42 TZCLR per driver.lib. So the defines top of hal.c need the individual flags shown below to call clear the motorVars.faultNow.all bits. 

    SDK uses fault flag bits, not interrupt driven faults. Seemingly it was assumed an interrupt vector existed. Perhaps it would not take to much effort to update SDK for interrupt driven faults as you posted this week. This patch clears the faults flags and later when any FaultNow.All bits are tripped can easily be cleared.

    //! DCA/B, OSHT/CBC, TzFlg(Int) Fig.18-42
    //!
    #define HAL_TZ_FLAGS_ALL       EPWM_TZ_INTERRUPT \
    								 + EPWM_TZ_FLAG_CBC \
    								 + EPWM_TZ_FLAG_OST \
    								 + EPWM_TZ_FLAG_DCAEVT1 \
    								 + EPWM_TZ_FLAG_DCBEVT1 \
    								 + EPWM_TZ_FLAG_DCAEVT2 \
    								 + EPWM_TZ_FLAG_DCBEVT2
    
    
    //! \brief      Enables the PWM devices
    //! \details    Turns on the outputs of the EPWM peripheral which will allow
    //!             the power switches to be controlled.
    //! \param[in]  handle  The hardware abstraction layer (HAL) handle
    static inline void HAL_enablePWM(HAL_Handle handle)
    {
        HAL_Obj *obj = (HAL_Obj *)handle;
    
        EPWM_clearTripZoneFlag(obj->pwmHandle[0], HAL_TZ_FLAGS_ALL); //HAL_TZ_INTERRUPT_ALL
        EPWM_clearTripZoneFlag(obj->pwmHandle[1], HAL_TZ_FLAGS_ALL); //HAL_TZ_INTERRUPT_ALL
        EPWM_clearTripZoneFlag(obj->pwmHandle[2], HAL_TZ_FLAGS_ALL); //HAL_TZ_INTERRUPT_ALL
    
        obj->flagEnablePWM = true;
    
        return;
    } // end of HAL_enablePWM() function
    
            /* Clear any spurious fault flags */
            EPWM_clearTripZoneFlag(obj->pwmHandle[cnt],
                                            HAL_TZ_FLAGS_ALL); //Added
            /* Disable All TZn interrupt sources */
            EPWM_disableTripZoneInterrupt(obj->pwmHandle[cnt],
    	               		  HAL_TZ_INTERRUPT_ALL);

      

  • What do you believe is the issue?

    " It seems the ePWM DC trip select via sub module (18-11,Fig.18-48) has issues not discussed 0x49c errata document. "