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.

TMS320F28379D: SFO function

Part Number: TMS320F28379D


Hi, I have below questions.

1. because the user doesn't know how many MEP steps per coarse step, so we should call SFO function to know this information, right? And this information is installed in the variable called MEP_ScaleFactor, right? Can the user specify how many MEP steps per coarse step?

2. I see below codes in an example, they define MEP_ScaleFactor in a source code before main(), so every time we use SFO(), we should define a variable called MEP_ScaleFactor? The SFO() can recognize the variable as long as its name is MEP_ScaleFactor, right?

int MEP_ScaleFactor; // Global variable used by the SFO library
// Result can be used for all HRPWM channels
// This variable is also copied to HRMSTEP
// register by SFO() function.

3. When we configure CMPAHR register, we should know the value of MEP_ScaleFactor so we should call the function SFO(), right? If we enable auto conversion, do we still need to call function SFO()?

4. when calculating number of MEP steps, why should we add 0.5? And what does rounding mean in the below picture? Is it the same as the function round(3.1415926,2)=3.14?

Thank you.

  • Hello,

    1. Yes, the appropriate value for MEP steps calculated by SFO() is stored in MEP_ScaleFactor. Yes, the user can write a desired value, but when SFO() is called again, MEP_ScaleFactor may be updated again.
    2. Yes, the SFO() expects a global variable with the name MEP_ScaleFactor.
    3. Yes, SFO() must still be called to update MEP_ScaleFactor. Enabling auto conversion will automatically write the MEP_ScaleFactor value to the HRMSTEP register
    4. Adding 0.5 in the shown calculation should generally result in the number of MEP steps to be a whole number that can then be used to determine the CMPAHR value.

    Regards,
    Elizabeth