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.

Piccolo HRPWM and SFO(), *ePWM[PWM_CH]

Other Parts Discussed in Thread: TMS320F28377D

Hi,


we are using HRPWM with SFO (SFO_TI_Build_V6b.lib) on a Piccolo 28035 and have the following question(s) that does not seem to be clear from documentation:

When using SFO, we need to add some variables (*ePWM[PWM_CH], MEP_ScaleFactor) amd adapt the define PWM_CH.

- What exactly is the value the define PWM_CH has to be set to? Number of PWM channels on used Piccolo device? Number of used HRPWM channels?

This is quite inconsistent throughout the examples.

- How has the *ePWM[PWM_CH] array to be initialized? With all PWM modules on used Piccolo device? With all PWM Modules used as HRPWM PWM in the application? Only with PWMModule1 - since the fine step increment for all PWM is set by the HRMSTEP of EPwm1?

Please clarify.

Thanks, Stephan

  • Hi Stephan,

    The PWM_CH should be defined as the maximum number of ePWM modules available on your part series + 1.  So if the F28035 has 7 ePWM modules available on the 80 pin package but only 4 ePWM modules on the 56 pin package, you would still set PWM_CH = 9 (8 + 1) for both packages.  This is because the SFO has a loop which goes through and sets values for the different ePWM modules which may not be sequentially ordered on the smaller packages.  If there are any which don't exist then those writes will just not have any effect.

    Hopefully this clears things up.

    Thanks,

    Kris

  • Hi Kris,

    thanks for the answer. There are still some questions:

    I think you mean PWM_CH=8 for the 7 ePWM modules on the 80 pin package!?

    Are there any other (internal) values set by SFO than HRMSTEP which is obviously only present on ePWMModule1?

    How has the *ePWM[PWM_CH] array to be initialized? With all PWM modules on used Piccolo device? With all PWM Modules used as HRPWM PWM in the application? Only with PWMModule1 - since the fine step increment for all PWM is set by the HRMSTEP of EPwm1?
    We actually have
    *ePWM[PWM_CH] = {&PWMModule1, &PWMModule1};
    for the HRMSTEP reason. Do we have to change it to
    *ePWM[PWM_CH] = {&PWMModule1, &PWMModule1, &PWMModule2, &PWMModule3, &PWMModule4, &PWMModule5, &PWMModule6, &PWMModule7};
    even if not all PWMModules are used with HRPWM?

    Thanks,
    Stephan
  • Stephan,

    Yes, sorry.  It should be 8 (7 + 1).  I dug into the code a bit, if you want to be safe you can declare all of the modules on the device:

    *ePWM[PWM_CH] = {&PWMModule1, &PWMModule1, &PWMModule2, &PWMModule3, &PWMModule4, &PWMModule5, &PWMModule6, &PWMModule7};

    and set PWM_CH = 8.

    The reason the array is done that way is the index of the array aligns with the ePWM number you would be calibrating.  For example, if you wanted to run the SFO on ePWM-5 it would be *ePWM[5].  Index 0 is ePWM-1 because this is where the calibration registers are.  It's simply a convenience to have all of the ePWMs available for easy use in the examples.

    Most people use the DCAL calibration logic since it doesn't tie up a HRPWM channel. It looks like you can declare the array however you choose, just understand that if you are choosing a channel to calibrate, that channel is resolving to the index of the ePWM array.  So if you declared it as 

    {&PWMModule1, &PWMModule5, &PWMModule6, &PWMModule7};

    and set your calibration channel to '1' you would be running the SFO on ePWM-5.

    Let me know if that helps clear things up.

    Thanks,

    Kris

  • Hi Kris,

    thank you, I think it is clear now.
  • I don't understand ...
    I'm using TMS320F28377D and I want to use MEP only for EPwm1.
    So I have to:

    1. link to "SFO_v8_fpu_lib_build_c28.lib"
    2. add global "int MEP_ScaleFactor;"
    3. add global "volatile struct EPWM_REGS *ePWM[PWM_CH] = {&EPwm1Regs, &EPwm1Regs};"
    4. "#define PWM_CH 2"

    Is it right ?
  • Hello Mauro,

    You have replied to a thread that is no longer active. Please create a new forum post.

    Best Regards,
    Adam Dunhoft