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.

TMS320F280049: Selecting Sync Input Source for EPWM4 using driverlib API

Part Number: TMS320F280049


Hi expert,

My customer would like to know how to configure Sync Input Source for EPWM4 using driverlib API. I tried in vain, could you help me pick that one out?

BTW, more general questions:

How do I QUICKLY find the driverlib API I need? (assume my back ground is bit field)

Can all the registers being configured through driverlib API? If not, should we use bit field at the same time or using HWREGH function?

Sheldon

Thanks


SheldonShssdddf

 

  • Sheldon,

    Putting your answer together right now.

    Nima

  • Okay. First of all if you know what registers you want to write to, lets say TBCTL, you can open EPWM.h and EPWM.c in the driverlib source, search _O_TBCTL , so you can find where it gets written to. Then the name of the function and the description will tell you everything you need to know.

    Okay now on to whether everything is available. I would say everything you would need to configure and use the PWM is available in the driverlib. There are some instances that you may need to use HWREG function. For example there is no function to read the TBCTR value. So in order to do this, you have to 

    timervalue = HWREGH(EPWM1_BASE + EPWM_O_TBCTL)

    Next I will help you with setting up the sync.

  • So on this device, if you are using EXTSYNCIN1 and 2, the code to select it on XBAR would be,

    XBAR_setInputPin(XBAR_INPUT5, 10);
    XBAR_setInputPin(XBAR_INPUT6, 11);

    Next, you need to configure the SYNCOUT if you choose to use SYNCOUT of another EPWM.

    EPWM_setSyncOutPulseMode(EPWM4_BASE, EPWM_SYNC_OUT_PULSE_ON_COUNTER_COMPARE_B);

    Now if your EPWM4 neeeded a SYNCIN, 

    You need to confgure SYNCSEL.EPWM4SYNCIN

    To do this you have to use the driverlib function,

    SysCtl_setSyncInputConfig(SYSCTL_SYNC_IN_EPWM4, SYSCTL_SYNC_IN_SRC_EXTSYNCIN1);

    The example above will use EXTSYNCIN1 as the sync input for EPWM4.

    Next you need configure you PHSEN,

    EPWM_enablePhaseShiftLoad(EPWM4_BASE);

    And if you need a phase value, 

    EPWM_setPhaseShift(EPWM4_BASE, 20);

    Good luck Sheldon.

    Nima Eskandari

  • Nima,

    Very detailed answer. Thanks!

    Sheldon