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.
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
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