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.

TMS320F280040-Q1: EPWMXLINK and driverlib: Is there any support or example?

Part Number: TMS320F280040-Q1

Hello folks,

I'm trying to use the EPWMXLINK feature to guarantee consistency during a variable frequency application as recommended on page 1783 of the user guide (SPRUI33D). However, on the same document, page 2017, there is no library function associated with this register usage.

I was wondering if there is some additional documentation about how to correctly set this linking feature in a driverlib based application.

Any help will be much appreciated.

Thank you.

  • Hi Luciano,

    We do not have any available ready example showcasing the use case of EPWMXLINK feature, but there is a driverlib function available which you can use directly in your EPWM initialization and shouldn't be challenging to implement. Please find below the snippet from epwm.h file -

    //*****************************************************************************
    //
    //! Sets the EPWM links.
    //!
    //! \param base is the base address of the EPWM module.
    //! \param epwmLink is the ePWM instance to link with.
    //! \param linkComp is the ePWM component to link.
    //!
    //! This function links the component defined in linkComp in the current ePWM
    //! instance with the linkComp component of the ePWM instance defined by
    //! epwmLink. A change (a write) in the value of linkComp component of epwmLink
    //! instance, causes a change in the current ePWM linkComp component.
    //! For example if the current ePWM is ePWM3 and the values of epwmLink and
    //! linkComp are EPWM_LINK_WITH_EPWM_1 and EPWM_LINK_COMP_C respectively,
    //! then a write to COMPC register in ePWM1, will result in a simultaneous
    //! write to COMPC register in ePWM3.
    //! Valid values for epwmLink are:
    //!   - EPWM_LINK_WITH_EPWM_1  - link current ePWM with ePWM1
    //!   - EPWM_LINK_WITH_EPWM_2  - link current ePWM with ePWM2
    //!   - EPWM_LINK_WITH_EPWM_3  - link current ePWM with ePWM3
    //!   - EPWM_LINK_WITH_EPWM_4  - link current ePWM with ePWM4
    //!   - EPWM_LINK_WITH_EPWM_5  - link current ePWM with ePWM5
    //!   - EPWM_LINK_WITH_EPWM_6  - link current ePWM with ePWM6
    //!   - EPWM_LINK_WITH_EPWM_7  - link current ePWM with ePWM7
    //!   - EPWM_LINK_WITH_EPWM_8  - link current ePWM with ePWM8
    //!
    //! Valid values for linkComp are:
    //!   - EPWM_LINK_TBPRD   - link TBPRD:TBPRDHR registers
    //!   - EPWM_LINK_COMP_A   - link COMPA registers
    //!   - EPWM_LINK_COMP_B   - link COMPB registers
    //!   - EPWM_LINK_COMP_C   - link COMPC registers
    //!   - EPWM_LINK_COMP_D   - link COMPD registers
    //!   - EPWM_LINK_GLDCTL2  - link GLDCTL2 registers
    //!
    //! \return None.
    //
    //*****************************************************************************
    static inline void
    EPWM_setupEPWMLinks(uint32_t base, EPWM_CurrentLink epwmLink,
                        EPWM_LinkComponent linkComp)
    {
        //
        // Check the arguments
        //
        ASSERT(EPWM_isBaseValid(base));
    
        //
        // Configure EPWM links
        //
        HWREG(base + EPWM_O_XLINK) =
                  ((HWREG(base + EPWM_O_XLINK) & ~((uint32_t)0xFU << linkComp)) |
                   ((uint32_t)epwmLink << linkComp));
    }

    Please go through the description of the function to understand the use case better. Let me know if you need additional clarifications.

    Regards,

    Aditya

  • Thank you Aditya, this is exactly what I was looking for. 

    Thanks for the fast response,
    Cheers.