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.

TMS320F28379D: ePWM GPIO and MEP Scalefactor

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Hi Team,

When external pullup resistors are added to the ePWM output pins ePWMxA and ePWMxB, both the ePWM outputs are staying low for small amount of time when I initialize GPIO mux for ePWM before the ePWM configurations.

Based on the post : https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/713586/tms320f28379d-pwm-pins-default-state

I changed the sequence to configure ePWM before setting GPIO mux for ePWM.

This worked.

However, I see that SFO() is not giving a proper output when GPIO is configured after the function is called.

SFO() -> GPIO for ePWM -> wrong result

GPIO for ePWM -> SFO() -> correct value.

I have two questions.

1. How is SFO() dependent on ePWM GPIO configuration?

2. What should be the correct sequence of setting GPIO mux for ePWM?

Kind regards,

Irene

  • Hi Irene,

    To look at the correct sequence of setting up GPIOs for EPWM use, you can refer to any of our EPWM or HRPWM (with SFO) C2000Ware examples. We have both bitfield-based and DriverLib-based examples available for you to view (paths below):

    • Bit-field: {C2000Ware}\device_support\f2837xd\examples\cpu1
    • DriverLib: {C2000Ware}\driverlib\f2837xd\examples\cpu1

    Please take a look at some of these examples for the correct GPIO configurations. The SFO library is used for MEP step calibration and is can adjust for environmental conditions such as temperature, etc. to ensure HRPWM measurements are optimal, so they are not directly dependent on software configurations.

    Best Regards,

    Allison

  • Hi Allison,

    This does not answer my question.  Let me elaborate my scenario.

    I have set PWM1A,B for complementary, active low operation. The sequence given in the HRPWM examples are first GPIO configuration and then ePWM configuration. This sequence causes both ePWMxA and ePWMxB GPIOs to stay low for small amount of time and causes issues with my bridge circuit. 

    Based on the e2e post shared in my question, I had changed the sequence to make it work.

     

    However, with HRPWM I see that changing the sequence impacts the MEP_Scalefactor value.

    1. Does MEP Scalefactor calculation depend on ePWM GPIO mux configuration?

    2. Are there any scenarios where ePWM GPIOs must be configured before ePWM configuration ?

  • Hi Irene,

    Apologies I misinterpreted this. What values are you seeing for the MEP_Scalefactor in each case?

    1. The scale factor optimization software calculates the MEP scale factor (number of MEP steps per coarse EPWMCLK step) in the background code, and the MEP scale factor varies depending on the system clock and DSP operating conditions. The HRPWM module has built in self-check and diagnostic capabilities that can be used to determine the optimum MEP scale factor value for any operating condition. TI provides a C-callable library containing one SFO function that utilizes this hardware and determines the optimum MEP scale factor. There is no dependency on GPIO mux configuration. 

    2. In our examples, we typically initialize the GPIOs before the PWMs, but let me double check on if there are necessary cases for this. 

    Best Regards,

    Allison

  • Hi Allison,

    No worries. Thank you for your quick response on this.

    Without GPIO configuration the MEPScalefactor is 140. But after GPIO configuration the scalefactor is 70 which is expected.

    Kind regards,

    Irene

  • Hi Irene,

    At what point are you seeing the value change? Are you stepping through the code line by line?

    Best Regards,

    Allison

  • Hi Allison,

    When I stepped through the code is when I was able to figure out that values are coming wrong. But I was doing a free run of my code when I noticed the difference.

    So the sequence is -> ePWM Configuration ( In this function I run SFO() and use the scalefactor to assign appropriate DBHRED value) then ePWM GPIO mux configuration.

    Did you get any reply on use cases where GPIO mux for ePWM should be strictly configured before ePWM register configurations?

    Kind regards,

    Irene

  • Hi Irene,

    The GPIOs do not need to be configured first- this only affects whether or not the EPWMs are routed out to the GPIO pins, but again this should not affect the MEP scale factor.

    At what point is the MEP scale factor changing? Are you able to pin point the line of code? Also, are you altering your clock configurations at all in your initialization? 

    Best Regards,

    Allison