Update repo

This commit is contained in:
hangpersonal committed 2026-08-30 23:04:35 -07:00
1 parent 749dab5721
commit ce65a0f59a
14950 files changed
+4408250 -1

No files matched your search

@@ -0,0 +1,74 @@
//###########################################################################
//
// FILE: SFO_V8.H
//
// TITLE: Scale Factor Optimizer Library V8 Interface Header
// This header provides the function call interface for the scale
// factor optimizer
//
//###########################################################################
//
// $Release Date: $
// $Copyright:
// Copyright (C) 2014-2024 Texas Instruments Incorporated - http://www.ti.com/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the
// distribution.
//
// Neither the name of Texas Instruments Incorporated nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// $
//###########################################################################
#ifndef _SFO_V8_H
#define _SFO_V8_H
#ifdef __cplusplus
extern "C" {
#endif
//
// Defines
//
#define PWM_CH_MAX 8 // Equals # of HRPWM modules in the device
#define SFO_INCOMPLETE 0
#define SFO_COMPLETE 1
#define SFO_ERROR 2
//
// Function Prototypes
//
int SFO(void); // SFO V8 Calibration Function
#endif // End: Multiple include Guard
#ifdef __cplusplus
}
#endif /* extern "C" */
//
// End of file
//
@@ -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