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.

TMS320F28377D: Regarding SFO function

Part Number: TMS320F28377D

Hi,

We are using HRPWM in both channel A and B with up-down mode in TMS320F28377D. For that we explore the SFO_v8_fpu_lib_build_c28.lib.

Is it necessary to call SFO() function in while as shown below.


while(status == SFO_INCOMPLETE) // Call until complete { status = SFO(); if (status == SFO_ERROR) { error(); } }

Regards,

Himanshu

  • Hi Himanshu,

    Yes, it is strongly recommended to run SFO calibration before using the HRPWM. The SFO function calculates the MEP scale factor necessary for correct edge positioning. The code you've shown is the right usage.

    If you haven’t already, you can check the SFO appendix in the TRM’s HRPWM chapter for more details.

    Regards,
    Elizabeth
  • Hi,

    Thank you for your kind response.

    I already done before starting the initialization of EPWM/HRPWM. and also call it at after every 1 min.

    But it is required in while() loop? I done it as below.

    		status = SFO_INCOMPLETE;
    
    		//while (status == SFO_INCOMPLETE)
    		{
    			status = SFO();
    		}

    Is it right or necessary to call in while loop?

    Regards,

    Himanshu

  • Hi Himanshu,

    No, SFO() is not required to be called in every iteration of the control loop.

    From the SFO appendix:
    “The repetition rate at which an SFO function needs to be executed depends on the application's operating environment. As with all digital CMOS devices, temperature and supply voltage variations have an effect on MEP operation. However, in most applications these parameters vary slowly and therefore it is often sufficient to execute the SFO function once every 5 to 10 seconds. If more rapid variations are expected, then execution may have to be performed more frequently to match the application.”

    So if there are no substantial variations in temperature or voltage, the application may only have to complete SFO calibration once to calculate a scale factor that is appropriate for a long time. 1 minute may be often enough for your app, but you can also change to every 10s if you see that's not enough.

    Regards,
    Elizabeth
  • hi,

    We know everything that you are saying. But my point is different.

    I can not call SFO() function in while loop for calibration after initialization. so I change it as shown below.

    status = SFO_INCOMPLETE;
    
     
    //while (status == SFO_INCOMPLETE)
    {
        status = SFO();
    }

    Is it required to call SFO() function in while loop??

  • No, it doesn't have to be in that while loop. It's important to have the while loop for initialization to check that calibration has finished.

    After initialization, you can have only the SFO() call periodically and don't need to check the complete status. But it is good to check if status is SFO_ERROR and handle the error if needed.

    Regards,
    Elizabeth