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.

SFO_MepDis_V5

Other Parts Discussed in Thread: TMS320F28335, CONTROLSUITE

PC: windows7

IDE: Code Composer  4.2.0.10018 

DSP: TMS320F28335

SFO lib: SFO_TI_Build_V5B.lib

I have two ePWM's (#4 and #5) running in HRPWM mode.  Therefore, when I need to calibrate the MEP scale factor, I have that runs in the background:

while (SFO_MepDis_V5(1) == 0);

On the first pass through the task, MEP_ScaleFactor[1] is set to something like 45, which is OK.  However, all subsequent passes have MEP_ScaleFactor[1] set to 0x7FFF.  What's going on here?

Here gives my code:

void main()

{

......

EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0;
EDIS;

for(i=0;i<PWM_CH;i++)
{
      MEP_ScaleFactor[i] =0;
}

// MEP_ScaleFactor variables intialization using SFO_MepDis_V5 library function.

for(i=1;i<PWM_CH;i++)
{
      while ( SFO_MepDis_V5(i) == SFO_INCOMPLETE ); // returns "0" when cal. incomplete for channel
}
// Initialize a common seed variable MEP_ScaleFactor[0] required for all SFO functions

MEP_ScaleFactor[0] = MEP_ScaleFactor[1];

InitEPwm();      // only EPWM4、EPWM5 run in HRPWM mode, others(EPWM1、2、3 run in normal mode, EPWM 6 is not used)

EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1;
EDIS;

.....

for(; ; )

{

      while ( SFO_MepDis_V5(1) == SFO_INCOMPLETE );        // here MEP_ScaleFactor[1] becoms 0x7FFF, what's wrong?

}

.....

}