Specifications

www.ti.com
Software Usage
Step 4. MEP_ScaleFactor
After power up, the SFO_MepEn_V5(n) function needs a typical scale factor starting seed value in
MEP_ScaleFacter[0]. This value can be conveniently determined using one of the ePWM modules to run
the SFO_MepDis_V5(n) function prior to initializing the PWM settings for the application. The
SFO_MepDis_V5(n) function does not require a starting scale factor value.
As part of the one-time initialization code prior to using MEP_ScaleFactor, include the following:
Example 4. Initializing With a Scale Factor Value
//MEP_ScaleFactor varaibles initialized using function SFO_MepDis_V5
Uint16 i;
for(i=1; i<PWM_CH; i++) // for channels 1-16
{
while (SFO_MepDis_V5(i) == 0); // Calls MepDis unitl MEP_ScaleFactor updated
}
// initialize MEP_ScaleFactor[0] with a typical
// MEP seed value
// required for SFO_MepEn_V5
MEP_ScaleFactor[0] = MEP_ScaleFactor[1];
}
Step 5. Application Code
While the application is running, fluctuations in both device temperature and supply voltage may be
expected. To be sure that optimal scalee factors are used for each ePWM modules, the SFO function
should be re-run periodically as part of a slower background loop. Some examples of this are shown here
in the below example.
Example 5. SFO Function Calls
main()
{
Uint16 current_ch = 1; //keeps track of current HRPWM channel being calibrated
Uint16 status;
// user code
// Case 1: all ePWMs are running in HRPWM mode
// here, the minimum duty cycle limitation is 6 clock cycles
status = SFO_MepEn_V5(current_ch); // MepEn called here
if(status == 1) // if MEP_ScaleFactor has been updated
{
current_ch++; // move on to the next channel
}
else if( status == 2) // if MEP_ScaleFactor differs from
{ // MEP_ScaleFactor[0] seed by more than
error(); // +/-15, flag an error
}
if(current_ch == PWM_CH) // if last channel has been reached
{
current_ch=1; // go back to channel 1
}
// Case 2: All ePWMs except one are running in HRPWM mode.
// One of the ePWM channels (ePWM16 in this example is used
// for SFO_MepDis_V5 scale factor calibration.
// Here, the minimum duty cycle limitation is 3 clock cycles.
// HRPWM diagnostics circuitry is used to estimate the MEP steps
// with the assumption that all HRPWM channels behave similarly
// though they may not be identical
while( SFO_MepDis_V5(16) == 0); //wait until MEP_ScaleFactor[16] updates
39
SPRU924F April 2005 Revised October 2011 SFO Library Software - SFO_TI_Build_V5.lib
Submit Documentation Feedback
Copyright © 20052011, Texas Instruments Incorporated