Update repo
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: SFO_V8.H
|
||||
//
|
||||
// TITLE: Scale Factor Optimizer Library V8 Interface Header
|
||||
// This header provides the function call interface for the scale
|
||||
// factor optimizer
|
||||
//
|
||||
//#############################################################################
|
||||
//!
|
||||
//! Copyright: Copyright (C) 2023 Texas Instruments Incorporated -
|
||||
//! All rights reserved not granted herein.
|
||||
//! Limited License.
|
||||
//!
|
||||
//! Texas Instruments Incorporated grants a world-wide, royalty-free,
|
||||
//! non-exclusive license under copyrights and patents it now or hereafter
|
||||
//! owns or controls to make, have made, use, import, offer to sell and sell
|
||||
//! ("Utilize") this software subject to the terms herein. With respect to the
|
||||
//! foregoing patent license, such license is granted solely to the extent that
|
||||
//! any such patent is necessary to Utilize the software alone. The patent
|
||||
//! license shall not apply to any combinations which include this software,
|
||||
//! other than combinations with devices manufactured by or for TI
|
||||
//! ("TI Devices").
|
||||
//! No hardware patent is licensed hereunder.
|
||||
//!
|
||||
//! Redistributions must preserve existing copyright notices and reproduce this
|
||||
//! license (including the above copyright notice and the disclaimer and
|
||||
//! (if applicable) source code license limitations below) in the documentation
|
||||
//! and/or other materials provided with the distribution.
|
||||
//!
|
||||
//! Redistribution and use in binary form, without modification, are permitted
|
||||
//! provided that the following conditions are met:
|
||||
//!
|
||||
//! * No reverse engineering, decompilation, or disassembly of this software is
|
||||
//! permitted with respect to any software provided in binary form.
|
||||
//! * Any redistribution and use are licensed by TI for use only
|
||||
//! with TI Devices.
|
||||
//! * Nothing shall obligate TI to provide you with source code for the
|
||||
//! software licensed and provided to you in object code.
|
||||
//!
|
||||
//! If software source code is provided to you, modification and redistribution
|
||||
//! of the source code are permitted provided that the following conditions
|
||||
//! are met:
|
||||
//!
|
||||
//! * any redistribution and use of the source code, including any resulting
|
||||
//! derivative works, are licensed by TI for use only with TI Devices.
|
||||
//! * any redistribution and use of any object code compiled from the source
|
||||
//! code and any resulting derivative works, are licensed by TI for use
|
||||
//! only with TI Devices.
|
||||
//!
|
||||
//! Neither the name of Texas Instruments Incorporated nor the names of its
|
||||
//! suppliers may be used to endorse or promote products derived from this
|
||||
//! software without specific prior written permission.
|
||||
//#############################################################################
|
||||
|
||||
#ifndef _SFO_V8_H
|
||||
#define _SFO_V8_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define SFO_INCOMPLETE 0
|
||||
#define SFO_COMPLETE 1
|
||||
#define SFO_ERROR 2
|
||||
|
||||
#define PWM_CH_MAX 8 // Equals # of HRPWM modules in the device
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
int SFO(void); // SFO V8 Calibration Function
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* extern "C" */
|
||||
|
||||
#endif // End: Multiple include Guard
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,92 @@
|
||||
The SFO library implements Scale Factor Optimization routine to drive the micro-edge positioner (MEP) calibration
|
||||
module to run SFO diagnostics and determine the appropriate MEP scale factor (number of MEP steps per coarse EPWMCLK
|
||||
step) for a device at any given time. Both driverlib & bit-field based libs are added in COFF & EABI format for
|
||||
legacy reasons.
|
||||
|
||||
FILES INCLUDED:
|
||||
1. SFO lib Bit-field implementation in COFF format - SFO_v8_fpu_lib_build_c28_coff.lib
|
||||
2. SFO lib Bit-field implementation in EABI format - SFO_v8_fpu_lib_build_c28_eabi.lib
|
||||
3. Index lib for Bit-field based SFO lib - SFO_v8_fpu_lib_build_c28.lib
|
||||
4. SFO lib Driverlib implementation in COFF format - SFO_v8_fpu_lib_build_c28_driverlib_coff.lib
|
||||
5. SFO lib Driverlib implementation in EABI format - SFO_v8_fpu_lib_build_c28_driverlib_eabi.lib
|
||||
6. Index lib for Driverlib based SFO lib - SFO_v8_fpu_lib_build_c28_driverlib.lib
|
||||
|
||||
INDEX LIBRARY USAGE
|
||||
User can link to either Bit-field or Driverlib based Index SFO library in
|
||||
their example wherein, based on the example build configuration(eabi or coff)
|
||||
appropriate library will be linked.
|
||||
|
||||
SOFTWARE USAGE DETAILS FOR DRIVERLIB BASED SFO LIB
|
||||
1. Add "Include" Files:
|
||||
Include sfo_v8.h header file in application code apart for the other device
|
||||
specific files.
|
||||
E.g. #include "sfo_v8.h"
|
||||
|
||||
2. Variable Declarations:
|
||||
The application needs to declare below variables to provide EPWM instance
|
||||
addresses used in SFO lib and to capture calibration status & output.
|
||||
E.g. uint16_t status = SFO_INCOMPLETE;
|
||||
uint32_t MEP_ScaleFactor = 0; //scale factor value
|
||||
volatile uint32_t ePWM[(PWM_CH + 1)] = {0, EPWM1_BASE, EPWM2_BASE};
|
||||
|
||||
3. MEP_ScaleFactor Initialization:
|
||||
Prior to using the MEP_ScaleFactor variable in application code, SFO() should
|
||||
be called to drive the MEP calibration module to calculate an initial
|
||||
MEP_ScaleFactor value.
|
||||
E.g.
|
||||
while(status == SFO_INCOMPLETE)
|
||||
{
|
||||
status = SFO();
|
||||
if(status == SFO_ERROR)
|
||||
{
|
||||
//
|
||||
// SFO function returns 2 if an error occurs & # of MEP
|
||||
// steps/coarse step exceeds maximum of 255.
|
||||
//
|
||||
error();
|
||||
}
|
||||
}
|
||||
|
||||
4. Application Code
|
||||
While the application is running, fluctuations in both device temperature and supply voltage may be
|
||||
expected. To be sure that optimal Scale Factors are used for each ePWM module, the SFO function
|
||||
should be re-run periodically as part of a slower back-ground loop. Some examples of this are shown
|
||||
here. E.g.
|
||||
void main ()
|
||||
{
|
||||
int status;
|
||||
// User code
|
||||
// ePWM1, 2, 3, 4 are running in HRPWM mode
|
||||
// The status variable returns 1 once a new MEP_ScaleFactor has been
|
||||
// calculated by the MEP Calibration Module running SFO
|
||||
// diagnostics.
|
||||
status = SFO();
|
||||
if(status == SFO_ERROR)
|
||||
{
|
||||
//
|
||||
// SFO function returns 2 if an error occurs & # of
|
||||
// MEP steps/coarse step exceeds maximum of 255.
|
||||
//
|
||||
error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SOFTWARE USAGE DETAILS FOR BIT-FIELD BASED SFO LIB
|
||||
1. Add "Include" Files:
|
||||
Include sfo_v8.h header file in application code apart for the other device
|
||||
specific files.
|
||||
E.g. #include "sfo_v8.h"
|
||||
|
||||
2. Variable Declarations:
|
||||
The application needs to declare below variables to provide EPWM instance
|
||||
addresses used in SFO lib and to capture calibration status & output.
|
||||
E.g. Uint16 status = SFO_INCOMPLETE;
|
||||
int MEP_ScaleFactor = 0; //scale factor value
|
||||
volatile struct EPWM_REGS *ePWM[] = {0, &EPwm1Regs, &EPwm2Regs};
|
||||
|
||||
3. MEP_ScaleFactor Initialization:
|
||||
Refer to Driverlib section
|
||||
|
||||
4. Application Code
|
||||
Refer to Driverlib section
|
||||
Reference in New Issue
Block a user