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.
Hello,
I am using SFO_v8_fpu_lib_build_c28.lib and based on the TRM and the code examples I declare which ePWM modules are going to use HRPWM in an array like so:
volatile struct EPWM_REGS *ePWM[] = {0, &EPwm1Regs, &EPwm2Regs, &EPwm3Regs, &EPwm4Regs};
However no matter what I put in the ePWM array the SFO() function seems to never access the contents of the ePWM array.
Furthermore I can see from the disassembly window that a global variable called SFO_CAL is used to index the ePWM array and as far as I can telle that variable is never written by SFO() so the calibration routine cannot read anything else than the first element of the array which is zero.
So my question is: why do I need to define the ePWM array and is it really necessary?
Cheers,
Pierre
I also forgot to add that the SFO() function never writes in the global array named MEP_SF except at its very first address. Given how this array has 8 elements I suppose it has to do with the fact that there are 8 ePWM modules with HRPWM capability, but only the first one appears to be used.
Regards,
Pierre
Hi Nima,
Thank you, this is a very interesting topic since I am trying to understand the impact of SFO on CPU scheduling for my project. Of course given that you probably have access to the source code it should be easier for you to see what's going on.
I can only work with the compiled code but there are still some useful pieces of information here and there (debug information, register names, etc.) and I suspect that several parts of the SFO() function are never executed when I call the function in my F28379D program:
From what I can gather all this is dead code because SFO_CAL is set to zero the first time SFO() is called and this value never changes again.
Regards,
Pierre
You are correct. All of that is dead code. They were features supported in SFOv6b but since v7 none of those are used. In fact the storing and restoring of the CMPxHR are not needed in the v7. The *ePWM[] is not used but since it still exists in the source, it must be created in your application code. All calibration is done with ePWM1 and other than the fact that due to some delays in the code which uses the RPT NOP, interrupt may be delayed minimally.
Nima Eskandari
Pierre,
What Nima has stated is correct, to give you the "why" see below.
This function is largely legacy because of the limitations of certain diagnostic logic. On older devices it was necessary to shut down and dedicate an HRPWM channel for periodic calibration, this structure enabled the user to easily switch between the HRPWM channel that they wished to use to do this.(SFO V5)
Please define the structure similar to:
volatile struct EPWM_REGS *ePWM[PWM_CH] = { &EPwm1Regs, &EPwm1Regs, &EPwm2Regs, &EPwm3Regs, &EPwm4Regs, &EPwm5Regs, &EPwm6Regs, &EPwm7Regs, &EPwm8Regs};
And that is it, you will not need to preform any operations on this code.
Regards,
Cody