This is the multi-page printable view of this section. Click here to print.
MCAL DRIVER
- 1: Adc Driver
- 1.1: Adc2_MDD
- 1.2: Adc_Common_MDD
- 1.3: Adc_MDD
- 1.4: Data Dictionary
- 1.5: Integration_Manual_ADC
- 2: Fee Driver
- 2.1: AutoSAR FEE Parameter Configuration
- 2.2: AutoSAR FEE Parameter Configuration_ind
- 2.3: AutoSAR FEE Parameter Configurations
- 2.4: AutoSAR FEE User Guide
- 2.5: AutoSAR FEE User Guide_ind
- 2.6: AutoSAR FEE User Guides
- 2.7: DataSheet_TMS570LS0714
- 2.8: DataSheet_TMS570LS0714_ind
- 2.9: DataSheet_TMS570LS0714s
- 2.10: DataSheet_TMS570LS1227
- 2.11: DataSheet_TMS570LS1227_ind
- 2.12: DataSheet_TMS570LS1227s
- 2.13: Fee_Review_Checklists
- 3: Flash Driver
- 3.1: F021_Flash_API_License_Agreement
- 3.2: F021_Flash_API_License_Agreement_ind
- 3.3: F021_Flash_API_License_Agreements
- 3.4: Release_Notes
- 3.5: Release_Notes_ind
- 3.6: Release_Notess
- 3.7: SPNA148
- 3.8: SPNA148_ind
- 3.9: SPNA148s
- 3.10: SPNU501F
- 3.11: SPNU501F_ind
- 3.12: SPNU501Fs
- 3.13: SPNZ210
- 3.14: SPNZ210_ind
- 3.15: SPNZ210s
1.1 - Adc2_MDD
Module – ADC2
High-Level Description
The ADC2 module shall control sampling and conversion of voltages from the hardware layer into digital signals.
Figures
Component Diagram
Variable Data Dictionary
For details on module input / output variable, refer to the Data Dictionary for the application. Input / output variable names are listed here for reference.
Module Inputs | Module Outputs |
---|---|
None | None |
Module Internal Variables
This section identifies the name, range and resolutions for module specific data created by this module. If there are no range restrictions on the variable, the term “FULL” is placed into the table for legal range.
Variable Name | Resolution | Legal Range (min) | Legal Range (max) | Software Segment |
---|---|---|---|---|
None |
User defined typedef definition/declaration
This section documents any user types uniquely used for the module.
Typedef Name | Element Name | User Defined Type | Legal Range (min) | Legal Range (max) |
---|---|---|---|---|
See Adc_MDD.doc for Adc subsystem types |
Constant Data Dictionary
Calibration Constants
This section lists the calibrations used by the module. For details on calibration constants, refer to the Data Dictionary for the application.
Constant Name |
---|
None |
Program(fixed) Constants
Embedded Constants
All embedded constants whose values are provided in Eng units will be evaluated to the equivalent counts by using the FPM_InitFixedPoint_m() macro within the #define statement.
Local
Constant Name | Resolution | Units | Value |
---|---|---|---|
D_GROUPEV_CNT_U8 | 1 | Counts | 0 |
D_GROUP1_CNT_U8 | 1 | Counts | 1 |
D_GROUP2_CNT_U8 | 1 | Counts | 2 |
D_NTCPARMBIT1_CNT_U8 | 1 | Counts | 2 |
D_ADC2EVTBUFSZ_CNT_U08 | 1 | Counts | Generated in Adc_Cfg.h |
D_ADC2G1BUFSZ_CNT_U08 | 1 | Counts | Generated in Adc_Cfg.h |
D_ADC2G2BUFSZ_CNT_U08 | 1 | Counts | Generated in Adc_Cfg.h |
D_ADC2EVSRC_CNT_U32 | 1 | Counts | Generated in Adc_Cfg.h |
D_ADC2G1SRC_CNT_U32 | 1 | Counts | Generated in Adc_Cfg.h |
D_ADC2G2SRC_CNT_U32 | 1 | Counts | Generated in Adc_Cfg.h |
D_ADC2NUMEVTCH_CNT_U08 | 1 | Counts | Generated in Adc_Cfg.h |
D_ADC2EVTCH_CNT_U32 | 1 | Counts | Generated in Adc_Cfg.h |
D_ADC2NUMG1CH_CNT_U08 | 1 | Counts | Generated in Adc_Cfg.h |
D_ADC2G1CH_CNT_U32 | 1 | Counts | Generated in Adc_Cfg.h |
D_ADC2NUMG2CH_CNT_U08 | 1 | Counts | Generated in Adc_Cfg.h |
D_ADC2G2CH_CNT_U32 | 1 | Counts | Generated in Adc_Cfg.h |
D_ADC2RSLTBASEADR_CNT_U32 | 1 | Counts | Generated in Adc_Cfg.h |
Global
This section lists the global constants used by the module. For details on global constants, refer to the Data Dictionary for the application.
Constant Name |
---|
None |
Module specific Lookup Tables Constants
Constant Name | Resolution | Value | Software Segment |
---|---|---|---|
T_Adc2GroupConfigData_Cnt_Str[3] | Adc_GroupConfigDataType | { D_ADC2NUMEVTCH_CNT_U08, D_ADC2EVTCH_CNT_U32, &(((uint32*)D_ADC2RSLTBASEADR_CNT_U32)[0]), }, { D_ADC2NUMG1CH_CNT_U08, D_ADC2G1CH_CNT_U32, &(((uint32*)D_ADC2RSLTBASEADR_CNT_U32)[D_ADC2EVTBUFSZ_CNT_U08]), }, { D_ADC2NUMG2CH_CNT_U08, D_ADC2G2CH_CNT_U32, &(((uint32*)D_ADC2RSLTBASEADR_CNT_U32)[D_ADC2EVTBUFSZ_CNT_U08 + D_ADC2G1BUFSZ_CNT_U08]), } | CONST_32 |
Functions/Macros used by the Sub-Modules
Library Functions / Macros
The library and functions / Macros that are called by the various sub modules are identified below,
None
Data Hiding Functions
Global Functions/Macros Defined by this Module
ADC2 Init
Function Name | Adc2_init1 | Type | Min | Max | UTP Tol. |
---|---|---|---|---|---|
Arguments Passed | ConfigPtr | Adc_ConfigType* | N/A | N/A | |
Return Value | N/A |
This function is used to initialize each of the ADC2 Groups (Event, Group1, and Group2).
Initialize Module Internal Variables
None
Register Configuration
Start Initial Conversions
Start Group Conversion
Function Name | Adc2_StartGroupConversion | Type | Min | Max | UTP Tol. |
---|---|---|---|---|---|
Arguments Passed | group | uint8 | 0 | 2 | |
Return Value | N/A |
This function starts a software triggered conversion of all channels of the requested Adc channel group.
Start Conversions
Enable Group Notification
Function Name | Adc2_EnableGroupNotification | Type | Min | Max | UTP Tol. |
---|---|---|---|---|---|
Arguments Passed | group | uint8 | 0 | 15 | |
Return Value | N/A |
This inline function reads and returns the individual channel conversion result.
Enable Notification Conditions
Local Functions/Macros Used by this MDD only
Read Channel Conversions
Function Name | Adc2_ReadConversion | Type | Min | Max | UTP Tol. |
---|---|---|---|---|---|
Arguments Passed | ConvId | uint16 | 0 | 15 | |
Return Value | conversion result | uint16 | 0 | 4095 | 0 |
This inline function reads and returns the individual channel conversion result.
Read Group
Software Module Implementation
Runtime Environment (RTE) Initial Values
None
Initialization Functions
None
Periodic Functions
None
Fault Recovery Functions
None
Shutdown Functions
None
Interrupt Functions
None
Serial Communication Functions
None
Transition Functions
None
Execution Requirements
Execution Sequence of the Module
Adc2_Init should be called after SystemTime_Init due to the use of the uS System Time.
Adc2_Init should be called prior to MtrCtrl ISR being enabled.
Execution Rates for sub-modules called by the Scheduler
This table serves as reference for the Scheduler design
Function Name | Calling Frequency | System State(s) in which the function is called |
---|---|---|
Adc2_Init | Once (at initialization) | STARTUP |
Execution Requirements for Serial Communication Functions
Function Name | Sub-Module called by (Serial Comm Function Name) |
---|---|
N/A |
Memory Map Definition Requirements
Sub Modules (Functions)
This table identifies the software segments for functions identified in this module.
Name of Sub Module | Software Segment |
---|---|
Adc2_Init | ADC2_START_SEC_CODE |
Adc2_StartGroupConversion | ADC2_START_SEC_CODE |
Adc2_EnableGroupNotification | ADC2_START_SEC_CODE |
Adc2_ReadConversion | inline |
Local Functions
This table identifies the software segments for local functions identified in this module.
Name of Sub Module | Software Segment |
---|---|
None |
Known Issues / Limitations With Design
INLINE functions defined in “GlobalMacro.h” are not unit tested
Revision Control Log
Item # | Rev # | Change Description | Date | Author Initials |
---|---|---|---|---|
1 | 1.0 | Initial version based on FDD 33C rev 006 | 05Nov12 | LN |
2 | 2.0 | Design updates to meet FDD and simplify configuration | 24APR13 | Selva |
3 | 3.0 | Fixed typo in flowchart | 22MAY13 | LWW |
1.2 - Adc_Common_MDD
Module -- Adc Core
High-Level Description
The Adc Common module provides “stateless” application context independent functions which provide functionality required by both the Adc and Adc2 modules. In order to operate in any given application, the function design must not write to any fixed static variable location, unless it is in Globally shared memory. All static variable writes outside of Globally shared memory must be performed via pointer access where the caller provides the pointer reference to allowed writable memory in the application context from with the caller is executing.
The motivation for creating core functions is to reduce duplication and testing of common code design.
Figures
Component Diagram
None
Variable Data Dictionary
For details on module input / output variable, refer to the Data Dictionary for the application. Input / output variable names are listed here for reference.
Module Inputs | Module Outputs |
---|---|
None | None |
Module Internal Variables
This section identifies the name, range and resolutions for module specific data created by this module. If there are no range restrictions on the variable, the term “FULL” is placed into the table for legal range.
Variable Name | Resolution | Legal Range (min) | Legal Range (max) | Software Segment |
---|---|---|---|---|
None |
User defined typedef definition/declaration
This section documents any user types uniquely used for the module.
Typedef Name | Element Name | User Defined Type | Legal Range (min) | Legal Range (max) |
---|---|---|---|---|
None |
Constant Data Dictionary
Calibration Constants
This section lists the calibrations used by the module. For details on calibration constants, refer to the Data Dictionary for the application.
Constant Name |
---|
None |
Program(fixed) Constants
Embedded Constants
All embedded constants whose values are provided in Eng units will be evaluated to the equivalent counts by using the FPM_InitFixedPoint_m() macro within the #define statement.
Local
Constant Name | Resolution | Units | Value |
---|---|---|---|
D_NUMOFADCCALREADS_CNT_U8 | 1 | Counts | 8 |
Global
This section lists the global constants used by the module. For details on global constants, refer to the Data Dictionary for the application.
Constant Name |
---|
D_FALSE_CNT_LGC |
D_TRUE_CNT_LGC |
Module specific Lookup Tables Constants
Constant Name | Resolution | Value | Software Segment |
---|---|---|---|
None |
Functions/Macros used by the Sub-Modules
Library Functions / Macros
The library and functions / Macros that are called by the various sub modules are identified below,
None
Data Hiding Functions
<None>
Global Functions/Macros Defined by this Module
Offset Calibration
Function Name | ADCOffsetCalibration | Type | Min | Max | UTP Tol. |
---|---|---|---|---|---|
Arguments Passed | adcREG | adcctrlregs_t* | FULL | FULL | |
Return Value | Status_Cnt_T_u08 | uint8 | FULL | FULL |
Perform the ADC Calibration and Storing of offset.
Calibration Offset
Local Functions/Macros Used by this MDD only
Software Module Implementation
Runtime Environment (RTE) Initial Values
None
Initialization Functions
None
Periodic Functions
None
Fault Recovery Functions
None
Shutdown Functions
None
Interrupt Functions
None
Serial Communication Functions
None
Transition Functions
None
Execution Requirements
Execution Sequence of the Module
No integration scheduling required. The only service offered by this module has a fixed scheduling within the Adc subsystem.
Execution Rates for sub-modules called by the Scheduler
This table serves as reference for the Scheduler design
Function Name | Calling Frequency | System State(s) in which the function is called |
---|---|---|
None |
Execution Requirements for Serial Communication Functions
Function Name | Sub-Module called by (Serial Comm Function Name) |
---|---|
N/A |
Memory Map Definition Requirements
Sub Modules (Functions)
This table identifies the software segments for functions identified in this module.
Name of Sub Module | Software Segment |
---|---|
ADCOffsetCalibration | ADC_START_SEC_CODE |
Local Functions
This table identifies the software segments for local functions identified in this module.
Name of Sub Module | Software Segment |
---|---|
Known Issues / Limitations With Design
INLINE functions defined in “GlobalMacro.h” are not unit tested
Revision Control Log
Item # | Rev # | Change Description | Date | Author Initials |
---|---|---|---|---|
1 | 1.0 | Initial version | 24Apr13 | Selva |
1.3 - Adc_MDD
Module -- ADC
High-Level Description
The ADC module shall control sampling and conversion of voltages from the hardware layer into digital signals. The ADC Register definition has been captured from the TMS570LS31x/21x 16/32-Bit RISC Flash Microcontroller Technical Reference Manual (SPNU499 – September 2011).
Figures
Component Diagram
Variable Data Dictionary
For details on module input / output variable, refer to the Data Dictionary for the application. Input / output variable names are listed here for reference.
Module Inputs | Module Outputs |
---|---|
None | None |
Module Internal Variables
This section identifies the name, range and resolutions for module specific data created by this module. If there are no range restrictions on the variable, the term “FULL” is placed into the table for legal range.
Variable Name | Resolution | Legal Range (min) | Legal Range (max) | Software Segment |
---|---|---|---|---|
None |
User defined typedef definition/declaration
This section documents any user types uniquely used for the module.
Typedef Name | Element Name | User Defined Type | Legal Range (min) | Legal Range (max) |
---|---|---|---|---|
Adc_GroupType | N/A | uint8 | 0 | 2 |
Adc_GroupConfigDataType | uint8 NumOfChannels, uint32 ChannelSelect, uint32* ResultBuf | struct | FULL | FULL |
Adc_StatusType | ADC_IDLE, ADC_BUSY, ADC_COMPLETED, ADC_STREAM_COMPLETED | enum | 0 | 3 |
Adc_ValueGroupType | N/A | uint16 | 0 | 4095 |
Adc_ValueGroupType | N/A | uint16* | FULL | FULL |
Constant Data Dictionary
Calibration Constants
This section lists the calibrations used by the module. For details on calibration constants, refer to the Data Dictionary for the application.
Constant Name |
---|
k_VbattOVTransIntConfig_Cnt_u32 |
Program(fixed) Constants
Embedded Constants
All embedded constants whose values are provided in Eng units will be evaluated to the equivalent counts by using the FPM_InitFixedPoint_m() macro within the #define statement.
Local
Constant Name | Resolution | Units | Value |
---|---|---|---|
D_NUMOFGROUPS_CNT_U8 | 1 | Counts | 3 |
D_GROUPEV_CNT_U8 | 1 | Counts | 0 |
D_GROUP1_CNT_U8 | 1 | Counts | 1 |
D_GROUP2_CNT_U8 | 1 | Counts | 2 |
D_NUMOFADCCALREADS_CNT_U8 | 1 | Counts | 8 |
D_NTCPARMBIT0_CNT_U8 | 1 | Counts | 1 |
D_NTCPARMBIT1_CNT_U8 | 1 | Counts | 2 |
D_NTCPARMBIT2_CNT_U8 | 1 | Counts | 4 |
D_ADC1RSLTBASEADR_CNT_U32 | 1 | Counts | 0xFF3E0000U |
D_ADC1NUMRSLTBUF_CNT_U08 | 1 | Counts | 64 |
D_ADC1CURRENTMODE_ULS_LGC | 1 | BOOLEAN | Generated in Adc_Cfg.h. |
D_ADC1MAGINTMASK1_CNT_U16 | 1 | Counts | 0/0* |
D_ADC1MAGINTASET_CNT_U16 | 1 | Counts | 1/0* |
D_ADC1MAGINTCR1_CNT_U32 | 1 | Counts | k_VbattOVTransIntConfig_Cnt_u32/ 0* |
D_ADC1THRINTENACLR_CNT_U16 | 1 | Counts | 6/7* |
D_ADC1EVTBUFSZ_CNT_U08 | 1 | Counts | Generated in Adc_Cfg.h. |
D_ADC1G1BUFSZ_CNT_U08 | 1 | Counts | Generated in Adc_Cfg.h. |
D_ADC1G2BUFSZ_CNT_U08 | 1 | Counts | Generated in Adc_Cfg.h. |
D_GROUPEND_CNT_U32 | 1 | Counts | Generated in Adc_Cfg.h. |
D_GROUPBUSY_CNT_U32 | 1 | Counts | Generated in Adc_Cfg.h. |
D_ADC1CURRENTMODE_ULS_LGC if True value 1 is selected to proceed. If not value 2 will be used,
Global
This section lists the global constants used by the module. For details on global constants, refer to the Data Dictionary for the application.
Constant Name |
---|
T_Adc1GroupConfigData_Cnt_Str[D_NUMOFGROUPS_CNT_U8] |
Module specific Lookup Tables Constants
Constant Name | Resolution | Value | Software Segment |
---|---|---|---|
None |
Functions/Macros used by the Sub-Modules
Library Functions / Macros
The library and functions / Macros that are called by the various sub modules are identified below,
None
Data Hiding Functions
<None>
Global Functions/Macros Defined by this Module
ADC Init
Function Name | Adc_Init_FixedCfg ( macro aliased is Adc_Init(x) ) | Type | Min | Max | UTP Tol. |
---|---|---|---|---|---|
Arguments Passed | None | N/A | N/A | N/A | |
Return Value | N/A |
This function is used to initialize each of the ADC1 Groups (Event, Group1, and Group2).
Initialize Module Internal Variables
None
Register Configuration
Setup Result Buffer
Function Name | Adc_SetupResultBuffer | Type | Min | Max | UTP Tol. |
---|---|---|---|---|---|
Arguments Passed | Group | Adc_GroupType | 0 | 2 | |
DataBufferPtr | Adc_ValueGroupRefType | FULL | FULL | ||
Return Value | N/A | Std_ReturnType | 0 | 0 | 0 |
This function is the Adc group result buffer setup service. It is responsible for setting up the result buffer pointer of the group.
This Api is provided to support for the standard Autosar API, however the design of this driver does not buffer an intermediate copy of the results and therefore does not require a result buffer. The hardware provides a sufficient Adc results buffer.
For optimization purposes, this function could be defined as a macro.
Setup Group’s Result Buffer
return E_OK
Start Group Conversion
Function Name | Adc_StartGroupConversion | Type | Min | Max | UTP Tol. |
---|---|---|---|---|---|
Arguments Passed | Group | Adc_GroupType | 0 | 2 | |
DataBufferPtr | Adc_ValueGroupRefType | FULL | FULL | ||
Return Value | N/A | Std_ReturnType | 0 | 0 | 0 |
This function starts a software triggered conversion of all channels of the requested Adc channel group.
In order to provide optimized execution of this single line function, this API should be defined as a macro, however, due to timing it is at the moment defined as a function. The need for minimal runtime is driven by a Nexteer use case which executes this in the context of the MtrCtrl ISR in some EPS systems.
Select Channels to Convert
adcREG1->GxSEL[Group] = T_Adc1GroupConfigData_Cnt_Str[Group].ChannelSelect
Get Group Status
Function Name | Adc_GetGroupStatus | Type | Min | Max | UTP Tol. |
---|---|---|---|---|---|
Arguments Passed | Group | Adc_GroupType | 0 | 2 | |
Return Value | ReturnVal_Cnt_T_Enum | Adc_StatusType | 0 | 3 | 0 |
Returns the conversion status of the requested ADC1 channel group.
Get Status
Read Group Conversions
Function Name | Adc_ReadGroup | Type | Min | Max | UTP Tol. |
---|---|---|---|---|---|
Arguments Passed | Group | Adc_GroupType | 0 | 2 | |
Return Value | ReturnVal_Cnt_T_Enum | Adc_StatusType | 0 | 3 | 0 |
Reads the group conversion result of the last completed conversion round of the requested group and
stores the channel values starting at the DataBufferPtr address. The group channel values are stored in ascending channel number order (in contrast to the storage layout of the result buffer if streaming access is configured).
Per the design direction in FDD33, direct ADC result buffer acces is used instead of using the hardware FIFO access register.
Read Group
Local Functions/Macros Used by this MDD only
Software Module Implementation
Runtime Environment (RTE) Initial Values
None
Initialization Functions
None
Periodic Functions
None
Fault Recovery Functions
None
Shutdown Functions
None
Interrupt Functions
None
Serial Communication Functions
None
Transition Functions
None
Execution Requirements
Execution Sequence of the Module
Adc_Init should be called after SystemTime_Init due to the use of the uS System Time.
Adc_Init should be called prior to IoHwAb_Init to ensure registers are configured prior to triggering initial conversions.
Execution Rates for sub-modules called by the Scheduler
This table serves as reference for the Scheduler design
Function Name | Calling Frequency | System State(s) in which the function is called |
---|---|---|
Adc_Init | Once (at initialization) | STARTUP |
Execution Requirements for Serial Communication Functions
Function Name | Sub-Module called by (Serial Comm Function Name) |
---|---|
N/A |
Memory Map Definition Requirements
Sub Modules (Functions)
This table identifies the software segments for functions identified in this module.
Name of Sub Module | Software Segment |
---|---|
Adc_Init | ADC_START_SEC_CODE |
Adc_SetupResultBuffer | ADC_START_SEC_CODE |
Adc_StartGroupConversion | ADC_START_SEC_CODE |
Adc_ReadGroup | ADC_START_SEC_CODE |
Adc_GetGroupStatus | ADC_START_SEC_CODE |
ADCOffsetCalibration | ADC_START_SEC_CODE |
Local Functions
This table identifies the software segments for local functions identified in this module.
Name of Sub Module | Software Segment |
---|---|
Known Issues / Limitations With Design
INLINE functions defined in “GlobalMacro.h” are not unit tested
Revision Control Log
Item # | Rev # | Change Description | Date | Author Initials |
---|---|---|---|---|
1 | 1.0 | Initial version based on FDD 33C rev 006 | 05Nov12 | LN |
2 | 2 | Constant confiuguration tables renamed to start with “T_” Rewored Adc_ReadGroup to provide direct fixed memory access as required in the FDD | 15Jan13 | JJW |
3 | 3 | Updated FDD 33C rev 007 and FDD33E rev2 | 25-April-13 | Selva |
1.4 - Data Dictionary
Overview
Change LogVariable Dictionary
Calibration Dictionary
Global Constants
Template
Help
Sheet 1: Change Log
Adc- Rev 1.0 | <- Global Program / Module Name | ||||||
Revision | Author | Date | Change Description | Data Dictionary Type: | Component | ||
1 | Selva | 26-Apr-12 | Updated to ver 02 FDD | ||||
Sheet 2: Variable Dictionary
Sheet 3: Calibration Dictionary
Sheet 4: Global Constants
Adc- Rev 1.0 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Variable Information (Global Variables Only) | Achieved in Software Design | Used in Module List | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Layer 2 | Layer 3 | Layer 4 | Layer 5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Constant Name | Description | Uints | Type | Engineering Value | ADC | ADC Diagnostics | Data Memory Verification | DC Link Power Control | DSP Computational Integrity | DSP SPI driver | Event Manager Driver | External Memory Driver | Flash Programming Exec | GPIO | Illegal OpCode Handler | Interrupt Handler | Motor Current Driver | Motor Driver Diagnostics | Motor Position Driver | Phase Feedback Capture | Powerdown Control | Primary Shutdown Control | Program Flow | Program Memory Diagnostic | PWM Duty Cycle | Redundant Memory Check | Redundant Rapid Shutdown | Scheduler | Stack Monitor | State Dependent Task List | System Boot & Startup | System Control | Temperature Sensor Diagnostic | Unused Interrupt Handler | Utilization Monitor | Watchdog Dirver | Smith | Battery Voltage | Battery Voltage Diagnostics | Diagnostic CTC Manager | Diagnostic Manager | Diagnostics Application Services | EOL TorqueTest | Flash Boot Loader | Flight Recorder | Handwheel Position | Handwheel Torque | Motor Control Output Conversion | Motor Position Diagnostics | Motor Position Initialization | Motor Velocity | Motor Velocity Tachometer | Serial Communications I/O | Serial Communications Services | States and Modes | Tuning Select | Vehicle Power Mode | Vehicle Speed | Controller Polarity | Current Estimation | Handwheel Velocity | Inverse Motor Model | Motor Temperature Estimation | Motor Torque Limit | Output Reasonableness Dianostic | Parameter Estimation | Quadrant and rate Detection | Active Pull Compensation | Assist | Damping | Duty Cycle | Kinematic Integrity Diagnostic | Long Term Vehicle Speed Diagnostic | Max Assist Limit | Return | State Output Control | Torque Output |
Sheet 5: Template
2.2a | Data File: | |||||
Header: | extern <TYPE><TAB><NAME>; | |||||
Source: | #pragma DATA_SECTION(<ROOTNAME>, "<SEGMENT>"); <TYPE> <NAME>; | |||||
EOL Constants: | ||||||
Header: | extern <TYPE><TAB><NAME>; | |||||
Source: | #pragma DATA_SECTION(<ROOTNAME>, "<SEGMENT>"); <TYPE> <NAME>; | |||||
Global (Embedded) Constants: | ||||||
Header: | #define <NAME><COL40><VALUE> | |||||
A2L Name | ||||||
Measurement: | rte_<SWC>_<NAME> | |||||
Calibration Constants: | ||||||
Tuning ID: | ||||||
Tuning: | N | Index Range: | ||||
Header: | extern CONST(<AUTOSAR_TYPE>, CAL_CONST) <NAME>; | |||||
Source: | #pragma DATA_SECTION(<ROOTNAME>, ".<SEGMENT>"); CONST(<AUTOSAR_TYPE>, CAL_CONST) <NAME> = <VALUE>; | |||||
eCal: | <NAME> | |||||
Tuning: | Y | Index Range: | ||||
Header: | <NONCRITICAL> #define <ROOTNAME><TAB>k_N_CalNC_Cnt_Str.<ROOTNAME> <NONCRITICAL> <SAFETYCRITICAL> #define <ROOTNAME><TAB>k_S_CalSC_Cnt_Str.<ROOTNAME> <SAFETYCRITICAL> | |||||
Source: | ||||||
eCal: | <NONCRITICAL> k_N_CalNC_Cnt_Str.<ROOTNAME> <NONCRITICAL> <SAFETYCRITICAL> k_S_CalSC_Cnt_Str.<ROOTNAME> <SAFETYCRITICAL> | |||||
Tuning: | P | Index Range: | ||||
Header: | <NONCRITICAL> #define <ROOTNAME><TAB>k_N_CalNC_Cnt_Str.Personality[L3_S_CalPersSelect_Cnt_G_u16].<ROOTNAME> <NONCRITICAL> <SAFETYCRITICAL> #define <ROOTNAME><TAB>k_S_CalSC_Cnt_Str.SC_Personality[L3_S_CalPersSelect_Cnt_G_u16].<ROOTNAME> <SAFETYCRITICAL> | |||||
Source: | ||||||
eCal: | <NONCRITICAL> k_N_CalNC_Cnt_Str.Personality[L3_S_CalPersSelect_Cnt_G_u16].<ROOTNAME> <NONCRITICAL> <SAFETYCRITICAL> k_S_CalSC_Cnt_Str.SC_Personality[L3_S_CalPersSelect_Cnt_G_u16].<ROOTNAME> <SAFETYCRITICAL> | |||||
Sheet 6: Help
Short cut | Macro | Sescription |
Ctrl-q | ClearDataDictFilter | Will clear all autofilters on the Global Data Dictionary |
DFD_Create | Creates a Series of Data Flow Worksheet Pages from the information in the data dictionary. If Data Flow Worksheet pages already exist, they will be deleted first. | |
DFD_Delete | Will clear all Data Flow Diagram pages from the Data Dictionary. This will make the file smaller for archiving. | |
DFD_Print | Formate and prepares to print the Data Flow Worksheet pages. |
1.5 - Integration_Manual_ADC
1.2 Configuration Files to be provided by Integration Project 2
1.3 Functions to be provided to Integration Project 2
Dependencies
SWCs
Module | Required Feature |
---|---|
Configuration Files to be provided by Integration Project
NOTE:
For Projects using 33E, make sure “D_ADC1CURRENTMODE_ULS_LGC” is defined Adc_Cfg.h file.
For Projects using 33C, make sure “D_ADC1CURRENTMODE_ULS_LGC” is NOT defined Adc_Cfg.h file.
Template for Configuration file:
Adc_Cfg.h
Adc2_Cfg.h
Functions to be provided to Integration Project
Adc2_ReadConversion
Adc2_Init1
Adc2_StartGroupConversion
Adc2_EnableGroupNotification
Adc_Init_FixedCfg
Adc_StartGroupConversion
Adc_ReadGroup
Adc_GetGroupStatus
Configuration
Build Time Config
Modules | Notes | |
---|---|---|
None |
Generator Config
Constant | Notes | SWC |
---|---|---|
None |
Integration
Global Data
None
Component Conflicts
IoHwAb
Include Path
$PROJECTPATH$\Adc\include
Adc.h, Adc2.h, Adc_Common.h
Configurator Changes
None
Runnable Scheduling
This section specifies the required runnable scheduling.
Init | Scheduling Requirements | Trigger |
---|---|---|
Adc_Init() | Before Adc2_Init1 initialization | ECU Startup |
Adc2_Init1() | Before PWMCdd initialization | ECU Startup |
Runnable | Scheduling Requirements | Trigger |
---|---|---|
Adc_StartGroupConversion | None | ISR |
*Note:
.
Memory Mapping
Mapping
Memory Section | Contents | Notes |
---|---|---|
ADC2_START_SEC_CODE | ||
ADC2_START_SEC_CONST_32 | ||
ADC_START_SEC_CONST_32 | ||
ADC_START_SEC_CODE |
* Each …START_SEC… constant is terminated by a …STOP_SEC… constant as specified in the AUTOSAR Memory Mapping requirements.
Usage
Feature | RAM | ROM |
---|---|---|
<Memmap usuage info> |
Revision Control Log
Rev # | Change Description | Date | Author |
---|---|---|---|
1 | Initial version | 09-Apr-13 | Selva |
2 - Fee Driver
Fee Driver
Component Documentation
- AutoSAR FEE Parameter Configuration.html
- AutoSAR FEE Parameter Configuration.pdf
- AutoSAR FEE Parameter Configuration_ind.html
- AutoSAR FEE Parameter Configurations.html
- AutoSAR FEE User Guide.html
- AutoSAR FEE User Guide.pdf
- AutoSAR FEE User Guide_ind.html
- AutoSAR FEE User Guides.html
- DataSheet_TMS570LS0714.html
- DataSheet_TMS570LS0714.pdf
- DataSheet_TMS570LS0714_ind.html
- DataSheet_TMS570LS0714s.html
- DataSheet_TMS570LS1227.html
- DataSheet_TMS570LS1227.pdf
- DataSheet_TMS570LS1227_ind.html
- DataSheet_TMS570LS1227s.html
- Fee_Review_Checklists.html
2.1 - AutoSAR FEE Parameter Configuration
2.2 - AutoSAR FEE Parameter Configuration_ind
Page 2
Page 3
Page 4
Page 5
Page 6
Page 7
Page 8
Page 9
Page 10
Page 11
Page 12
Page 13
Page 14
Page 15
Page 16
Page 17
Page 18
Page 19
Page 20
Page 21
Page 22
Page 23
Page 24
Page 25
Page 26
Page 27
Page 28
Page 29
Page 30
Page 31
2.3 - AutoSAR FEE Parameter Configurations

AutoSAR FEE Parameter Configuration (Rev 1.8)
AutoSAR FEE Parameter
Configuration Document
Texas Instruments Incorporated

AutoSAR FEE Parameter Configuration (Rev 1.8)
ABSTRACT
AutoSAR Flash EEPROM Emulation (AutoSAR FEE) driver utilizes Code Generation
Tool to generate the configuration parameters required for EEPROM emulation. Code
Generation Tool is used to configure parameters like which Flash Sectors to use, the
number of Blocks, Block Size etc. for EEPROM emulation. Code Generation Tool
generates two files (Fee_cfg.h & Fee_cfg.c) depending on the configuration.
This document describes the parameters used by Code Generation Tool to generate the
AutoSAR FEE Configuration parameters.
Texas Instruments Incorporated
2

AutoSAR FEE Parameter Configuration (Rev 1.8)
Revision History
Version Release
Author
Comment
Date
1.0
09/16/2012 Vishwanath Initial version
Reddy
1.1
10/10/2012 Vishwanath Add configuration parameter
Reddy
FEE_NUMBER_OF_VIRTUAL_SECTORS_EEP1
1.2
11/20/2012 Vishwanath Remove FeeSetModeSupported
Reddy
1.3
06/11/2013 Vishwanath Add configuration parameter’s:
Reddy
FEE_NUMBER_OF_UNCONFIGUREDBLOCKSTOCOPY,
FEE_NUMBER_OF_EIGHTBYTEWRITES
1.4
01/06/2014 Vishwanath Added configuration parameter
Reddy
FEE_CHECK_BANK7_ACCESS
1.5
09/25/2014 Vishwanath Configuration update to support TMS570LS05xx,
Reddy
TMS570LS07xx, TMS570LS09xx. Range updated for
FEE_VirtualSectorNumber, Virtual Sectors.
New configuration parameter
FEE_TOTAL_BLOCKS_DATASETS added.
1.6
12/31/2014 Vishwanath Add new Configuration parameters.
Reddy
FEE_VIRTUALSECTOR_SIZE,
FEE_PHYSICALSECTOR_SIZE,
FEE_GENERATE_DEVICEANDVIRTUALSECTORSTRUC
Note added in section 1.6 FEE Sector Configuration.
1.7
01/07/2015 Vishwanath Remove Device_Header.h from fee_cfg.h file.
Reddy
1.8
01/21/2015 Vishwanath Added comments for FEE_TOTAL_BLOCKS_DATASETS,
Reddy
FEE_NUMBER_OF_EEPS and
FEE_NUMBER_OF_BLOCKS
Configuration Changes
Parameter added/ Modified
Change
FeeCRCEnable
New
FeeWriteCounterSave
New
FeeNumberOfEEPS
New
FeeDevErrorDetect
New
FeeBlockOverhead
Changed to 0x18
FeeEEPNumber(in block configuration)
New
FeeNumberOfVirtualSectorsEEP1
New
FEE_NUMBER_OF_UNCONFIGUREDBLOCKSTOCOPY
New
Texas Instruments Incorporated
3

AutoSAR FEE Parameter Configuration (Rev 1.8)
FEE_NUMBER_OF_EIGHTBYTEWRITES
New
FEE_CHECK_BANK7_ACCESS
New
FEE_TOTAL_BLOCKS_DATASETS
New
FEE_VIRTUALSECTOR_SIZE
New
FEE_PHYSICALSECTOR_SIZE
New
FEE_GENERATE_DEVICEANDVIRTUALSECTORSTRUC New
Texas Instruments Incorporated
4

AutoSAR FEE Parameter Configuration (Rev 1.8)
Table of Contents
1
Introduction .............................................................................................................. 7
1.1
FEE Published information ............................................................................... 7
1.1.1
Block OverHead ......................................................................................... 7
1.1.2
Maximum Blocking Time ............................................................................ 7
1.1.3
Page OverHead ......................................................................................... 8
1.1.4
Sector OverHead ....................................................................................... 8
1.2
FEE General Settings ...................................................................................... 9
1.2.1
Virtual Page size ........................................................................................ 9
1.2.2
Driver Index................................................................................................ 9
1.2.3
Error Notification ...................................................................................... 10
1.2.4
End Notification ........................................................................................ 10
1.2.5
Frequency ................................................................................................ 11
1.2.6
Enable Polling mode ................................................................................ 11
1.2.7
Enable Error Correction ........................................................................... 12
1.2.8
Error Correction Handling ......................................................................... 12
1.2.9
Cyclic Redundancy Check ....................................................................... 13
1.2.10 Block Write counter save.......................................................................... 13
1.2.11 Number of EEPs ...................................................................................... 14
1.2.12 Development error Detect ........................................................................ 14
1.2.13 Non configured blocks to copy ................................................................. 15
1.2.14 Number of eight byte writes ...................................................................... 15
1.2.15 Check BANK7 Address Range ................................................................. 16
1.2.16 Total Blocks and Data Sets ...................................................................... 16
1.2.17 Generate Device and Virtual sector structures ......................................... 17
1.2.18 Required Virtual Sector Size .................................................................... 18
1.2.19 FEE bank Physical Sector Size ................................................................ 19
1.3
Number of Blocks .......................................................................................... 20
1.3.1
Blocks ...................................................................................................... 20
1.4
Number of Virtual Sectors .............................................................................. 20
1.4.1
Virtual Sectors .......................................................................................... 20
1.4.2
Virtual Sectors for EEP1........................................................................... 21
1.5
FEE functions ................................................................................................ 21
1.5.1
FEE_GetVersionInfo ................................................................................ 21
1.6
FEE Sector Configuration .............................................................................. 22
1.6.1
FEE_VirtualSectorConfiguration ............................................................... 22
1.6.1.1
FEE_VirtualSectorNumber ................................................................ 22
1.6.1.2
FEE_VirtualSectorBank .................................................................... 23
1.6.1.3
FEE_VirtualSectorStart ..................................................................... 23
1.6.1.4
FEE_VirtualSectorEnd ...................................................................... 24
1.6.2
Example Virtual Sector Configuration ....................................................... 25
1.7
FEE Block Configuration ................................................................................ 26
1.7.1
FEE Block Configuration .......................................................................... 26
1.7.1.1
FEE_BlockNumber............................................................................ 26
Texas Instruments Incorporated
5

AutoSAR FEE Parameter Configuration (Rev 1.8)
1.7.1.2
FEE_BlockSize ................................................................................. 27
1.7.1.3
FEE_NumberOfWriteCycles .............................................................. 27
1.7.1.4
FEE_UseImmediateData .................................................................. 28
1.7.1.5
FEE Device Index ............................................................................. 28
1.7.1.6
FeeNumberOfDataSets ..................................................................... 29
1.7.1.7
FEE EEP Number ............................................................................. 29
1.7.2
Example Block Configuration ................................................................... 30
1.8
Header Files .................................................................................................. 31
1.8.1
Header Files for Fee_cfg.h ....................................................................... 31
1.8.2
Header Files for Fee_cfg.c ....................................................................... 31
Texas Instruments Incorporated
6

AutoSAR FEE Parameter Configuration (Rev 1.8)
1 Introduction
The following sections describe each parameter in the Fee_ParamDef.axml file
used by Code Generation Tool and the corresponding configuration parameter
generated. Code Generation Tool generates two files (Fee_Cfg.c and Fee_cfg.h)
depending on the configuration values. This section describes each configuration
value in the above two files and their relation to the parameter defined in the
Fee_ParamDef.axml file.
1.1 FEE Published information
1.1.1 Block OverHead
Parameter defined in
Fee_ParamDef.axml
FeeBlockOverhead
Description
Indicates the number of bytes used for Block
Header.
Generated configuration
FEE_BLOCK_OVERHEAD is set to the value
assigned to FeeBlockOverhead.
Default Value
0x18
Parameter Range
Fixed to 0x18.
Parameter Type
uint8
Target file
Fee_cfg.h
1.1.2 Maximum Blocking Time
Parameter defined in
Fee_ParamDef.axml
FeeMaximumBlockingTime
Description
Indicates the maximum allowed blocking time for any
Fee call.
Generated configuration
FEE_MAXIMUM_BLOCKING_TIME is set to the
value assigned to FeeMaximumBlockingTime.
Default Value
600.00
Parameter Range
Fixed to 600 µs.
Parameter Type
float
Target file
Fee_cfg.h
Texas Instruments Incorporated
7

AutoSAR FEE Parameter Configuration (Rev 1.8)
1.1.3 Page OverHead
Parameter defined in
Fee_ParamDef.axml
FeePageOverhead
Description
Indicates the Page Overhead in bytes.
Generated configuration
FEE_PAGE_OVERHEAD is set to the value
assigned to FeePageOverhead. (0x0)
Default Value
0x0
Parameter Range
Fixed to 0x0.
Parameter Type
uint8
Target File
Fee_cfg.h
1.1.4 Sector OverHead
Parameter defined in
Fee_ParamDef.axml
FeeVirtualSectorOverhead
Description
Indicates the number of bytes used for Virtual Sector
Header.
Generated configuration
FEE_VIRTUAL_SECTOR_OVERHEAD is set to the
value assigned to FeeVirtualSectorOverhead (0x10).
Default Value
0x10
Parameter Range
Fixed to 0x10.
Parameter Type
uint8
Target File
Fee_cfg.h
Texas Instruments Incorporated
8

AutoSAR FEE Parameter Configuration (Rev 1.8)
1.2 FEE General Settings
1.2.1 Virtual Page size
Parameter defined in
Fee_ParamDef.axml
FeeVirtualPageSize
Description
Indicates the virtual page size in bytes.
Generated configuration
FEE_VIRTUAL_PAGE_SIZE is set to the value
assigned to FeeVirtualPageSize. (0x8)
Default Value
0x8
Parameter Range
Fixed to 0x8.
Parameter Type
uint8
Target File
Fee_cfg.h
1.2.2 Driver Index
Parameter defined in
Fee_ParamDef.axml
FeeIndex
Description
Instance ID of FEE module. Should always be 0x0.
Generated configuration
FEE_INDEX is set to the value assigned to
FeeIndex. (0x0)
Default Value
0x0
Parameter Range
Fixed to 0x0.
Parameter Type
uint8
Target File
Fee_cfg.h
Texas Instruments Incorporated
9

AutoSAR FEE Parameter Configuration (Rev 1.8)
1.2.3 Error Notification
Parameter defined in
Fee_ParamDef.axml
FeeNvmJobErrorNotification
Description
Call back function to notify a Job Error.
Generated configuration
FEE_NVM_JOB_ERROR_NOTIFICATION is set to
the defined function name. This is relevant only if
Polling mode is OFF.
Default Value
NvM_JobErrorNotification
Parameter Range
User defined function name.
Parameter Type
string
Target File
Fee_cfg.h
1.2.4 End Notification
Parameter defined in
Fee_ParamDef.axml
FeeNvmJobEndNotification
Description
Call back function to notify end of a Job.
Generated configuration
FEE_NVM_JOB_END_NOTIFICATION is set to the
defined function name. This is relevant only if Polling
mode is OFF.
Default Value
NvM_JobEndNotification
Parameter Range
User defined function name.
Parameter Type
string
Target File
Fee_cfg.h
Texas Instruments Incorporated
10

AutoSAR FEE Parameter Configuration (Rev 1.8)
1.2.5 Frequency
Parameter defined in
Fee_ParamDef.axml
FeeFrequency
Description
Device operating frequency in MHz.
Generated configuration
FEE_OPERATING_FREQUENCY is set to the value
assigned to FeeFrequency.
FeeFrequency is equivalent to the HCLK frequency
in the TMS570 clock tree.
It is recommended to copy the value of HCLK
obtained by configuring the TMS570 clock tree
during MCU configuration to this parameter.
Default Value
160.0
Parameter Range
Device dependent parameter. Refer to the device
datasheet to know the range.
Parameter Type
float
Target File
Fee_cfg.h
1.2.6 Enable Polling mode
Parameter defined in
Fee_ParamDef.axml
FeePollingMode
Description
Indicates if polling mode is enabled/disabled.
Generated configuration
FEE_POLLING_MODE is set to STD_ON if polling is
enabled else it is set to STD_OFF. Currently, this
parameter should be always STD_ON.
Default Value
STD_ON
Parameter Range
STD_ON/STD_OFF
Parameter Type
Boolean
Target File
Fee_cfg.h
Texas Instruments Incorporated
11

AutoSAR FEE Parameter Configuration (Rev 1.8)
1.2.7
Enable Error Correction
Parameter defined in
Fee_ParamDef.axml
FeeEnableErrorCorrection
Description
Indicates if error correction is enabled.
Generated configuration
FEE_FLASH_ERROR_CORRECTION_ENABLE
Is set to STD_ON if Error Correction is enabled else
it is set to STD_OFF. This parameter is not used
anymore.
Default Value
STD_OFF
Parameter Range
STD_ON/STD_OFF
Parameter Type
Boolean
Target File
Fee_cfg.h
1.2.8
Error Correction Handling
Parameter defined in
Fee_ParamDef.axml
FeeFlashErrCorrHandlingType
Description
Indicates desired action to be taken on detection of
bit errors.
Generated configuration
FEE_FLASH_ERROR_CORRECTION_HANDLING
is set to the value assigned to
FeeFlashErrCorrHandlingType. Only Fee_None is
supported.
Default Value
Fee_None
Parameter Range
Fee_None or Fee_Fix
Parameter Type
enum {Fee_none, Fee_Fix}
Target File
Fee_cfg.h
Texas Instruments Incorporated
12

AutoSAR FEE Parameter Configuration (Rev 1.8)
1.2.9 Cyclic Redundancy Check
Parameter defined in
Fee_ParamDef.axml
FeeCRCEnable
Pre-processor switch to enable the CRC for blocks.
Description
STD_ON: CRC for blocks is enabled.
STD_OFF:CRC disabled
Generated configuration
FEE_FLASH_CRC_ENABLE is set to STD_ON if
CRC check is enabled else it is set to STD_OFF. If
enabled, 16 bit CRC of the block is generated.
Default Value
STD_OFF
Parameter Range
STD_ON / STD_OFF
Parameter Type
Boolean
Target File
Fee_cfg.h
1.2.10 Block Write counter save
Parameter defined in
Fee_ParamDef.axml
FeeWriteCounterSave
Pre-processor switch to enable the block write
Description
counter. STD_ON: Block Write counter is enabled.
STD_OFF:Block Write counter is disabled
Generated configuration
FEE_FLASH_WRITECOUNTER_SAVE is set to
STD_ON if block write counter save is enabled else
it is set to STD_OFF.
Default Value
STD_OFF
Parameter Range
STD_ON / STD_OFF
Parameter Type
Boolean
Target File
Fee_cfg.h
Texas Instruments Incorporated
13

AutoSAR FEE Parameter Configuration (Rev 1.8)
1.2.11 Number of EEPs
Parameter defined in
Fee_ParamDef.axml
FeeNumberOfEEPS
Number of EEP's configured. 1 - Only one EEP
Description
configured. All Virtual Sectors can be used by this
EEP. 2 - Two EEP's configured. Each EEP can use
two Virtual Sectors.
Generated configuration
FEE_NUMBER_OF_EEPS is set to 1 if all virtual
sectors are used by one EEP. If virtual sectors are
shared between two EEPs, it is set to 2.
Default Value
1
Parameter Range
1/2
Parameter Type
Uint8
Target File
Fee_cfg.h
Note: If GUI is calculating this parameter from the configuration, this parameter
may not be present in BSWMD file.
1.2.12 Development error Detect
Parameter defined in
Fee_ParamDef.axml
FeeDevErrorDetect
Pre-processor switch to enable and disable
Description
development error detection. true: Development
error detection enabled. false: Development error
detection disabled.
Generated configuration
FEE_DEV_ERROR_DETECT Is set to STD_ON if
Set Mode supported is required else it is set to
STD_OFF.
Default Value
STD_OFF
Parameter Range
STD_ON/STD_OFF
Parameter Type
boolean
Target File
Fee_cfg.h
Texas Instruments Incorporated
14

AutoSAR FEE Parameter Configuration (Rev 1.8)
1.2.13 Non configured blocks to copy
Parameter defined in
Fee_ParamDef.axml
FeeNumberOfUnconfiguredBlocksToCopy
Defines the maximum number of non configured
Description
blocks to be copied during virtual sector swap. This
parameter is used if project configures and writes 10
blocks at start of the project, then reduce the number
of blocks to let’s say 8 blocks, but still want the other
two blocks to be present in Flash. In this case,
project should configure this parameter to 2.
Generated configuration
FEE_NUMBER_OF_UNCONFIGUREDBLOCKSTO
COPY is set to defined value.
Default Value
0
Parameter Range
0 -255
Parameter Type
Uint8
Target File
Fee_cfg.h
1.2.14 Number of eight byte writes
Parameter defined in
FeeNumberOfEightByteWrites
Fee_ParamDef.axml
Defines the number of 8 byte writes to be done in
Description
main function call. If configured to 2, main function
writes 16 bytes per call.
Generated configuration
FEE_NUMBER_OF_EIGHTBYTEWRITES is set to
defined value.
Default Value
1
Parameter Range
1-255
Parameter Type
Uint8
Texas Instruments Incorporated
15

AutoSAR FEE Parameter Configuration (Rev 1.8)
Target File
Fee_cfg.h
1.2.15 Check BANK7 Address Range
Parameter defined in
FEE_CHECK_BANK7_ACCESS
Fee_ParamDef.axml
Pre processor switch to enable EEPROM address
Description
range check during read/write.
Generated configuration
FEE_CHECK_BANK7_ACCESS is set to defined
value.
Default Value
STD_OFF
Parameter Range
STD_ON/STD_OFF
Parameter Type
boolean
Target File
Fee_cfg.h
1.2.16 Total Blocks and Data Sets
Parameter defined in
FEE_TOTAL_BLOCKS_DATASETS
Fee_ParamDef.axml
Description
Macro to indicate total blocks and data sets
configured.
Generated configuration
FEE_TOTAL_BLOCKS_DATASETS is set to defined
value.
Default Value
1
Parameter Range
1-65536
Parameter Type
Uint16
Target File
Fee_cfg.h
Note: This configuration should calculate total number of blocks and data sets
configured in the structure Fee_BlockConfiguration. For example, if 5 blocks are
configured with block 1 has 1 data set, block 2 has 4 data sets, block 3 has 2
data sets, block 4 has 5 data sets, block 5 has 3 data sets, then
FEE_TOTAL_BLOCKS_DATASETS = [(1)+(4)+(2)+(5)+(3)] = 15(sum of all data
sets).
If GUI is calculating this parameter from the configuration, this parameter may
not be present in BSWMD file.
Texas Instruments Incorporated
16

AutoSAR FEE Parameter Configuration (Rev 1.8)
1.2.17 Generate Device and Virtual sector structures
Parameter defined in
FEE_GENERATE_DEVICEANDVIRTUALSECTORS
Fee_ParamDef.axml
TRUC
Pre processor switch to enable/disable generation of
Description
Device and Virtual sector structures.
Generated configuration
FEE_GENERATE_DEVICEANDVIRTUALSECTORS
TRUC is set to defined value.
Default Value
STD_OFF
Parameter Range
STD_ON/STD_OFF
Parameter Type
boolean
Target File
Fee_cfg.h
Note: When this macro is turned ON, Fee_VirtualSectorConfiguration and
Device_FlashDevice are generated during run time.
Texas Instruments Incorporated
17

AutoSAR FEE Parameter Configuration (Rev 1.8)
1.2.18 Required Virtual Sector Size
Parameter defined in
FEE_VIRTUALSECTOR_SIZE
Fee_ParamDef.axml
Macro to indicate the required virtual sector size in
Description
kilo bytes. This macro is only used when
FEE_GENERATE_DEVICEANDVIRTUALSECTORS
TRUC is STD_ON. Based on
FEE_VIRTUALSECTOR_SIZE and
FEE_NUMBER_OF_VIRTUAL_SECTORS, elements
of the structure Fee_VirtualSectorConfiguration will
be populated during runtime.
Generated configuration
FEE_VIRTUALSECTOR_SIZE is set to defined
value.
Default Value
None
Parameter Range
4-32(see below note)
Parameter Type
Uint8
Target File
Fee_cfg.h
Note: Depending on the device, parameter range can be different.
For TMS570LS12xx/11xx family devices, FEE bank is 4*16KB. Macro can take a
value of 16 or 32. For TMS570LS09xx, TMS570LS07xx, TMS570LS05xx family
devices, FEE bank is 16*4KB. Macro can take a value of 4 or 8 or 12 or 16 or 32.
FEE_VIRTUALSECTOR_SIZE * FEE_NUMBER_OF_VIRTUAL_SECTORS
should not exceed the total available FEE bank size on device.
Texas Instruments Incorporated
18

AutoSAR FEE Parameter Configuration (Rev 1.8)
1.2.19 FEE bank Physical Sector Size
Parameter defined in
FEE_PHYSICALSECTOR_SIZE
Fee_ParamDef.axml
Macro to indicate the physical sector size on the
Description
device. This macro is only used when
FEE_GENERATE_DEVICEANDVIRTUALSECTORS
TRUC is STD_OFF. This parameter is used to select
device specific files.
Generated configuration
FEE_PHYSICALSECTOR_SIZE is set to defined
value.
Default Value
None.
Parameter Range
4/16
Parameter Type
Uint8
Target File
Fee_cfg.h
Note: This macro can only have 4/16 as value.
For TMS570LS12xx/11xx family devices, sector size is 16. For TMS570LS09xx,
TMS570LS07xx, TMS570LS05xx family devices, sector size is 4.
Texas Instruments Incorporated
19

AutoSAR FEE Parameter Configuration (Rev 1.8)
1.3 Number of Blocks
1.3.1 Blocks
Parameter defined in
Fee_ParamDef.axml
FeeNumberOfBlocks
Description
Defines the number of Data Blocks used for
EEPROM emulation. This is sum of all the blocks
configured on EEP1 and EEP2.
Generated configuration
FEE_NUMBER_OF_BLOCKS is set to the defined
value.
Default Value
0x1
Parameter Range
0x1 to 0xFFFE
Parameter Type
uint16
Target File
Fee_cfg.h
Note: If GUI is calculating this parameter from the configuration, this parameter
may not be present in BSWMD file.
1.4 Number of Virtual Sectors
1.4.1 Virtual Sectors
Parameter defined in
Fee_ParamDef.axml
FeeNumberOfVirtualSectors
Description
Defines the number of Virtual Sectors used for FEE.
Generated configuration
FEE_NUMBER_OF_VIRTUAL_SECTORS is set to
the defined value.
Default Value
0x2
Min :0x2 Max : 0x4,For
Parameter Range
TMS570LS01227/TMS570LS1113.
Min : 0x2 Max : 16, For TMS570LS05xx,
TMS570LS07xx, TMS570LS09xx.
Parameter Type
uint16
Target File
Fee_cfg.h
Texas Instruments Incorporated
20

AutoSAR FEE Parameter Configuration (Rev 1.8)
1.4.2 Virtual Sectors for EEP1
Parameter defined in
Fee_ParamDef.axml
FeeNumberOfVirtualSectorsEEP1
Description
Defines the number of Virtual Sectors used for
EEP1.
Generated configuration
FEE_NUMBER_OF_VIRTUAL_SECTORS_EEP1 is
set to the defined value.
Default Value
0x0
Parameter Range
Min : 0x0 Max :
(FEE_NUMBER_OF_VIRTUAL_SECTORS-0x02)
Parameter Type
uint16
Target File
Fee_cfg.h
Note: FEE_NUMBER_OF_VIRTUAL_SECTORS_EEP1 should be configured as
zero if FEE_NUMBER_OF_EEPS = 1.
1.5 FEE functions
1.5.1 FEE_GetVersionInfo
Parameter defined in
Fee_ParamDef.axml
FeeVersionInfoApi
Description
Indicates if the user can use the function
Fee_GetVersionInfo().
Generated configuration
FEE_VERSION_INFO_API is set to STD_ON if
FeeVersionInfoApi is enabled else it is set to
STD_OFF.
Default Value
STD_ON
Parameter Range
STD_ON / STD_OFF
Parameter Type
Boolean
Target File
Fee_cfg.h
Texas Instruments Incorporated
21

AutoSAR FEE Parameter Configuration (Rev 1.8)
1.6 FEE Sector Configuration
Note: The structure definition Fee_VirtualSectorConfiguration in fee_cfg.c should
be under the conditional compile check
#if (FEE_GENERATE_DEVICEANDVIRTUALSECTORSTRUC == STD_OFF).
Projects need not configure below parameters when above macro is turned ON.
1.6.1 FEE_VirtualSectorConfiguration
Array Name
FEE_VirtualSectorConfiguration
Description
Used to define a Virtual Sector
Fee_VirtualSectorConfigType.
Array Type
This is a structure having the following members.
Members
FeeVirtualSectorNumber
Virtual Sector's Number.
EEPROM emulation is
FeeFlashBank
supported only on Bank 7 for
F021 devices..
FeeStartSector
Starting Sector in the Bank for
this Virtual Sector.
FeeEndSector
Ending Sector in the Bank for
this Virtual Sector.
The configurations described in the following sections are repeated for each
Virtual Sector.
1.6.1.1 FEE_VirtualSectorNumber
Parameter defined in
Fee_ParamDef.axml
FeeSectorNumber
Description
Used to assign a number to the Virtual Sector.
Generated configuration
FeeVirtualSectorNumber is set to the value assigned
to the symbolic name for the Virtual Sector.
Default Value
1
Parameter Range
Min : 0x1, Max : 0x4,For
TMS570LS01227/TMS570LS1113
Min : 0x1 Max : 16, For TMS570LS05xx,
TMS570LS07xx, TMS570LS09xx
Parameter Type
uint16
Texas Instruments Incorporated
22

AutoSAR FEE Parameter Configuration (Rev 1.8)
Target File
Fee_Cfg.c
1.6.1.2 FEE_VirtualSectorBank
Parameter defined in
Fee_ParamDef.axml
FeeSectorBank
Description
Indicates the Flash Bank used by the Virtual Sector.
All the Virtual Sectors should use the same Flash
Bank. EEPROM emulation is supported only on
Bank 7 for F021 devices.
Generated configuration
FeeFlashBank is set to the value assigned to
FeeSectorBank.
Default Value
0x7 for F021 devices.
Parameter Range
Fixed to 0x7 for F021 devices.
Parameter Type
uint16
Target File
Fee_Cfg.c
1.6.1.3 FEE_VirtualSectorStart
Parameter defined in
Fee_ParamDef.axml
FeeSectorStart
Description
Indicates the Flash Sector in the Bank used by the
Virtual Sector as the Start sector.
Generated configuration
FeeStartSector is set to the value assigned to
FeeSectorStart.
Default Value
0x0
Parameter Range
Device specific, can use any Sector of the selected
Flash Bank. Please refer to the device datasheet
“Flash Memory Map” for more details.
Parameter Type
uint8
Target File
Fee_Cfg.c
Texas Instruments Incorporated
23

AutoSAR FEE Parameter Configuration (Rev 1.8)
1.6.1.4 FEE_VirtualSectorEnd
Parameter defined in
Fee_ParamDef.axml
FeeSectorEnd
Description
Indicates the Flash Sector in the Bank used by the
Virtual Sector as the End sector.
Generated configuration
FeeEndSector is set to the value assigned to
FeeSectorEnd.
Default Value
0x0
Parameter Range
Device specific, can use any Flash Sector of the
selected Flash Bank. It should be greater than the
FEE Start Sector. Please refer to the device
datasheet “Flash Memory Map” for more details.
Parameter Type
uint8
Target File
Fee_Cfg.c
Texas Instruments Incorporated
24

AutoSAR FEE Parameter Configuration (Rev 1.8)
1.6.2 Example Virtual Sector Configuration
#if (FEE_GENERATE_DEVICEANDVIRTUALSECTORSTRUC == STD_OFF)
const Fee_VirtualSectorConfigType Fee_VirtualSectorConfiguration[] =
{
/* Virtual Sector 1 */
{
1, /* Virtual sector number */
7, /* Bank */
0, /* Start Sector *//*(0, For TMS570LS05xx, TMS570LS07xx, TMS570LS09xx)*/
0, /* End Sector *//*(3, For TMS570LS05xx, TMS570LS07xx, TMS570LS09xx)*/
},
/* Virtual Sector 2 */
{
2, /* Virtual sector number */
7, /* Bank */
1, /* Start Sector *//*(4, For TMS570LS05xx, TMS570LS07xx, TMS570LS09xx)*/
1, /* End Sector *//*(7, For TMS570LS05xx, TMS570LS07xx, TMS570LS09xx)*/
},
/* Virtual Sector 3 */
{
3, /* Virtual sector number */
7, /* Bank */
2, /* Start Sector *//*(8, For TMS570LS05xx, TMS570LS07xx, TMS570LS09xx)*/
2, /* End Sector *//*(11, For TMS570LS05xx, TMS570LS07xx, TMS570LS09xx)*/
},
/* Virtual Sector 4 */
{
4, /* Virtual sector number */
7, /* Bank */
3, /* Start Sector *//*(12, For TMS570LS05xx, TMS570LS07xx, TMS570LS09xx)*/
3, /* End Sector *//*(15, For TMS570LS05xx, TMS570LS07xx, TMS570LS09xx)*/
},
};
#endif
Texas Instruments Incorporated
25

AutoSAR FEE Parameter Configuration (Rev 1.8)
1.7 FEE Block Configuration
1.7.1 FEE Block Configuration
Array Name
Fee_BlockConfiguration
Description
Used to define a block
Fee_BlockConfigType.
Array Type
This is a structure with the following members.
Members
FeeBlockNumber
Indicates Block's Number.
FeeBlockSize
Defines Block's Size in bytes.
FeeImmediateData
Indicates if the block is used
for immediate data.
Number of write cycles
FeeNumberOfWriteCycles
required for this block .
FeeDeviceIndex
Indicates the device index.
Indicates the number of Datasets
FeeNumberofDatasets
for this Block.
FeeEEPNumber
Indicates the number of EEP.
The configurations described in the following sections are repeated for each
Block.
1.7.1.1 FEE_BlockNumber
Parameter defined in
Fee_ParamDef.axml
FeeBlockNumber
Description
Assigns a number for the Block.
Generated configuration
FeeBlockNumber is set to a numeric value. It is
equal to the BlockNumber.
Default Value
1
Parameter Range
Min : 0x1 Max : 0xFFFE
Parameter Type
uint16
Target File
Fee_Cfg.c
Texas Instruments Incorporated
26

AutoSAR FEE Parameter Configuration (Rev 1.8)
1.7.1.2 FEE_BlockSize
Parameter defined in
Fee_ParamDef.axml
FeeBlockSize
Description
Indicates the size of the Block in bytes.
Generated configuration
FeeBlockSize is set to the value assigned to
FeeBlockSize.
Default Value
0x008
Parameter Range
0x1 to 0xFFFE
Parameter Type
uint16
Target File
Fee_Cfg.c
1.7.1.3 FEE_NumberOfWriteCycles
Parameter defined in
Fee_ParamDef.axml
FeeNumberOfWriteCycles
Description
Indicates the number of clock cycles required to write
to a flash address location.
Generated configuration
FeeNumberOfWriteCycles is set to the value
assigned to FeeNumberOfWriteCycles.
Default Value
0x1
Parameter Range
Device or core/flash tech dependent parameter.
Parameter Type
uint32
Target File
Fee_Cfg.c
Texas Instruments Incorporated
27

AutoSAR FEE Parameter Configuration (Rev 1.8)
1.7.1.4 FEE_UseImmediateData
Parameter defined in
Fee_ParamDef.axml
FeeImmediateData
Description
Indicates if the block is used for immediate data.
Generated configuration
FeeImmediateData is set to the value assigned to
FeeImmediateData.
Default Value
FALSE
Parameter Range
TRUE / FALSE
Parameter Type
Boolean
Target File
Fee_Cfg.c
1.7.1.5 FEE Device Index
Parameter defined in
Fee_ParamDef.axml
FeeDeviceIndex
Description
Indicates the device index. This will always be 0.
Generated configuration
FeeDeviceIndex is set to the value 0x0.
Default Value
0x0
Parameter Range
Fixed to 0x0.
Parameter Type
uint8
Target File
Fee_Cfg.c
Texas Instruments Incorporated
28

AutoSAR FEE Parameter Configuration (Rev 1.8)
1.7.1.6 FeeNumberOfDataSets
Parameter defined in
Fee_ParamDef.axml
FeeDataset
Description
Indicates the number of Datasets for this particular
Block .
Generated configuration
FeeNumberOfDataSets is set to the value assigned
to FeeDataset.
Default Value
0x01
Parameter Range
0x1 to 0xFF
Parameter Type
uint8
Target File
Fee_Cfg.c
1.7.1.7
FEE EEP Number
Parameter defined in
Fee_ParamDef.axml
FeeEEPNumber
Description
Number indicating into which EEP does the block go.
0 -- Block will be configured on EEP1. 1 -- Block will
be configured on EEP2.
Generated configuration
FeeEEPNumber is set to the value assigned.
Default Value
0x0
Parameter Range
0x00/0x01
Parameter Type
uint8
Target File
Fee_Cfg.c
Texas Instruments Incorporated
29

AutoSAR FEE Parameter Configuration (Rev 1.8)
1.7.2 Example Block Configuration
/* Block Configuration */
const Fee_BlockConfigType Fee_BlockConfiguration[] =
{
/* Block 1 */
{
0x01,
/* Block number
*/
0x0010,
/* Block size
*/
TRUE,
/* Block immediate data used
*/
0x00000064, /* Block number of write cycles */
0,
/* Device Index
*/
1,
/* Number of DataSets
*/
0
/* EEP number
*/
},
/* Block 2 */
{
0x02,
/* Block number
*/
0x000B,
/* Block size
*/
TRUE,
/* Block immediate data used */
0x00000064, /* Block number of write cycles */
0,
/* Device Index
*/
1,
/* Number of DataSets
*/
1
/* EEP number
*/
},
/* Block 3 */
{
0x03,
/* Block number
*/
0x000B,
/* Block size
*/
TRUE,
/* Block immediate data used */
0x00000064, /* Block number of write cycles */
0,
/* Device Index
*/
1,
/* Number of DataSets
*/
1
/* EEP number
*/
},
/* Block 4 */
{
0x04,
/* Block number
*/
0x000B,
/* Block size
*/
TRUE,
/* Block immediate data used */
0x00000064, /* Block number of write cycles */
Texas Instruments Incorporated
30

AutoSAR FEE Parameter Configuration (Rev 1.8)
0,
/* Device Index
*/
1,
/* Number of DataSets
*/
0
/* EEP number
*/
},
};
1.8
Header Files
The following header files are included in the files generated by the Code
Generation Tool.
1.8.1
Header Files for Fee_cfg.h
The following files are included in Fee_cfg.h
1. MemIf_Types.h
1.8.2
Header Files for Fee_cfg.c
The following files are included in Fee_cfg.c
1. Fee.h
2. Fee_Cbk.h
3. SchM_Fee.h
This file should also include version check as following:
#if (FEE_AR_MAJOR_VERSION != 0x03)
#error Fee_Cfg.c: FEE_AR_MAJOR_VERSION of Fee.h is incompatible.
#endif /* FEE_AR_MAJOR_VERSION */
#if (FEE_AR_MINOR_VERSION != 0x00)
#error Fee_Cfg.c: FEE_AR_MINOR_VERSION of Fee.h is incompatible.
#endif /* FEE_AR_MINOR_VERSION */
#if (FEE_AR_PATCH_VERSION != 0x01)
#error Fee_Cfg.c: FEE_AR_PATCH_VERSION of Fee.h is incompatible.
#endif /* FEE_AR_PATCH_VERSION */
#if (FEE_SW_MAJOR_VERSION != 1)
#error Fee_Cfg.c: FEE_SW_MAJOR_VERSION of Fee.h is incompatible.
#endif /* FEE_SW_MAJOR_VERSION */
#if (FEE_SW_MINOR_VERSION != 20)
#error Fee_Cfg.c: FEE_SW_MINOR_VERSION of Fee.h is incompatible.
#endif /* FEE_SW_MINOR_VERSION */
#if (FEE_SW_PATCH_VERSION != 0)
#error Fee_Cfg.c: FEE_SW_PATCH_VERSION of Fee.h is incompatible.
#endif /* FEE_SW_PATCH_VERSION */
Texas Instruments Incorporated
31
2.4 - AutoSAR FEE User Guide
2.5 - AutoSAR FEE User Guide_ind
Page 1
Page 2
Page 3
Page 4
Page 5
Page 6
Page 7
Page 8
Page 9
Page 10
Page 11
Page 12
Page 13
Page 14
Page 15
Page 16
Page 17
Page 18
Page 19
Page 20
Page 21
Page 22
Page 23
Page 24
Page 25
Page 26
Page 27
Page 28
Page 29
Page 30
Page 31
Page 32
Page 33
Page 34
Page 35
Page 36
Page 37
Page 38
Page 39
Page 40
Page 41
Page 42
Page 43
Page 44
Page 45
Page 46
Page 47
Page 48
Page 49
Page 50
Page 51
Page 52
Page 53
2.6 - AutoSAR FEE User Guides
AutoSAR FEE Driver
Us
er's Guide
User Manual
Version 1.14
Aug05, 2016
Copyright Texas Instruments Incorporated
Read This First
IMPORTANT NOTICE
Texas Instruments and its subsidiaries (TI) reserve the right to make changes to their products or to
discontinue any product or service without notice, and advise customers to obtain the latest version of
relevant information to verify, before placing orders, that information being relied on is current and
complete. All products are sold subject to the terms and conditions of sale supplied at the time of order
acknowledgment, including those pertaining to warranty, patent infringement, and limitation of liability.
TI warrants performance of its products to the specifications applicable at the time of sale in
accordance with TI’s standard warranty. Testing and other quality control techniques are utilized to the
extent TI deems necessary to support this warranty. Specific testing of all parameters of each device is
not necessarily performed, except those mandated by government requirements.
Customers are responsible for their applications using TI components.
In order to minimize risks associated with the customer’s applications, adequate design and operating
safeguards ought to be provided by the customer so as to minimize inherent or procedural hazards.
TI assumes no liability for applications assistance or customer product design. TI does not warrant or
represent that any license, either express or implied, is granted under any patent right, copyright, mask
work right, or other intellectual property right of TI covering or relating to any combination, machine, or
process in which such products or services might be or are used. TI’s publication of information
regarding any third party’s products or services does not constitute TI’s approval, license, warranty or
endorsement thereof.
Reproduction of information in TI data books or data sheets is permissible only if reproduction is without
alteration and is accompanied by all associated warranties, conditions, limitations and notices.
Representation or reproduction of this information with alteration voids all warranties provided for an
associated TI product or service is an unfair and deceptive business practice, and TI is neither
responsible nor liable for any such use.
Resale of TI’s products or services with statements different from or beyond the parameters stated by
TI for that product or service voids all express and any implied warranties for the associated TI product
or service, is an unfair and deceptive business practice, and TI is not responsible nor liable for any such
use.
Also see: Standard Terms and Conditions of Sale for Semiconductor Products.
www.ti.com/sc/docs/stdterms.htm
Mailing Address:
Texas Instruments
Post Office Box 655303
Dallas, Texas 75265
Copyright © 2012, Texas Instruments Incorporated
2
Preface
Read This First
About This Manual
This user manual serves as a software programmer’s handbook for working with the
AutoSAR FEE Driver. It provides necessary information regarding how to build and use AutoSAR
FEE Driver in user systems and applications.
It also provides details regarding the AutoSAR FEE Driver functionality, the requirements it
places on the hardware and software environment where it can be deployed, how to customize/
configure it etc. It also provides supplementary information regarding steps to be followed for proper
installation/ un-installation of the AutoSAR FEE Driver.
Important Notes
Customers have to include F021 API library v2.01.01 or greater.
Abbreviations
1-1. Table of Abbreviations
Abbreviation
Description
AutoSAR FEE Driver
This is TI coined name for the product.
FEE
Flash EEPROM Emulation
3
Read This First
Document Revision History
Version
Date
Revision History
1.0
09/25/2012
Initial version
1.1
11/08/2012
Changes for EA2
1.2
11/21/2012
Additional changes for BETA
1.3
12/12/2012
Add error recovery prototypes
1.4
06/11/2013
Add software revision history. Added new
configuration tags information.
1.5
10/23/2013
Updated software revision history.
1.6
01/03/2014
Add new configuration parameter for
address range check for Read/Write.
Check for Multi bit error during Read.
MISRA fixes.
1.7
09/11/2014
Manual Suspend/Resume feature added.
1.8
10/15/2014
RAM Optimization changes.
1.9
10/31/2014
Support TMS570LS05xx, TMS570LS07xx,
TMS570LS09xx. Range updated for
FEE_VirtualSectorNumber, Virtual Sectors
1.10
01/21/2015
Changes related to unification of Archer and
Champion.
1.11
10/14/2015
Bugfix for block lost issue.
1.12
11/20/2015
Enhancement for “Do not change FEE state
to IDLE after copying of the blocks is
completed”
1.13
03/15/2016
Bugfix for “Block offset address does not get
updated correctly, if copy operation was
interrupted.” Added section “Important Notes”
1.14
08/05/2016
Updated software revision history.
Software Revision History
Version
Date
Revision History
00.01.00
08/31/2012
Initial version
4
00.01.01
10/29/2012
Changes for implementing Error Recovery
00.01.02
11/30/2012
Misra Fixes, Memory segmentation changes
00.01.03
01/14/2013
Changes as requested by Vector. If there is an immediate
erase/invalidate block request before writing of a block ,
API should return the job status as JOB_OK.
00.01.04
02/12/2013
Integration issues fix. Fixed issues regarding integration of
FEE with NvM.
00.01.05
03/04/2013
Added Deleting a block feature
00.01.06
03/11/2013
Added feature : copying of unconfigured blocks.
00.01.07
03/15/2013
Added feature : Number of 8 bytes writes, fixed issue with
copy blocks.
00.01.08
04/05/2013
Added feature : CRC check for unconfigured blocks, Main
function modified to complete writes as fast as possible,
Added Non polling mode support.
00.01.09
04/19/2013
Warning removal, Added feature comparison of data
during write.
00.01.10
06/11/2013
Fixed issue with erase sector. Also fixed issue with 2
EEPROM’s where if one EEPROM is locked with error
condition, other EEPROM will not get locked.
01.10.00
10/23/2013
Updated software to support more than two VS.
01.20.00
01/03/2014
Add new configuration parameter for address range check
for Read/Write.
Check for Multi bit error during Read.
MISRA fixes.
01.20.01
09/11/2014
Manual Suspend/Resume feature added.
01.21.00
10/15/2014
RAM Optimization changes. New configuration parameter
FEE_TOTAL_BLOCKS_DATASETS added.
01.22.00
01/21/2015
Add new Configuration parameters.
FEE_VIRTUALSECTOR_SIZE,
FEE_PHYSICALSECTOR_SIZE,
FEE_GENERATE_DEVICEANDVIRTUALSECTORSTRUC
01.23.00
10/14/2015
Bugfix for block lost issue.
01.23.01
11/20/2015
Enhancement for “Do not change FEE state to IDLE after
copying of the blocks is completed”
01.23.02
03/15/2016
Bugfix for “Block offset address does not get updated
correctly, if copy operation was interrupted.”
5
Read This First
01.23.03
08/05/2016
Fee_Getstatus API should return MEMIF_BUSY, if FEE is
doing internal operations.
6
Contents
Read This First ................................................................................................................... 3
Contents ............................................................................................................................... 7
Table of tables .................................................................................................................... 9
Table of figures ................................................................................................................. 10
Chapter 1 ............................................................................................................................ 11
AutoSAR FEE Driver Introduction ............................................................................... 11
1.1
Overview ................................................................................................. 12
1.1.1
Functions supported in the AutoSAR FEE Driver ............................ 12
1.1.2
System Requirements ..................................................................... 13
Chapter 2 ............................................................................................................................ 14
AutoSAR FEE Driver Design Overview ...................................................................... 14
Overview ........................................................................................................... 14
2.1
Flash EEPROM Emulation Methodology ................................................ 15
2.1.1
Virtual Sector Organization .............................................................. 15
2.1.2
Data Block Organization .................................................................. 18
2.1.3
Available Commands ....................................................................... 20
2.1.4
Status Codes ................................................................................... 20
2.1.5
Job Result........................................................................................ 20
Chapter 3 ............................................................................................................................ 21
Integration Guide ............................................................................................................. 21
3.1
Error Recovery Implementation .............................................................. 21
3.2
Single and Double bit Error Corrections ................................................. 22
3.3
Memory Mapping .................................................................................... 22
3.4
Symbolic Constants and Enumerated Data types .................................. 23
3.5
Data Structures ....................................................................................... 26
3.6
AutoSAR FEE Driver Configuration Parameters ..................................... 27
3.6.1
Block Overhead ............................................................................... 27
3.6.2
Maximum Blocking Time ................................................................. 27
3.6.3
Page Overhead ............................................................................... 27
3.6.4
Sector Overhead ............................................................................ 27
3.6.5
Virtual Page Size ............................................................................. 28
3.6.6
Driver Index ..................................................................................... 28
3.6.7
Job Error Notification ....................................................................... 28
7
Contents
3.6.8
Job End Notification ........................................................................ 28
3.6.9
FEE Operating Frequency................................................................ 29
3.6.10
Polling Mode .................................................................................... 29
3.6.11
Enable Error Correction ................................................................... 29
3.6.12
Error Correction Handling................................................................. 30
3.6.13
Block Write Counter Save ................................................................ 30
3.6.14
Enable CRC ..................................................................................... 30
3.6.15
NumberOfEEPs ................................................................................ 30
3.6.16
Number of Blocks ............................................................................. 31
3.6.17
Number of Virtual Sectors ................................................................ 31
3.6.18
Number of Virtual Sectors on EEP1 ................................................. 31
3.6.19
Number of Eight Byte Writes ............................................................ 31
3.6.20
Maximum Number of non configured blocks to copy ........................ 32
3.6.21
Address Range check during Read/Write ........................................ 32
3.6.22
Number of blocks and Data Sets ...................................................... 32
3.6.23
Generate Device and Virtual Sector Structures ................................ 32
3.6.24
Required Virtual Sector Size ............................................................ 33
3.6.25
FEE bank Physical Sector Size ........................................................ 33
3.6.26
Virtual Sector Configuration ............................................................. 34
3.6.27
Block Configuration .......................................................................... 36
3.7
API Classification .................................................................................... 40
3.7.1
Initialization ...................................................................................... 40
3.7.2
Data Operations ............................................................................... 40
3.7.3
Information ....................................................................................... 41
3.7.4
Internal Operations ........................................................................... 41
3.7.5
Cancel/ Terminate Operations ......................................................... 41
3.7.6
Error Information and Recovery Operations ..................................... 41
3.7.7
Suspend/Resume Erase Sector ....................................................... 42
3.8
Integration Example ................................................................................ 43
3.9
API Specification ..................................................................................... 44
3.9.1
AutoSAR FEE Driver Functions ....................................................... 44
3.10 Privilege Mode access ............................................................................ 53
3.11 Deviations from Autosar3.x requirements ............................................... 53
3.12 Important Notes ....................................................................................... 53
8
Table of tables
1-1. Table of Abbreviations ............................................................................................ 3
Document Revision History ............................................................................................ 4
Software Revision History ............................................................................................... 4
2-1. Virtual Sector Header States ............................................................................... 17
2-2. Virtual Sector Header backup States ....................................................................... 17
4. Data Block Header Field Definitions ..................................................................... 19
2-2. Data Block Header Field Definitions .................................................................. 19
5. Data Block States ....................................................................................................... 19
4-1. AutoSAR FEE Driver Symbolic Constants ....................................................... 25
4-2. AutoSAR FEE Driver Published Information Data Structure ...................... 26
4-3. AutoSAR FEE Driver General Configuration Data Structure ...................... 26
4-4. AutoSAR FEE Driver Initialization APIs ............................................................ 40
4-5. AutoSAR FEE Driver Data Operation APIs ...................................................... 40
4-6. AutoSAR FEE Driver Information APIs ............................................................. 41
4-7. AutoSAR FEE Driver Internal Operation APIs ................................................. 41
4-8. AutoSAR FEE Driver Terminate/Cancel Operation APIs .............................. 41
4-9. AutoSAR FEE Driver Error Info and Recovery APIs ......................................... 41
4-10. TI FEE Driver Suspend/Resume Erase Sector APIs .................................... 42
9
Table of figures
Table of figures
Figure 1 Virtual Sector Organization ...................................................................... 16
Figure 2 Virtual Sector Header .............................................................................. 17
Figure 3 Data Block Structure ................................................................................ 18
10
Chapter 1
AutoSAR FEE Driver Introduction
This chapter introduces the AutoSAR FEE Driver to the user by providing a brief overview of
the purpose and construction of the AutoSAR FEE Driver along with hardware and software
environment specifics in the context of AutoSAR FEE Driver deployment.
11
AutoSAR FEE Driver Introduction
1.1 Overview
This section describes the functional scope of the AutoSAR FEE Driver and its feature set. It
introduces the AutoSAR FEE Driver to the user along with the functional decomposition and
run-time specifics regarding deployment of AutoSAR FEE Driver in user’s application.
Many applications require storing small quantities of system related data (e.g., calibration
values, device configuration) in a non-volatile memory, so that it can be used, modified or
reused even after power cycling the system. EEPROMs are primarily used for this purpose.
EEPROMs have the ability to erase and write individual bytes of memory many times over
and the programmed locations retain the data over a long period even when the system is
powered down.
The objective of AutoSAR FEE Driver is to provide a set of software functions intended to
use a Sector of on-chip Flash memory as the emulated EEPROM. These software functions
are transparently used by the application program for writing, reading and modifying the data.
The AutoSAR FEE Driver contains AutoSAR interface functions and any additional
management functions needed to operate properly.
A list of functions supported by the AutoSAR FEE Driver can be found in Section 1.1.1. The
primary function responsible for Fee management is the function Fee_Manager. This
function shall operate asynchronously and with little or no user intervention after
configuration, maintaining the Fee structures in Flash memory. When using the AutoSAR
interface, Fee_MainFunction function will be called on a cyclic basis which in turn calls
Fee_Manager when no other pending Fee operations are pending. When not using the
AutoSAR interface, the user shall be responsible for calling Fee_MainFunction function on a
cyclic basis so that it can perform internal operations.
1.1.1
Functions supported in the AutoSAR FEE Driver
The Autosar FEE Driver provides the following functional services:
Initialization:
•
Fee_Init
Operations:
•
Fee_Write
•
Fee_Read
•
Fee_EraseImmediateBlock
•
Fee_InvalidateBlock
•
Fee_Cancel
Information:
•
Fee_GetStatus
•
Fee_GetJobResult
•
Fee_GetVersionInfo
Internal Operations:
•
Fee_MainFunction
12
Error Information and Recovery:
•
TI_FeeErrorCode
•
TI_Fee_ErrorRecovery
Suspend/Resume Erase of Sector:
•
TI_Fee_SuspendResumeErase
1.1.2 System Requirements
The AutoSAR FEE Driver is supported on platforms characterized by the following Software
and Hardware requirements.
1.1.2.1
Software
The AutoSAR FEE Driver was developed and validated on a system with the following
operating system and software installed
•
Operating System : Win7
•
Codegeneration tools : TM570 Code Generation tools 4.9.5
•
Fee Configuration Files : The user needs to generate two configuration files using
a configuration tool to successfully deploy and use AutoSAR FEE Driver. These
two files (Fee_Cfg.h & Fee_Cfg.c) define which Flash sectors to be used for
EEPROM emulation, define Data Blocks ,Block Size and other configuration
parameters.
•
Flash API library : The AutoSAR FEE Driver uses the Flash API library for
performing program/erase operations. Customers have to use F021 v2.01.01 or
greater.
13
AutoSAR FEE Driver Design Overview
Chapter 2
AutoSAR FEE Driver Design
Overview
Overview
The Flash EEPROM Emulation (Fee) module contains AutoSAR interface functions and
additional management functions needed to operate it properly. A list of functions
supported by the AutoSAR FEE Driver can be found in Section 1.1.1.
This chapter describes the implementation method followed for Flash EEPROM emulation
in the AutoSAR FEE Driver.
14
2.1 Flash EEPROM Emulation Methodology
The EEPROM Emulation Flash bank is divided into two or more Virtual Sectors. Each Virtual
Sector is further partitioned into several Data Blocks. Data Blocks can be further partitioned
into Datasets. A minimum of two Virtual Sectors are required for Flash EEPROM emulation.
The initialization routine (Fee_Init) identifies which Virtual Sector to be used and marks it as
Active. The data is written to the first empty location in the Active Virtual Sector. If there is
insufficient space in the current Virtual Sector to update the data, it switches over to the next
Virtual Sector and copies all the valid data from the other Data Blocks in the current Virtual
Sector to the new one. After copying all the valid data, the current Virtual Sector is erased
and the new one is marked as Active Virtual Sector. Any new data is now written into the new
Active Virtual Sector and the erased Virtual Sector is used again once this new Virtual Sector
has insufficient space.
Virtual Sectors and Data Blocks have certain space allocated to maintain the status
information which is described in more detail in the following sections.
2.1.1 Virtual Sector Organization
The Virtual Sector Structure is the basic organizational unit used to partition the EEPROM
Emulation Flash Bank. This structure can contain one or more contiguous Flash Sectors
contained within one Flash Bank. A minimum of 2 Virtual Sectors are required to support
the Flash EEPROM Emulation (FEE) Driver.
The internal structure of the Virtual Sector contains a Virtual Sector Header, a static Data
Structure and the remaining space is used for Data Blocks.
15
AutoSAR FEE Driver Design Overview
Virtual Sector Organization
Virtual Sector Header
Block 3
Block 5 DS4
… Block n
Block n
Block 3
Block 3
Block 5 DS3
Block 0
Block 1 DS2
Block 3
Block 2
Virtual
Sector
Block 5 DS4
Block X
0
Block X
Block X
Block X
Block n
Block X
Block 3
Block 5 DS3
Block 2
Block n
Virtual Sector Header
Block n
Block5 DS3
… Block 3
Block 1 DS2
Block 2
Block n
Block 5 DS4
Block 5 DS3
Virtual
Sector
Block X
1
Block X
Block X
Block X
Block X
Block X
Figure 1 Virtual Sector Organization
16
2.1.1.1
Virtual Sector Header
The Virtual Sector Header consists of two 64bit words (16 bytes) that start at the first
address for a Virtual Sector Structure. The state of the Virtual Sector Structure is
maintained in the Virtual Sector Header.
The Status Word is the first 64 bit word of the Virtual Sector Header and is used to
indicate the current state of the Virtual Sector.
64 bit Status Word
32 bit backup
Erase Count
Version Number
Status
8 bits reserved
(20 bits)
(4 Bits)
Figure 2 Virtual Sector Header
The following table indicates the various states a Virtual Sector can be in.
State
Value
Invalid Virtual Sector
0xFFFFFFFFFFFFFFFF
Empty Virtual Sector
0x0000FFFFFFFFFFFF
Copy Virtual Sector
0x00000000FFFFFFFF
Active Virtual Sector
0x000000000000FFFF
Ready for Erase
0x0000000000000000
2-1. Virtual Sector Header States
Invalid Virtual Sector: This Virtual Sector is either in process of being erased or has
not yet been initialized.
Empty Virtual Sector: This indicates the Virtual Sector has been erased and
initialized and can be used to store data.
Copy Virtual Sector: This indicates that the Data Block Structure is being moved
from a full Virtual Sector to this one to allow for moving of the Active Virtual Sector.
Active Virtual Sector: This Virtual Sector is the active one.
Ready for Erase: This Virtual Sector’s Data Block Structure has been correctly
replicated to a new Virtual Sector and is now ready to be erased and initialized for re-
use.Virtual Sector Information Record is the second 64 bit word in the Virtual Sector
header. It is used to record information needed by the Virtual Sector management
algorithm. Currently the first 4 bits are used to indicate the current version of the Virtual
Sector and the next 20 bits are used to indicate the number of times the Virtual Sector
has been erased. The erase count is incremented each time the Virtual Sector is
erased. The remaining bits are reserved for future use.
State
Value
Copy Virtual Sector
0xFFFFFFFF
Active Virtual Sector
0x00000000
2-2. Virtual Sector Header backup States
17
AutoSAR FEE Driver Design Overview
If the normal Virtual sector header is corrupted, then the backup status will be used to
know the VS state.
After VS header, the next 8 bytes are used to know erase status of the VS. It says, if the
erase was started/completed/ready for erase. Next 8 bytes are reserved.
0x 0000FFFFFFFFFFFF – Erase of other VS started
0x 00000000FFFFFFFF – Erase of other VS completed
0x000000000000FFFF – This VS is ready for Erase.
2.1.2
Data Block Organization
The Data Block is used to define where the data within a Virtual Sector is mapped.
One or more variables can be within a Data Block based on the user definition. The
smallest amount of data that can be stored within the Data Block is 64 bits. The Data
Block Structure is limited to the size of the Virtual Sector it resides in.
Note: The size of all the Data Blocks cannot exceed the Virtual Sector length.
When a Data Packet write exceeds the available space of the current Virtual Sector,
the Data Block structure is duplicated in the next Virtual Sector to be made active.
Data Block Structure
Block5
Dataset2
Block5
Dataset6
Block1
Dataset2
Block3
Dataset1
Header
Header
Header
Header
Block4
Dataset4
Block2
Dataset2
Block1
Dataset8
Block2
Dataset3
Header
Header
Header
Header
Figure 3 Data Block Structure
18
2.1.2.1
Data Block Header
The Data Block Header is 24 bytes in length and is used to indicate the location
information (address) of valid data within a Virtual Sector.
A Standard Data Block Header has the following fields
Block Number (16 bits)
Block size (16 bits)
Block W/E Cycle count - optional (32 bits) / reserved if saving not enabled
CRC - optional (32 bits)
Address of previous Valid Block (32 bits)
Block St
S atus (64 bits)
4. Data Block Header Field Definitions
A Standard Data Block Header has the following fields
Bit(s)
Field
Description
191-176
Block Number
This is used to indicate the block number.
175-160
Block size
Indicates size of block
159-128
W/E counter
Indicates write/erase counter for a block
127-96
CRC
Indicates CRC of block
95-64
Address
Address of the previous valid block
Status of the
These 64 bits indicate the Status of the Block. The
63-0
Block
following Table lists all the possible combinations for the
Block Status.
2-2. Data Block Header Field Definitions
State
Value
Empty Block
0xFFFFFFFFFFFFFFFF
Start Program Block
0xFFFFFFFFFFFF0000
Valid Block
0xFFFFFFFF00000000
Invalid Block
0xFFFF000000000000
Corrupt Block
0x0000000000000000
5. Data Block States
Block Status is used to ensure that data integrity is maintained even if the Block (data)
update process is interrupted by an uncontrolled event such as a power supply failure or
reset.
Empty Block: New Data can be written to this Block.
19
AutoSAR FEE Driver Design Overview
Start Program Block: This indicates that the Data Block is in the progress of being
programmed with data.
Valid Block: This indicates that the Data Block is fully programmed and contains Valid
Data.
Invalid Block: This indicates that the Data Block contains invalid or old data.
Corrupt Block: This indicates that the Data Block is corrupted and the Software should
ignore this Block.
2.1.3 Available Commands
The following list describes the available commands.
1.
Write: This command shall program a Flash memory block.
2.
Read: This command shall copy a continuous Flash memory block.
3.
Erase Immediate: This command shall change the status of the block to Invalid in
the Data Block header to Erase it.
4.
Invalidate Block: This command shall change the status of the block to Invalid in
the Data Block header to invalidate it.
2.1.4 Status Codes
This indicates the status of the Fee module. It can be in one of the following states
1. MEMIF_UNINIT: The Fee Module has not been initialized.
2. MEMIF_IDLE: The Fee Module is currently idle.
3. MEMIF_BUSY: The Fee Module is currently busy.
4. MEMIF_BUSY_INTERNAL: The Fee Module is currently busy with internal
management operations
2.1.5 Job Result
This indicates the result of the last job. The job result can be any one of the following
states
1. MEMIF_JOB_OK: The last job has finished successfully
2. MEMIF_JOB_PENDING: The last job is waiting for execution or is currently being
executed.
3. MEMIF_JOB_CANCELLED: The last job has been cancelled.
4. MEMIF_JOB_FAILED: The last read/erase/write job failed.
5. MEMIF_JOB_INCONSISTENT: The requested block is inconsistent, it may contain
corrupted data.
6. MEMIF_JOB_INVALID: The requested block has been invalidated. The requested
read operation cannot be performed
20
Chapter 3
Integration Guide
This chapter discusses the AutoSAR FEE Driver run-time interfaces that comprise the API
classification & usage scenarios and the API specification itself in association with its data types
and structure definitions. Users will have to integrate TI FEE along with the Flash F021 library.
The TI FEE Driver uses the Flash API library for performing program/erase operations. The
apprioprate Flash API library depending on the type of Flash technology has to be included in
the.(F021 API V2.01.01 or greater). Users also need to integrate the generated configuration files.
3.1 Error Recovery Implementation
Projects should implement error recovery mechanism to recover from serious errors. They
should call the API TI_FeeErrorCode( ) periodically to check if there are any severe
errors(Error_TwoActiveVS, Error_TwoCopyVS, Error_SetupStateMachine, Error_NoActiveVS,
Error_CopyButNoActiveVS, Error_NoFreeVS, Error_EraseVS). If error is any of the above type,
then API TI_Fee_ErrorRecovery( ) should be called with proper parameters.
If the error is of type Error_TwoActiveVS or Error_TwoCopyVS or
Error_CopyButNoActiveVS, then the application has to provide info on which of the VS needs to be
corrected in u8VirtualSector. TI_Fee_u16ActCpyVS will provide info on which of the VS’s are
Active/Copy. For error of type Error_CopyButNoActiveVS, TI_Fee_u16ActCpyVS will provide info
on which VS is Copy. In this case, the second argument for the TI_Fee_ErrorRecovery should be
the copy VS number. Error recovery API will mark the VS as Active.
If the error is of type Error_NoFreeVS, then the application has to provide info on which of
the VS needs to be erased in u8VirtualSector. TI_Fee_u16ActCpyVS will provide info on which VS
is active.
If the error is of type Error_SetupStateMachine, recheck configuration. Configure RWAIT,
EWAIT and operating frequency correctly.
If the error is of type Error_EraseVS, this means either erasing or a blank check of VS failed.
Call error recovery function to perform erase again. Check the variables
TI_Fee_GlobalVariables[u8EEPIndex].Fee_u16ActiveVirtualSector /
TI_Fee_GlobalVariables[u8EEPIndex].Fee_u16CopyVirtualSector to know which of the VS’s are
active/copy. Erase other sectors.
Application can access the variable “TI_Fee_u16ActCpyVS” to know details about the VS’s.
Prototype for the API’s are:
TI_Fee_ErrorCodeType TI_FeeErrorCode(uint8 u8EEPIndex);
void TI_Fee_ErrorRecovery(TI_Fee_ErrorCodeType Error Code, uint8 u8VirtualSector);
If two EEPROM’s are configured, then TI_FeeErrorCode has to be called cyclically with different
index.
Ex: TI_FeeErrorCode(0) and TI_FeeErrorCode(1)
21
Integration Guide
If Error is of type Error_TwoActiveVS and TI_Fee_u16ActCpyVS = 0x0003, this means VS 1 and 2
are Active.
If projects want to make VS 1 as Active, then
Call TI_Fee_ErrorRecovery(Error_TwoActiveVS, 2);
Virtual sector 2 will be marked as Ready for Erase.
Virtual sector numbers start from 1.
3.2 Single and Double bit Error Corrections
FEE software provides a mechanism to detect single and double bit errors. In order to use
this feature, application has to make sure that “EE_EDACMODE[3:0]: Error Correction Mode”
in “EE_CTRL1” should be set to a value other than 0101, “EE_ONE_EN: Error on One Fail
Enable” should be enabled, “EE_ZERO_EN: Error on Zero Fail Enable” should be enabled,
“EE_EDACEN[3:0]: Error Detection and Correction Enable” should be set to a value other
than 0101.
Projects have to then call error hook functions TI_Fee_ErrorHookSingleBitError ( ) and
TI_Fee_ErrorHookDoubleBitError ( ) in ESM. For single bit error, an event is generated on
channel 35 of ESM and for double bit error on channel 36 of ESM.
3.3 Memory Mapping
Following macros can be used for reallocating code, constants and variables.
• FEE_START_SEC_CONST_UNSPECIFIED
• FEE_STOP_SEC_CONST_UNSPECIFIED
• FEE_START_SEC_CODE
• FEE_STOP_SEC_CODE
• FEE_START_SEC_VAR_INIT_UNSPECIFIED
• FEE_STOP_SEC_VAR_INIT_UNSPECIFIED
22
3.4 Symbolic Constants and Enumerated Data types
This section summarizes all the symbolic constants specified as either
#define macros and/or enumerated C data types. Described alongside the
macro or enumeration is the semantics or interpretation of the same in
terms of what value it stands for and what it means.
Group or Enumeration Class
Symbolic Constant Name
Description or
Evaluation
Fee_StatusType
FEE_OK
Function returned no
error
FEE_ERROR
Function returned an
error
VsState_Invalid =1
Virtual Sector is Invalid
VirtualSectorStatesType
VsState_Empty =2
Virtual Sector is Empty
VsState_Copy =3
Virtual Sector is Copy
VsState_Active =4
Virtual Sector is Active
VsState_ReadyForErase =5
Virtual Sector is Ready
for Erase
Block_StartProg=1
Write/Erase/Invalid
operation is in progress
on this Block
BlockStatesType
Block_Valid=2
Block is Valid
Block_Invalid=3
Block is Invalid
Error_Nil=0
Error_TwoActiveVS=1
Error_TwoCopyVS=2
Error_SetupStateMachine=3
Error_CopyButNoActiveVS=4
Error_NoActiveVS=5
Error_BlockInvalid=6
Fee_ErrorCodeType
Error_NullDataPtr=7
Error_NoFreeVS=8
Error_InvalidVirtualSectorPara
meter=9
23
Integration Guide
Error_ExceedSectorOnBank=1
0
Error_EraseVS=11
Error_BlockOffsetGtBlockSize
=12
Error_LengthParam=13
Error_FeeUninit=14
Error_Suspend=15
Error_InvalidBlockIndex=16
Error_NoErase=17
Error_CurrentAddress=18
Error_Exceed_No_Of_DataSet
s=19
Fee_None
Take no action on single
bit errors
Fee_FlashErrorCorrectionActionType
Fee_Fix
Correct single bit errors
MEMIF_UNINIT
FEE Module is
Uninitialized
MEMIF_IDLE
FEE Module is Idle
Fee_StatusCodeType
MEMIF_BUSY
FEE Module is Busy
MEMIF_BUSY_INTERNAL
FEE Module is
performing internal
operations
Erase
If set to ‘1’ indicates
Erase operation is in
progress
Fee_StatusWordType_UN
ReadSync
If set to ‘1’ indicates
Synchronous Read
operation is in progress
ProgramFailed
If set to ‘1’ indicates
there was an error during
write operation. This is
now deprecated.
Read
If set to ‘1’ indicates
Read operation is in
progress
Writesync
If set to ‘1’ indicates
Sync Write operation is
24
in progress
WriteAsync
If set to ‘1’ indicates
Async Write operation is
in progress
EraseImmediate
If set to ‘1’ indicates
Erase immediate
operation is in progress
InvalidateBlock
If set to ‘1’ indicates
Invalidate operation is in
progress
Copy
If set to ‘1’ indicates
Copy operation is in
progress
Initialized
If set to ‘1’ indicates
FEE is initialized. This is
now deprecated.
SingleBitError
If set to ‘1’ indicates
there was a single bit
error during read
operation. This is now
deprecated.
FEE_SW_MAJOR_VERSION
#define Macro which indicates the Major version of the
FEE
FEE_SW_MINOR_VERSION
#define Macro which indicates the Minor version of the
FEE
FEE_SW_PATCH_VERSION
#define Macro which indicate the Patch version of the FEE
4-1. AutoSAR FEE Driver Symbolic Constants
25
Integration Guide
3.5 Data Structures
This section summarizes the entire user visible data structure elements pertaining to the
AutoSAR FEE Driver run-time interfaces.
Name
Fee_PublishedInformationType
Description
Used to contain Published Information
Fields
Data
Range
Description
type
FeeBlockOverhead
Uint8
0x18
Block OverHead in bytes
FeeMaximumBlockingTime Float32
600us
Maximum Blocking time in us
FeePageOverhead
Uint8
0x0
Page overhead in bytes
FeeVirtualSectorOverhead
Uint8
0x10
Virtual Sector overhead in bytes
4-2. AutoSAR FEE Driver Published Information Data Structure
Name
Fee_GeneralConfigType
Description
Used to contain General configuration
information
Fields
Data
Range
Description
type
FeeDevErrorDetect
boolean
STD_ON/
Indicates if
STD_OFF
Development Error
Detection is enabled
FeeIndex
uint32
0
Instance ID of this
module. Should
always be 0
*FeeNvmJobEndNotification
Fee_Call
-
Mapping to upper level
backType
job end notification
*FeeNvmJobErrorNotification
Fee_Call
-
Mapping to upper level
backType
job error notification
FeePollingMode
boolean
STD_ON/
Indicates if polling
STD_OFF
mode is enabled
FeeVersionInfoApi
boolean
STD_ON/
Indicates if version
STD_OFF
info API is compiled.
FeeVirtualPageSize
uint16
0x8
Defines the virtual
page size
4-3. AutoSAR FEE Driver General Configuration Data Structure
26
3.6 AutoSAR FEE Driver Configuration Parameters
The AutoSAR FEE Driver needs two configuration files. These two files (Fee_Cfg.h &
Fee_cfg.c) define which Flash sectors to be used for EEPROM emulation, define Data
Blocks, Block Size and other configuration parameters. This section describes the
configuration parameters in the AutoSAR FEE Driver.
3.6.1
Block Overhead
Parameter Name
FEE_BLOCK_OVERHEAD
Description
Indicates the number of bytes used for Block Header.
Default Value
0x18
Parameter Range
Fixed to 0x18
Target File
Fee_cfg.h
Sample Configuration
#define FEE_BLOCK_OVERHEAD 0x18
3.6.2
Maximum Blocking Time
Parameter Name
FEE_MAXIMUM_BLOCKING_TIME
Description
Indicates the maximum allowed blocking time for any Fee call.
Default Value
600.00
Parameter Range
Fixed to 600.00 µs.
Target File
Fee_cfg.h
Sample Configuration
#define FEE_MAXIMUM_BLOCKING_TIME 600.00
3.6.3
Page Overhead
Parameter Name
FEE_PAGE_OVERHEAD
Description
Indicates the Page Overhead in bytes.
Default Value
0x0
Parameter Range
Fixed to 0x0
Target File
Fee_cfg.h
Sample Configuration
#define FEE_PAGE_OVERHEAD 0x0
3.6.4
Sector Overhead
Parameter Name
FEE_VIRTUAL_SECTOR_OVERHEAD
Description
Indicates the number of bytes used for Virtual Sector
Header.
Default Value
0x10
Parameter Range
Fixed to 0x10
Target File
Fee_cfg.h
Sample Configuration
#define FEE_VIRTUAL_SECTOR_OVERHEAD 0x10
27
Integration Guide
3.6.5 Virtual Page Size
Parameter Name
FEE_VIRTUAL_PAGE_SIZE
Description
Indicates the virtual page size in bytes.
Default Value
0x8
Parameter Range
Fixed to 0x8
Target File
Fee_cfg.h
Sample Configuration
#define FEE_VIRTUAL_PAGE_SIZE 0x8
3.6.6 Driver Index
Parameter Name
FEE_INDEX
Description
Instance ID of FEE module. Should always be 0x0
Default Value
0x0
Parameter Range
Fixed to 0x0
Target File
Fee_cfg.h
Sample Configuration
#define FEE_INDEX 0x0
3.6.7 Job Error Notification
Parameter Name
FEE_NVM_JOB_ERROR_NOTIFICATION
Description
Call back function to notify a Job Error. This is only applicable if
polling mode is OFF.
Default Value
NvM_JobErrorNotification
Parameter Range
User defined function name
Target File
Fee_cfg.h
Sample Configuration
#define FEE_NVM_JOB_ERROR_NOTIFICATION
NvM_JobErrorNotification
3.6.8 Job End Notification
Parameter Name
FEE_NVM_JOB_END_NOTIFICATION
Description
Call back function to notify a Job End. This is only applicable if
polling mode is OFF.
Default Value
NvM_JobEndNotification
Parameter Range
User defined function name
28
Target File
Fee_cfg.h
Sample Configuration
#define FEE_NVM_JOB_END_NOTIFICATION
NvM_JobEndNotification
3.6.9 FEE Operating Frequency
Parameter Name
FEE_OPERATING_FREQUENCY
Description
Device operating frequency in MHz. It is equivalent to the
HCLK frequency in the TMS570 clock tree.
Default Value
160
Parameter Range
Device dependent parameter. Refer to the device
datasheet to know the range.
Target File
Fee_cfg.h
Sample Configuration
#define FEE_OPERATING_FREQUENCY 160
3.6.10
Polling Mode
Parameter Name
FEE_POLLING_MODE
Description
Indicates if polling mode is enabled/disabled. Currently, this
parameter should always be STD_ON.
Default Value
STD_ON
Parameter Range
STD_ON/ STD_OFF
Target File
Fee_cfg.h
Sample Configuration
#define FEE_POLLING_MODE STD_ON
3.6.11
Enable Error Correction
Parameter Name
FEE_FLASH_ERROR_CORRECTION_ENABLE
Description
Used to enable/disable Error Correction Used to enable ECC for
EEPROm data. This configuration parameter is no longer used.
Default Value
STD_OFF
Parameter Range
STD_ON/ STD_OFF
Target File
Fee_cfg.h
Sample Configuration
#define FEE_FLASH_ERROR_CORRECTION_ENABLE
STD_OFF
29
Integration Guide
3.6.12 Error Correction Handling
Parameter Name
FEE_FLASH_ERROR_CORRECTION_HANDLING
Description
Indicates desired action to be taken on detection of bit
errors. Currently only Fee_None is supported.
Default Value
Fee_None
Parameter Range
Fee_None or Fee_Fix
Target File
Fee_cfg.h
Sample Configuration
#define
FEE_FLASH_ERROR_CORRECTION_HANDLING
Fee_None
3.6.13 Block Write Counter Save
Parameter Name
FEE_WRITECOUNTER_SAVE
Description
Used to enable/disable saving of write/erase counter value
in to block header.
Default Value
STD_OFF
Parameter Range
STD_ON/ STD_OFF
Target File
Fee_cfg.h
Sample Configuration
#define FEE_WRITECOUNTER_SAVE STD_OFF
3.6.14 Enable CRC
Parameter Name
FEE_ CRC_ENABLE
Description
Used to enable/disable 16 bit CRC. If enabled, 16 bit CRC
is calculated and written into Block header.
Default Value
STD_OFF
Parameter Range
STD_ON/ STD_OFF
Target File
Fee_cfg.h
Sample Configuration
#define FEE_ CRC_ENABLE STD_OFF
3.6.15 NumberOfEEPs
Parameter Name
FEE_NUMBER_OF_EEPS
Description
Used to configure number of emulations on a single bank.
Default Value
1
Parameter Range
1-2
Target File
Fee_cfg.h
Sample Configuration
#define FEE_NUMBER_OF_EEPS 1
30
3.6.16 Number of Blocks
Parameter Name
FEE_NUMBER_OF_BLOCKS
Description
Defines the number of Data Blocks used for EEPROM
emulation.
Default Value
0x1
Parameter Range
0x1 to 0xFFFE
Target File
Fee_cfg.h
Sample Configuration
#define FEE_NUMBER_OF_BLOCKS 0x10
3.6.17
Number of Virtual Sectors
Parameter Name
FEE_NUMBER_OF_VIRTUAL_SECTORS
Description
Defines the number of Virtual Sectors used for FEE..
Default Value
0x2
Min :0x2 Max : 0x4,For TMS570LS01227/TMS570LS1113.
Parameter Range
Min : 0x2 Max : 16, For TMS570LS05xx, TMS570LS07xx,
TMS570LS09xx.
Target File
Fee_cfg.h
Sample Configuration
#define FEE_NUMBER_OF_VIRTUAL_SECTORS 0x2
3.6.18
Number of Virtual Sectors on EEP1
Parameter Name
FEE_NUMBER_OF_VIRTUAL_SECTORS_EEP1
Description
Defines the number of Virtual Sectors used for EEP1
Default Value
0x2
Parameter Range
0 to FEE_NUMBER_OF_VIRTUAL_SECTORS-2
Target File
Fee_cfg.h
Sample Configuration
#define FEE_NUMBER_OF_VIRTUAL_SECTORS_EEP1 0x2
3.6.19
Number of Eight Byte Writes
Parameter Name
FEE_NUMBER_OF_EIGHTBYTEWRITES
Description
Defines the number of 8 byte writes to be performed in Main
Function.
Default Value
0x1
Parameter Range
1 to 255
Target File
Fee_cfg.h
Sample Configuration
#define FEE_NUMBER_OF_EIGHTBYTEWRITES 0x1
31
Integration Guide
3.6.20 Maximum Number of non configured blocks to copy
Parameter Name
FEE_NUMBER_OF_UNCONFIGUREDBLOCKSTOCOPY
Description
Defines the maximum number non configured blocks to copy.
Default Value
0x0
Parameter Range
0 to 255
Target File
Fee_cfg.h
Sample Configuration
#define FEE_NUMBER_OF_
UNCONFIGUREDBLOCKSTOCOPY 0x0
3.6.21 Address Range check during Read/Write
Parameter Name
FEE_CHECK_BANK7_ACCESS
Description
Defines the maximum number non configured blocks to copy.
Default Value
STD_OFF
Parameter Range
STD_ON/STD_OFF
Target File
Fee_cfg.h
Sample Configuration
#define FEE_CHECK_BANK7_ACCESS STD_OFF
3.6.22 Number of blocks and Data Sets
Parameter Name
FEE_TOTAL_BLOCKS_DATASETS
Description
Defines the total data sets in block configuration.
Default Value
1
Parameter Range
1-65536
Target File
Fee_cfg.h
Sample Configuration
#define FEE_TOTAL_BLOCKS_DATASETS 1
3.6.23 Generate Device and Virtual Sector Structures
Parameter Name
FEE_GENERATE_DEVICEANDVIRTUALSECTORSTRUC
Description
Used to enable/disable generation of Device and Virtual sector
structures.
Default Value
STD_OFF
Parameter Range
STD_ON/STD_OFF
Target File
Fee_cfg.h
Sample Configuration
#define
FEE_GENERATE_DEVICEANDVIRTUALSECTORSTRUC
STD_OFF
32
Note: When FEE_GENERATE_DEVICEANDVIRTUALSECTORSTRUC=STD_ON,
device (Device_FlashDevice) and virtual sector
configuration(Fee_VirtualSectorConfiguration) structures are populated during
runtime. Also, these structures will be placed in RAM. Projects should take care
that only FEE driver has access to these structures. When it’s STD_OFF,
structures are places in flash and are const.
3.6.24 Required Virtual Sector Size
Parameter Name
FEE_VIRTUALSECTOR_SIZE
Description
Defines the size of virtual sector.
Default Value
None
Parameter Range
4-32(see below note)
Target File
Fee_cfg.h
Sample Configuration
#define FEE_VIRTUALSECTOR_SIZE 4
Note: Depending on the device, parameter range can be different.
For TMS570LS12xx/11xx family devices, FEE bank is 4*16KB. Macro can take a value of
16 or 32. For TMS570LS09xx, TMS570LS07xx, TMS570LS05xx family devices, FEE bank
is 16*4KB. Macro can take a value of 4 or 8 or 12 or 16 or 32.
FEE_VIRTUALSECTOR_SIZE * FEE_NUMBER_OF_VIRTUAL_SECTORS should not
exceed the total available FEE bank size on device. This macro is only used when
FEE_GENERATE_DEVICEANDVIRTUALSECTORSTRUC is STD_ON. Based on
FEE_VIRTUALSECTOR_SIZE and FEE_NUMBER_OF_VIRTUAL_SECTORS, elements
of the structure Fee_VirtualSectorConfiguration will be populated during runtime.
3.6.25 FEE bank Physical Sector Size
Parameter Name
FEE_PHYSICALSECTOR_SIZE
Description
Defines the size of one physical sector on the device.
Default Value
None
Parameter Range
4/16(see below note)
Target File
Fee_cfg.h
Sample Configuration
#define FEE_PHYSICALSECTOR_SIZE 4
Note: This macro can only have 4/16 as value.
For TMS570LS12xx/11xx family devices, sector size is 16. For TMS570LS09xx,
TMS570LS07xx, TMS570LS05xx family devices, sector size is 4. This macro is only used
when FEE_GENERATE_DEVICEANDVIRTUALSECTORSTRUC is STD_OFF. This
parameter is used to select device specific files.
33
Integration Guide
3.6.26 Virtual Sector Configuration
Array Name
FEE_VirtualSectorConfiguration
Description
Used to define a Virtual Sector
Array Type
Fee_VirtualSectorConfigType.
This is a structure having the following members.
Members
FeeVirtualSectorNumber
Virtual Sector's Number.
Flash Bank for EEPROM
FeeFlashBank
emulation, Only Bank 7 for
F021 devices.
Starting Sector in the Bank for
FeeStartSector
this Virtual Sector.
Ending Sector in the Bank for
FeeEndSector
this Virtual Sector.
Target File
Fee_cfg.c
The configurations described below are repeated for each Virtual Sector.
3.6.26.1 FeeVirtualSectorNumber
Parameter Name
FeeVirtualSectorNumber
Description
Each Virtual Sector is assigned a number starting from 0x1
Default Value
0x1
Min : 0x1, Max : 0x4,For
Parameter Range
TMS570LS01227/TMS570LS1113
Min : 0x1 Max : 16, For TMS570LS05xx, TMS570LS07xx,
TMS570LS09xx
Target File
Fee_cfg.c
3.6.26.2 FeeFlashBank
Parameter Name
FeeFlashBank
Description
Indicates the Flash Bank used by the Virtual Sector. All the
Virtual Sectors should use the same Flash Bank. EEPROM
emulation is supported only on Bank 7 for F021 devices
Default Value
0x7 for F021 devices
Parameter Range
Fixed to 0x7 for F021 devices.
Target File
Fee_cfg.c
3.6.26.3 FeeStartSector
Parameter Name
FeeStartSector
Description
Indicates the Flash Sector in the Bank used by the Virtual
Sector as the Start sector.
Default Value
0x0
34
Parameter Range
Device specific, can use any Sector of the selected Flash
Bank. Please refer to the device datasheet “Flash Memory
Map” for more details.
Target File
Fee_cfg.c
3.6.26.4 FeeEndSector
Parameter Name
FeeEndSector
Description
Indicates the Flash Sector in the Bank used by the Virtual Sector
as the End sector.
Default Value
0x0
Parameter Range
Device specific, can use any Flash Sector of the selected Flash
Bank. It should be greater than the FEE Start Sector. Please
refer to the device datasheet “Flash Memory Map” for more
details.
Target File
Fee_cfg.c
3.6.26.5 Sample Virtual Sector Configuration
The following code snippet indicates one of the possible configurations for the Virtual
Sectors:
/* Virtual Sector Configuration */
const TI_FeeVirtualSectorConfigType TI_FeeVirtualSectorConfiguration[] =
{
/* Virtual Sector 1 */
{
1, /* Virtual sector number */
7, /* Bank
*/
0, /* Start Sector */
0, /* End Sector */
},
/* Virtual Sector 2 */
{
2, /* Virtual sector number */
7, /* Bank
*/
1, /* Start Sector */
1, /* End Sector */
},
};
Note: All the Virtual Sectors should have the same Flash Bank.
Only Bank 7 is supported for EEPROM emulation on F021 devices.
35
Integration Guide
3.6.27 Block Configuration
Array Name
Fee_BlockConfiguration
Description
Used to define a Data Block
Array Type
Fee_BlockConfigType.
This is a structure having the following members.
Members
Indicates Block's
FeeBlockNumber
Number.
Defines Block's Size in
FeeBlockSize
bytes.
Indicates if the block is
FeeImmediateData
used for immediate data.
Number of write cycles
FeeNumberOfWriteCycles
required for this block .
Indicates the device
FeeDeviceIndex
index.
Indicates the number of
FeeNumberofDatasets
Datasets for this Block.
Indicates on which EEP,
FeeEEPNumber
this block is configured.
Target File
Fee_cfg.c
The configurations described below are repeated for each Data Block.
3.6.27.1 FeeBlockNumber
Parameter Name
FeeBlockNumber
Description
Each block is assigned a unique number starting from 0x1.
Default Value
0x1
Parameter Range
Min : 0x1, Max : 0xFFFE
Target File
Fee_cfg.c
3.6.27.2 FeeBlockSize
Parameter Name
FeeBlockSize
Description
Indicates the size of the Block in bytes.
Default Value
0x08
Parameter Range
0x1 to 0xFFFE
Target File
Fee_cfg.c
36
3.6.27.3 FeeImmediateData
Parameter Name
FeeImmediateData
Description
Indicates if the block is used for immediate data.
Default Value
FALSE
Parameter Range
TRUE / FALSE
Target File
Fee_cfg.c
3.6.27.4 FeeNumberOfWriteCycles
Parameter Name
FeeNumberOfWriteCycles
Description
Indicates the number of clock cycles required to write
to a flash address location.
Default Value
0x1
Parameter Range
Device or core/flash tech dependent parameter.
Target File
Fee_cfg.c
3.6.27.5 FeeDeviceIndex
Parameter Name
FeeDeviceIndex
Description
Indicates the device index. This will always be 0.
Default Value
0x0
Parameter Range
Fixed to 0x0
Target File
Fee_cfg.c
3.6.27.6 FeeNumberOfDataSets
Parameter Name
FeeNumberOfDataSets
Description
Indicates the number of Datasets for this particular
Block .
Default Value
0x1
Parameter Range
0x1 to 0xFF
Target File
Fee_cfg.c
37
Integration Guide
3.6.27.7 FeeEEPNumber
Parameter Name
FeeEEPNumber
Description
Indicates into which EEP, this block is configured.
Default Value
0x0
Parameter Range
0x0 to 0x1
Target File
Fee_cfg.c
3.6.27.8 Sample Block Configuration
The following code snippet indicates one of the possible configurations for the Blocks:
/* Block Configuration */
const TI_FeeBlockConfigType TI_Fee_BlockConfiguration[] =
{
/* Block 1 */
{
0x01,
/* Block number
*/
0x004,
/* Block size
*/
0x10, /* Block number of write cycles */
TRUE, /* Block immediate data used */
0,
/* Device Index
*/
1,
/* Number of DataSets
*/
0
/* EEP Number
*/
},
/* Block 2 */
{
0x02,
/* Block number
*/
0x008,
/* Block size
*/
0x10, /* Block number of write cycles */
TRUE, /* Block immediate data used */
0,
/* Device Index
*/
2,
/* Number of DataSets
*/
1
/* EEP Number
*/
},
/* Block 3 */
{
0x03,
/* Block number
*/
0x0004,
/* Block size
*/
0x10, /* Block number of write cycles */
TRUE, /* Block immediate data used */
0,
/* Device Index
*/
3,
/* Number of DataSets
*/
1
/* EEP Number
*/
},
/* Block 4 */
{
0x04,
/* Block number
*/
0x001A, /* Block size
*/
38
0x10, /* Block number of write cycles */
TRUE, /* Block immediate data used */
0,
/* Device Index
*/
4,
/* Number of DataSets
*/
0
/* EEP Number
*/
},
};
39
Integration Guide
3.7 API Classification
This section introduces the application-programming interface for the AutoSAR FEE Driver
by grouping them into logical units. This is intended for the user to get a quick understanding
of the AutoSAR FEE Driver APIs. For detailed descriptions please refer to the API
specification section that follows this section.
3.7.1 Initialization
The AutoSAR FEE Driver APIs that are intended for use in initialization of the FEE module
are listed below.
Name
Description
Fee_Init
Used to initialize the FEE module
4-4. AutoSAR FEE Driver Initialization APIs
3.7.2 Data Operations
The AutoSAR FEE Driver APIs that are intended for performing Data operations on Data
Blocks are listed below.
Name
Description
Fee_Write
Used to initiate a Write Operation to a
Data Block. Fee_MainFunction should
be called at regular intervals to finish
the Write Operation
Fee_Read
Fee_MainFunction should be called at
regular intervals to finish this Operation
Fee_EraseImmediateBlock
Used to initiate an Erase Operation of a
Data Block. Fee_MainFunction should
be called at regular intervals to finish
this Operation
Fee_InvalidateBlock
Used to initiate an Invalidate Operation
on a Data Block. Fee_MainFunction
should be called at regular intervals to
finish this Operation
4-5. AutoSAR FEE Driver Data Operation APIs
40
3.7.3 Information
The AutoSAR FEE Driver APIs that are intended to get information about the status of the
FEE Module are listed below.
Name
Description
Fee_GetVersionInfo
Used to get the Driver version.
Fee_GetStatus
Used to get the status of the FEE module.
Fee_GetJobResult
Used to get the job result of a Data
Operation.
4-6. AutoSAR FEE Driver Information APIs
3.7.4 Internal Operations
The AutoSAR FEE Driver APIs that are used to perform internal operations of the FEE
Module are listed below.
Name
Description
Fee_MainFunction
Used to complete the Data Operations
initiated by any of the Data Operation
functions.
4-7. AutoSAR FEE Driver Internal Operation APIs
3.7.5 Cancel/ Terminate Operations
The AutoSAR FEE Driver APIs that are used to cancel/terminate an ongoing Data
Operation are listed below.
Name
Description
Fee_Cancel
Used to cancel an ongoing write, erase,
invalidate or read operation.
4-8. AutoSAR FEE Driver Terminate/Cancel Operation APIs
3.7.6 Error Information and Recovery Operations
The TI FEE Driver APIs that are used to provide error information and recover from severe
errors.
Name
Description
TI_FeeErrorCode
Function to know the error type.
Function to recover from severe errors.
TI_Fee_ErrorRecovery
4-9. AutoSAR FEE Driver Error Info and Recovery APIs
41
Integration Guide
3.7.7 Suspend/Resume Erase Sector
The TI FEE Driver APIs that are used to suspend/Resume erasing of sector.
Name
Description
TI_Fee_SuspendResumeErase Function to suspend/resume erasing
of sectors.
4-10. TI FEE Driver Suspend/Resume Erase Sector APIs
42
3.8 Integration Example
This section depicts a flow chart for a typical FEE operation.
Initialization
To be called only once at the
Fee_Init()
beginning to initialize the FEE
module.
FEE is in IDLE state after
successful initialization
Call any one of the data
operation functions as required.
A new operation can be initiated
only when the module is in “Idle”
state.
Schedule a Data Operation
FEE_Write() /
FEE_EraseImmediateBlock() /
To be called at regular
FEE_InvalidateBlock() /
intervals to complete the Data
FEE_Read()
operation.
Schedule Other
Fee_Main()
Application Tasks
TI_Fee_Main calls
TI_FeeInternal_FeeM
anager
Fee_GetStatus()
Called by Fee_Main() whenever in
No
IDLE?
“Idle” state to handle internal
ti
Yes
Fee_GetJobResult()
Returns the Job result of the last
operation.
43
Integration Guide
3.9 API Specification
This section constitutes the detailed reference for the entire API set published to users of the
AutoSAR FEE Driver.
For each of the published API listed, the following attributes are specified
• Prototype: The signature of the function and or macro method in question
• Description: The functionality of the procedure or macro
• Arguments: The list of parameters supplied by the user
• Return value: The evaluated return value from the procedure invoked
3.9.1 AutoSAR FEE Driver Functions
3.9.1.1
Fee Initilization Function
Prototype
void Fee_Init( )
Description
Used to initialize the FEE module
Arguments
None
Return value
None
The function Fee_Init() shall initialize the Fee module. This function shall initialize all Flash
Memory relevant registers (hardware) with parameters provided in the given configuration
set.
The function Fee_Init() shall initialize all Fee module global variables and those controller
registers that are needed for controlling the flash device and that do not influence or
depend on other (hardware) modules. Registers that can influence or depend on other
modules shall be initialized by a common system module.
This function shall set the Fee module state to MEMIF_IDLE after successfully finishing the
Fee module initialization.
Note: Do not call Fee_Init API multiple times in a single power cycle. There are
chances of some blocks getting lost(if there are different block configurations for
different instances of Fee_Init call ), if it’s called multiple times. If project
requirement needs to call Fee_Init multiple times, make sure .data and .bss sections
are cleared before calling Fee_Init.
44
3.9.1.2
Fee Write Function
Std_ReturnType Fee_Write(
Prototype
uint16 BlockNumber,
uint8* DataBufferPtr
)
Description
Used to initiate a Write Operation on a Data
Block / DataSet within a Data Block
BlockNumber The BlockNumber should comprise of the
number of the logical block and the Dataset
index within that logical block. The number of the
logical block is left shifted by the maximum
number of Datasets configures
(NVM_DATASET_SELECTION_BITS) and then
ts
combined with the Dataset index to obtain the
n
e
BlockNumber parameter.
m
u
DataBufferPtr
rg
Pointer to data buffer.
A
Return value
E_OK: The write job was accepted by the Fee
module
E_NOT_OK: The write job was not accepted by
the Fee module.
The function Fee_Write() shall take the block start address and calculate the
corresponding memory write address. This function shall copy the given/computed
parameters to module internal variables, initiate a write job, set Fee module status to
MEMIF_BUSY, set the job result to MEMIF_JOB_PENDING and return with E_OK.
The Fee module shall execute the job of the function Fee_Write() asynchronously within the
Fee module’s main function. This function shall write one or more complete flash pages to
the Flash device. The job of this function shall program a Flash memory block with data
provided via DataBufferPtr.
This function shall check the following:
1. That the write length is greater than 0. If this check fails, this function shall reject
the Write job and return with E_NOT_OK.
2. That the Fee module has been initialized. If this check fails, this function shall
reject the Write job and return with E_NOT_OK.
3. That the Fee module is currently not busy. If this check fails, this function shall
reject the Write job and return with E_NOT_OK.
4. The given data buffer pointer for not being a null pointer. If this check fails, this
function shall reject the Write job and return with E_NOT_OK.
Projects can configure FEE_NUMBER_OF_EIGHTBYTEWRITES to suitable value. By
default this is 0x1. This means 8 bytes of data are written for every main function call. If this
parameter is configured to 0x2, 16 bytes of data are written.
45
Integration Guide
3.9.1.3
Fee Read Function
Std_ReturnType Fee_Read(
Prototype
uint16 BlockNumber,
uint16 BlockOffset,
uint8* DataBufferPtr,
uint16 Length
)
Description
Used to perform a Read Operation on a Data Block /
DataSet within a Data Block
BlockNumber The BlockNumber should comprise of the number of
the logical block and the Dataset index within that
logical block. The number of the logical block is left
shifted by the maximum number of Datasets
configures (NVM_DATASET_SELECTION_BITS)
and then combined with the Dataset index to obtain
the BlockNumber parameter.
ts
Read address offset inside the block.
n
BlockOffset
e
m
u
DataBufferPtr Pointer to data buffer.
rg
Number of bytes to read.
A
Length
Return value
E_OK: The Read job was completed successfully.
E_NOT_OK: The Read job was not completed
successfully.
The function Fee_Read() shall take the block start address and offset and calculate the
corresponding memory read address. The address offset and length parameter can
take any value within the given types range. This allows reading of an arbitrary number
of bytes from an arbitrary star address inside a logical block.
The Fee module shall execute the job of the function Fee_Read() asynchronously
within the Fee module’s main function. This function shall initiate a read operation
which copies a continuous Flash memory block starting from the computed start
address to the size of Length to the buffer pointed to DataBufferPtr. This function shall
set Fee module status to MEMIF_BUSY, set the job result to MEMIF_JOB_PENDING
and return with E_OK.
This function shall check the following:
1. That the read length is greater than 0. If this check fails, this function shall reject
the Read job and return with E_NOT_OK.
2. That the Fee module has been initialized. If this check fails, this function shall
reject the Read job and return with E_NOT_OK.
3. That the Fee module is currently not busy. If this check fails, this function shall
reject the Read job and return with E_NOT_OK.
4. The given data buffer pointer for not being a null pointer. If this check fails, this
function shall reject the Read job and return with E_NOT_OK.
Main function will do complete data read in single main function call.
46
3.9.1.4
Fee Erase Function
Std_ReturnType Fee_EraseImmediateBlock(
Prototype
uint16 BlockNumber
)
Description
Used to initiate a logical Erase operation on a Data
Block / DataSet within a Data Block
BlockNumber The BlockNumber should comprise of the number of
the logical block and the Dataset index within that
ts
logical block. The number of the logical block is left
n
e
shifted by the maximum number of Datasets
m
u
configures (NVM_DATASET_SELECTION_BITS)
rg
and then combined with the Dataset index to obtain
A
the BlockNumber parameter.
Return value
E_OK: The Erase job was accepted by the Fee
module
E_NOT_OK: The Erase job was not accepted by
the Fee module.
The function Fee_ EraseImmediateBlock() shall take the block number calculate the
corresponding memory address for that block.
The Fee module shall execute the job of the function Fee_ EraseImmediateBlock()
asynchronously within the Fee module’s main function.
The function Fee_EraseImmediateBlock() ensures that the Fee module can write
immediate data. As the Fee module implementation should always be ready to write
data, unless the block is marked as FeeImmediateData == FALSE, it shall return
E_OK. If the block is marked as FeeImmediateData == FALSE it will return
E_NOT_OK.
This function shall check the following:
1.
That the Fee module has been initialized. If this check fails, this function shall
reject the Erase job and return with E_NOT_OK.
2.
That the Fee module is currently not busy. If this check fails, this function shall
reject the Erase job and return with E_NOT_OK.
3.
The given Block Number is marked for Immediate Data Write. If this check fails,
this function shall reject the Erase job and return with E_NOT_OK.
47
Integration Guide
3.9.1.5
Fee Invalidate Function
Std_ReturnType Fee_InvalidateBlock(
Prototype
uint16 BlockNumber
)
Description
Used to initiate a logical Invalidate operation on a
Data Block / DataSet within a Data Block
BlockNumb
The BlockNumber should comprise of the number of
er
the logical block and the Dataset index within that
ts
logical block. The number of the logical block is left
n
e
shifted by the maximum number of Datasets
m
u
configures (NVM_DATASET_SELECTION_BITS) and
rg
then combined with the Dataset index to obtain the
A
BlockNumber parameter.
Return value
E_OK: The Invalidate job was accepted by the Fee
module
E_NOT_OK: The Invalidate job was not accepted by
the Fee module.
The function Fee_ InvalidateBlock() shall take the block number calculate the
corresponding memory address for that block.
The Fee module shall execute the job of the function
Fee_ InvalidateBlock() asynchronously within the Fee module’s main function. This
command shall change the valid bit in the Data Block header to invalidate it.
This function shall check the following:
1.
That the Fee module has been initialized. If this check fails, this function shall
reject the Invalidate job and return with E_NOT_OK.
2.
That the Fee module is currently not busy. If this check fails, this function shall
reject the Invalidate job and return with E_NOT_OK.
48
3.9.1.6
Fee Get Version Info Function
void Fee_GetVersionInfo(
Prototype
Std_VersionInfoType* VersionInfoPtr
)
Description
Function to return the version information of the Fee
module.
Arguments
None
Return value
None
The function Fee_GetVersionInfo() shall return the version information for the Fee module.
The version information includes:
- Module Id
- Vendor Id
- Fee specific version numbers MM.mm.rr
• MM
– Major Version
• mm
– Minor Version
• rr
– Revision
The function Fee_GetVersionInfo() shall be pre-compile time configurable On/Off by the
configuration parameter FEE_VERSION_INFO_API.
3.9.1.7
Fee Get Status Function
Prototype
MemIf_StatusType Fee_GetStatus()
Description
Function to return the status of the Fee module.
Arguments
None
Return value
MEMIF_UNINIT: The Fee Module has not been
initialized.
MEMIF_IDLE: The Fee Module is currently idle.
MEMIF_BUSY: The Fee Module is currently busy.
MEMIF_BUSY_INTERNAL: The Fee Module is
currently busy with internal management
operations
The function Fee_ GetStatus() shall return the status information for the Fee module.
The function Fee_ GetStatus() shall be pre-compile time configurable On/Off by the
configuration parameter FEE_GET_STATUS_API.
49
Integration Guide
3.9.1.8
Fee Get Job Result Function
Prototype
MemIf_JobResultType Fee_GetJobResult()
Description
Function to get the job result from the Fee module.
Arguments
None
MEMIF_JOB_OK: The last job has finished
Return value
successfully.
MEMIF_JOB_PENDING: The last job is waiting for
execution or is currently being executed.
MEMIF_JOB_FAILED: The last
read/erase/write/compare job failed.
MEMIF_BLOCK_INCONSISTENT: The requested
block is inconsistent, it may contain corrupted data.
MEMIF_JOB_CANCELLED: The last job has been
cancelled.
MEMIF_BLOCK_INVALID: The requested block has
been invalidated. The requested read operation
cannot be performed.
The function Fee_GetJobResult() shall return the result of the last job synchronously. The
erase, write, read and invalidate functions shall share the same job result, therefore, only
the result of the last job can be queried.
The function Fee_GetJobResult shall be pre-compile time configurable On/Off by the
configuration parameter FEE_GET_JOB_RESULT_API.
3.9.1.9
Fee Main Function
Prototype
void Fee_MainFunction()
Description
Function to handle the requested read/write/erase jobs
and the internal management operations of the Fee
module.
Arguments
None
Return value
None
The function Fee_MainFunction() shall asynchronously handle the requested read/write/
erase jobs respectively and the internal management operations.
The function shall accept only one read, write, or erase job at a time. When a job has been
initiated, the Fee module’s environment shall call the function Fee_MainFunction() cyclically
until the job is finished. This function shall only process as much data in one call cycle as
statically configured for the current job type (read, write or erase).
After a read, erase or write job has been finished; the function shall set the Fee module’s
job result to MEMIF_JOB_OK if it is currently in state
50
MEMIF_JOB_PENDING. Otherwise, it shall leave the result unchanged.
Furthermore, the function shall set the Fee module’s state to MEMIF_IDLE and call
the job end notification function.
This function shall at most issue one sector erase command (to the hardware) in
each cycle.
3.9.1.10 Fee Manager Function
Fee_StatusType
Prototype
TI_FeeInternal_FeeManager(void)
Description
Function to handle the internal operations of the FEE
driver.
Arguments
None
Return value
FEE_OK : Function detected No Error
FEE_ERROR: Function detected an Error
condition and returned.
The function TI_FeeInternal_FeeFeeManager() manages the Flash EEPROM Emulation
and is called when no other job is pending by the Fee_MainFunction. This function handles
all the background tasks to manage the FEE.
This routine is responsible to
•
Determine whether a Virtual Sector Copy operation is in progress. If so, it should
identify all the Valid Data Blocks in the old Virtual Sector and copy them to the new
Virtual Sector.
•
Determine if any of the Virtual Sector needs to be erased. If so, it should erase that
particular Virtual Sector.
•
This function is only called when the Fee module is in MEMIF_IDLE state. It should
set the Fee module to MEMIF_BUSY_INTERNAL state.
3.9.1.11 Fee Cancel Function
void Fee_Cancel(void)
Prototype
Description
Function to cancel/terminate an ongoing operation.
Arguments
None
Return value
None
The function Fee_Cancel() provides functionality for cancelling/terminating an ongoing
operation. This function shall cancel an ongoing flash read, write or erase job and shall
reset the internal variables making the module ready to accept a new job. This function
shall operate synchronously so after returning from this function a new job can be started.
51
Integration Guide
3.9.1.12 TI_FeeErrorCode
This function provides functionality to identify occurrence of an error.
It returns ‘0’ if no error has occurred else it returns an Error code.
TI_FeeErrorCodeType TI_FeeErrorCode(uint8
Prototype
u8EEPIndex )
Description
Function to know the error type.
Arguments
EEP Index
Return value
Error code
3.9.1.13 TI_Fee_ErrorRecovery
This function provides functionality to recover from any severe errors.
Void TI_Fee_ErrorRecovery(TI_Fee_ErrorCodeType Error
Prototype
Code, uint8 u8VirtualSector)
Function to recover from severe errors.
Description
Arguments
Error_TwoActiveVS
Error_TwoCopyVS
Error_SetupStateMachine
Error Code
Error_NoActiveVS
Error_CopyButNoActiveVS
Error_NoFreeVS
Virtual Sector Number
Return value
None
3.9.1.14 TI_Fee_SuspendResumeErase
This function provides functionality to suspend/Resume of erasing a sector.
void
Prototype
TI_Fee_SuspendResumeErase(TI_Fee_EraseCommandType
Command)
Description Function to suspend/Resume erasing of sector.
Arguments
Suspend_Erase/Resume_Erase
Return
none
value
52
Note: This API has to be called once after Fee_Init is executed with Suspend_Erase as
function argument. It has to be called again after application has completed all the
initialization sequence with Resume_Erase as function argument.
3.10 Privilege Mode access
FEE needs following API’s to be executed in Privilege mode:
- Fee_Init
- TI_FeeInternal_WriteDataF021
- TI_Fee_Read
3.11 Deviations from Autosar3.x requirements
- Non Polling mode not supported.
- Immediate block writing not accepted when FEE is performing copy of blocks / erase of
sectors.
- No Jobs accepted during copy of blocks /erase of sectors ongoing.(The write job which
triggered the copy operation will be pending until copy of blocks is completed and then
erasing of a sector is completed. If there is a powerloss during copying of blocks, then the
next Fee_Init will resume COPY operation.)
3.12 Important Notes
-
If projects are using bootloader, make sure the active bank in FMAC register is same as
before the start of bootloader and after the completion of bootloader.
-
Projects should not call Fee_Init mutiple times in one power cycle. If it is required to call,
make sure all the global, static variable sections are cleared before calling Fee_Init.
53
Document Outline
- AutoSAR FEE Driver
- Overview
- The EEPROM Emulation Flash bank is divided into two or more Virtual Sectors. Each Virtual Sector is further partitioned into several Data Blocks. Data Blocks can be further partitioned into Datasets. A minimum of two Virtual Sectors are required for ...
- The initialization routine (Fee_Init) identifies which Virtual Sector to be used and marks it as Active. The data is written to the first empty location in the Active Virtual Sector. If there is insufficient space in the current Virtual Sector to upda...
- Virtual Sectors and Data Blocks have certain space allocated to maintain the status information which is described in more detail in the following sections.
- The Virtual Sector Structure is the basic organizational unit used to partition the EEPROM Emulation Flash Bank. This structure can contain one or more contiguous Flash Sectors contained within one Flash Bank. A minimum of 2 Virtual Sectors are requ...
- The internal structure of the Virtual Sector contains a Virtual Sector Header, a static Data Structure and the remaining space is used for Data Blocks.
- 3.10 Privilege Mode access
- 3.11 Deviations from Autosar3.x requirements
- 3.12 Important Notes
2.7 - DataSheet_TMS570LS0714
2.9 - DataSheet_TMS570LS0714s

Autosar FEE 01.23.02
Data Sheet for TMS570LS0714
14th Mar 2016
Copyright © 2003-2016 Texas Instruments Incorporated. All rights reserved.
Information in this document is subject to change without notice. Texas Instruments may have pending
patent applications, trademarks, copyrights, or other intellectual property rights covering matter in this
document. The furnishing of this documents is given for usage with Texas Instruments products only and
does not give you any license to the intellectual property that might be contained within this document.
Texas Instruments makes no implied or expressed warranties in this document and is not responsible for
the products based from this document.
`
Page 1 of 4

`
TABLE OF CONTENTS
1
Memory FootPrint ......................................................................................... 3
2
Performance Numbers on API’s ................................................................... 3
Page 2 of 4

`
1
Memory FootPrint
In Bytes
Modules
.text
.const
.bss
.data
FEE
20692
1056 1392
13
Above readings were taken with following compiler settings:
Compiler version : 5.1.6
-mv7R4
--code_state=32
--float_support=VFPv3D16
--abi=eabi
-O2
-g
--
diag_warning=261 --diag_warning=118 --diag_warning=225 --diag_error=189 --
diag_error=994 --diag_error=551 --display_error_number --enum_type=packed
2
Performance Numbers on API’s
Numbers In CPU Cycles @ 160 MHz
API
Ticks
Comments
TI FEE
Create two active VS,
one each for
EEPROM1 and
Fee_Init()
2547466 EEPROM2.
Complete Pending
Fee_MainFunction()
2050 INIT writes.
Fee_Write()
10084 Measure time to
complete write
job.(block size = 8.
Fee_MainFunction()
37012 Total 40 bytes)
When no jobs are
Fee_MainFunction()
751 pending.
Fee_Read()
3679
Measure time to
complete Read job(8
Fee_MainFunction()
1608 bytes)
Fee_InvalidateBlock()
1230 Measure time to
complete Invalidate
Fee_MainFunction()
2035 job.
Fee_EraseImmediateBlock()
1514 Measure time to
Fee_MainFunction()
2041 complete
Page 3 of 4

`
EraseImmediate job.
Fee_Cancel()
318
Fee_GetJobResult()
209
Fee_GetVersionInfo( )
73
Fee_GetStatus( )
303
Note: For above readings, 4 physical sectors, each of 4K were combined to one virtual
sector forming 16K. Two EEPROM’s, each using two 16K virtual sectors.
Page 4 of 4
Document Outline
- Autosar FEE 01.23.02
- Data Sheet for TMS570LS0714
- 14th Mar 2016
- TABLE OF CONTENTS
- 1 Memory FootPrint
- 2 Performance Numbers on API’s
2.10 - DataSheet_TMS570LS1227
2.12 - DataSheet_TMS570LS1227s

Autosar FEE 01.23.02
Data Sheet for TMS570LS1227
15th Mar 2016
Copyright © 2003-2016 Texas Instruments Incorporated. All rights reserved.
Information in this document is subject to change without notice. Texas Instruments may have pending
patent applications, trademarks, copyrights, or other intellectual property rights covering matter in this
document. The furnishing of this documents is given for usage with Texas Instruments products only and
does not give you any license to the intellectual property that might be contained within this document.
Texas Instruments makes no implied or expressed warranties in this document and is not responsible for
the products based from this document.
`
Page 1 of 4

`
TABLE OF CONTENTS
1
Memory FootPrint ......................................................................................... 3
2
Performance Numbers on API’s ................................................................... 3
Page 2 of 4

`
1
Memory FootPrint
In Bytes
Modules
.text
.const
.bss
.data
FEE
18856
128 1012
13
Above readings were taken with following compiler settings:
Compiler version : 5.0.4
-mv7R4
--code_state=32
--float_support=VFPv3D16
--abi=eabi
-O2
-g
--
diag_warning=261 --diag_warning=118 --diag_warning=225 --diag_error=189 --
diag_error=994 --diag_error=551 --display_error_number --enum_type=packed
2
Performance Numbers on API’s
Numbers In CPU Cycles @ 160 MHz
API
Ticks
Comments
TI FEE
Create two active VS,
one each for
EEPROM1 and
Fee_Init()
2843034 EEPROM2.
Complete Pending
Fee_MainFunction()
2082 INIT writes.
Fee_Write()
9501 Measure time to
complete write
job.(block size = 8.
Fee_MainFunction()
29786 Total 40 bytes)
When no jobs are
Fee_MainFunction()
746 pending.
Fee_Read()
2112
Measure time to
complete Read job(8
Fee_MainFunction()
1608 bytes)
Fee_InvalidateBlock()
1258 Measure time to
complete Invalidate
Fee_MainFunction()
2018 job.
Fee_EraseImmediateBlock()
1468 Measure time to
Fee_MainFunction()
2050 complete
Page 3 of 4

`
EraseImmediate job.
Fee_Cancel()
324
Fee_GetJobResult()
183
Fee_GetVersionInfo( )
82
Fee_GetStatus( )
335
Page 4 of 4
Document Outline
- Autosar FEE 01.23.02
- Data Sheet for TMS570LS1227
- 15th Mar 2016
- TABLE OF CONTENTS
- 1 Memory FootPrint
- 2 Performance Numbers on API’s
2.13 - Fee_Review_Checklists
Overview
Summary SheetSource Code
QAC
Sheet 1: Summary Sheet
Sheet 2: Source Code
Rev 6.0 | 28-Oct-14 | |||||||||||||||||||||||
Peer Review Meeting Log (Source Code Review) | ||||||||||||||||||||||||
Source File Name: | Source File Revision: | |||||||||||||||||||||||
Module Design Document Name: | MDD Revision: | |||||||||||||||||||||||
Data Dictionary Revision: | FDD/SER/CMS | |||||||||||||||||||||||
and Revision: | ||||||||||||||||||||||||
Quality Check Items: | ||||||||||||||||||||||||
Yes | No | Rationale is required for all answers of No | ||||||||||||||||||||||
Pre-review checklist for change owners | Software Naming Convention V1.2 followed: | |||||||||||||||||||||||
for variable names | X | Comments: | See comments at end of form | |||||||||||||||||||||
for constant names | X | Comments: | See comments at end of form | |||||||||||||||||||||
for function names | X | Comments: | See comments at end of form | |||||||||||||||||||||
for other names (component, memory | X | Comments: | See comments at end of form | |||||||||||||||||||||
mapping handles, typedefs, etc.) | ||||||||||||||||||||||||
All buffered outputs written in every path, i.e. no | X | Comments: | See comments at end of form | |||||||||||||||||||||
possibility of an uninitialized value being written | ||||||||||||||||||||||||
Group-review Checklist (review board) | Synergy version matches change history | X | Comments: | See comments at end of form | ||||||||||||||||||||
and Version Control version in file comment block | ||||||||||||||||||||||||
Change log contains detailed description of changes | X | Comments: | See comments at end of form | |||||||||||||||||||||
and CR number | ||||||||||||||||||||||||
Code accurately implements FDD (Document or Model) | X | Comments: | See comments at end of form | |||||||||||||||||||||
No Compiler Errors or Warnings verified | X | Comments: | See comments at end of form | |||||||||||||||||||||
FDD test points exist as display variables: declared | X | Comments: | See comments at end of form | |||||||||||||||||||||
static volatile, written once and never used, names | ||||||||||||||||||||||||
match the FDD | ||||||||||||||||||||||||
Software Design and Coding Standards V2.0 followed: | ||||||||||||||||||||||||
Code comments are clear, correct, and adequate | X | Comments: | See comments at end of form | |||||||||||||||||||||
and have been updated for the change: [N40] and | ||||||||||||||||||||||||
all other rules in the same section as rule [N40], | ||||||||||||||||||||||||
plus [N75], [N12], [N23], [N33], [N37], [N38], | ||||||||||||||||||||||||
[N48], [N54], [N77], [N79], [N72] | ||||||||||||||||||||||||
Source file (.c and .h) comment blocks are per | X | Comments: | See comments at end of form | |||||||||||||||||||||
standards and contain correct information: [N41], [N42] | ||||||||||||||||||||||||
Function comment blocks are per standards and | X | Comments: | See comments at end of form | |||||||||||||||||||||
contain correct information: [N43] | ||||||||||||||||||||||||
Code formatting (indentation, placement of | X | Comments: | See comments at end of form | |||||||||||||||||||||
braces, etc.) is per standards: [N5], [N55], [N56], | ||||||||||||||||||||||||
[N57], [N58], [N59] | ||||||||||||||||||||||||
Embedded constants used per standards; no | X | Comments: | See comments at end of form | |||||||||||||||||||||
"magic numbers": [N12] | ||||||||||||||||||||||||
All variables and constants defined at module | X | Comments: | See comments at end of form | |||||||||||||||||||||
level are included in appropriate MemMap | ||||||||||||||||||||||||
section: [N25] and Naming Conventions | ||||||||||||||||||||||||
All execution-order-dependent code can be | X | Comments: | See comments at end of form | |||||||||||||||||||||
recognized by the compiler: [N80] | ||||||||||||||||||||||||
No possibility of a non-terminating loop: [N63] | X | Comments: | See comments at end of form | |||||||||||||||||||||
No possibility of divide by zero: [N65] | X | Comments: | See comments at end of form | |||||||||||||||||||||
All integer division and modulus operations | X | Comments: | See comments at end of form | |||||||||||||||||||||
handle negative numbers correctly: [N76] | ||||||||||||||||||||||||
All typecasting and fixed point arithmetic, | X | Comments: | See comments at end of form | |||||||||||||||||||||
including all use of fixed point macros and | ||||||||||||||||||||||||
timer functions, is correct and has no possibility | ||||||||||||||||||||||||
of unintended overflow or underflow: [N66] | ||||||||||||||||||||||||
No possibility of converting a negative floating | X | Comments: | See comments at end of form | |||||||||||||||||||||
point value to an unsigned type: [N67] | ||||||||||||||||||||||||
All conversions between signed and unsigned | X | Comments: | See comments at end of form | |||||||||||||||||||||
types handle msb==1 as intended: [N78] | ||||||||||||||||||||||||
No possibility of dereferencing a null | X | Comments: | See comments at end of form | |||||||||||||||||||||
pointer: [N70] | ||||||||||||||||||||||||
Global outputs (RTE and Non-RTE) Initialized: | X | Comments: | See comments at end of form | |||||||||||||||||||||
[N24] | ||||||||||||||||||||||||
Module outputs are limited to the legal range | X | Comments: | See comments at end of form | |||||||||||||||||||||
defined in the FDD Data dictionary: [N53] | ||||||||||||||||||||||||
All code is mapped with FDD (all FDD | X | Comments: | See comments at end of form | |||||||||||||||||||||
subfunctions and/or model blocks identified | ||||||||||||||||||||||||
with code comments; all code corresponds to | ||||||||||||||||||||||||
some FDD subfunction and/or model block): [N40] | ||||||||||||||||||||||||
Struct types used for NvM have | X | Comments: | See comments at end of form | |||||||||||||||||||||
elements declared in decreasing order by size | ||||||||||||||||||||||||
and are not nested or used in arrays: [N84], [N85] | ||||||||||||||||||||||||
No violations of other coding standard rules | X | Comments: | See comments at end of form | |||||||||||||||||||||
identified during review | ||||||||||||||||||||||||
General Notes / Comments: | ||||||||||||||||||||||||
Code is provided by TI for the FEE driver, which they do not follow our same coding standards and conventions. The review consisted of ensuring that | ||||||||||||||||||||||||
files provided with version 1.23.3 of the FEE driver were captured in the baseline for the FEE component. | ||||||||||||||||||||||||
Change Owner: | Kevin Smith | Review Date : | 08/08/16 | |||||||||||||||||||||
Lead Peer Reviewer: | Ramanujan V. | Approved by Reviewer(s): | Yes | |||||||||||||||||||||
Other Reviewer(s): | ||||||||||||||||||||||||
Sheet 3: QAC
Rev 6.0 | 28-Oct-14 | |||||||||||||||||||||||
Peer Review Meeting Log (QAC Review) | ||||||||||||||||||||||||
Module Name: | Source File Revision: | N/A | Module | of | ||||||||||||||||||||
Compliance Guidelines Version: | ||||||||||||||||||||||||
Quality Check Items: | ||||||||||||||||||||||||
Yes | No | Rationale is required for all answers of No | ||||||||||||||||||||||
Pre-review checklist for change owners | QAC version is correct and did not change (List version) | X | Comments: | See comment section below | ||||||||||||||||||||
Contract Folder's header files are appropriate | X | Comments: | See comment section below | |||||||||||||||||||||
Group-review Checklist (review board) | 100% Compliance to the MISRA Compliance Guidelines | X | Comments: | See comment section below | ||||||||||||||||||||
Cyclomatic complexity and Static path count ok per | X | Comments: | See comment section below | |||||||||||||||||||||
Design and Coding Standards rule [N47] | ||||||||||||||||||||||||
General Notes / Comments: | ||||||||||||||||||||||||
While QAC was performed on all the source files from TI, none of the warnings were corrected | ||||||||||||||||||||||||
We verified that there were no QAC warnings for changed lines of code | ||||||||||||||||||||||||
Change Owner: | Kevin Smith | Review Date : | 08/08/16 | |||||||||||||||||||||
Lead Peer Reviewer: | Ramanujan V. | Approved by Reviewer(s): | Yes | |||||||||||||||||||||
Other Reviewer(s): | ||||||||||||||||||||||||
3 - Flash Driver
Flash Driver
Component Documentation
- F021_Flash_API_License_Agreement.html
- F021_Flash_API_License_Agreement.pdf
- F021_Flash_API_License_Agreement_ind.html
- F021_Flash_API_License_Agreements.html
- Release_Notes.html
- Release_Notes.pdf
- Release_Notes_ind.html
- Release_Notess.html
- SPNA148.html
- SPNA148.pdf
- SPNA148_ind.html
- SPNA148s.html
- SPNU501F.html
- SPNU501F.pdf
- SPNU501F_ind.html
- SPNU501Fs.html
- SPNZ210.html
- SPNZ210.pdf
- SPNZ210_ind.html
- SPNZ210s.html
3.1 - F021_Flash_API_License_Agreement
3.3 - F021_Flash_API_License_Agreements
Software License Agreement
IMPORTANT – PLEASE CAREFULLY READ THE FOLLOWING LICENSE AGREEMENT, WHICH IS LEGALLY BINDING. AFTER YOU READ THIS
LICENSE AGREEMENT, YOU WILL BE ASKED WHETHER YOU ACCEPT AND AGREE TO ITS TERMS. DO NOT CLICK “I ACCEPT” UNLESS:
(1) YOU WILL USE THE LICENSED MATERIALS FOR YOUR OWN BENEFIT AND PERSONALLY ACCEPT, AGREE TO AND INTEND TO BE
BOUND BY THESE TERMS; OR (2) YOU ARE AUTHORIZED TO, AND INTEND TO BE BOUND BY, THESE TERMS ON BEHALF OF YOUR
COMPANY.
Important – Read carefully: This Software License Agreement (“Agreement”) is a legal agreement between you and
Texas Instruments Incorporated (“TI”). In this Agreement “you” means you personally if you will exercise the rights granted
for your own benefit, but it means your company (or you on behalf of your company) if you will exercise the rights granted
for your company’s benefit. The “Licensed Materials” subject to this Agreement include the software programs and any
associated electronic documentation (in each case, in whole or in part), that accompany this Agreement and you access
“on-line”, as well as any updates or upgrades to such software programs or documentation, if any, provided to you at TI’s
sole discretion. The Licensed Materials are specifically designed and licensed for use solely and exclusively with
semiconductor devices manufactured by or for TI (“TI Devices”). By installing, copying or otherwise using the Licensed
Materials you agree to abide by the provisions set forth herein. This Agreement is displayed for you to read prior to using
the Licensed Materials. If you choose not to accept or agree with these provisions, do not download or install the Licensed
Materials.
1.
License Grant and Use Restrictions.
a.
Licensed Materials License Grant. Subject to the terms of this Agreement, TI hereby grants to you a limited,
non-transferable, non-exclusive, non-assignable, non-sub-licensable, fully paid-up and royalty-free license to:
i. Object Code Evaluation, Testing and Use License: make copies, display internally, distribute internally and
use internally the Licensed Materials in object code for the sole purposes of evaluating and testing the Licensed
Materials and designing and developing Licensee Products, and maintaining and supporting the Licensee
Products. For purposes of this Agreement, “Licensee Product” means a product that consists of both: (i)
hardware, including one or more TI Devices, and (ii) software components, including only executable versions of
the Licensed Materials that execute solely and exclusively on such TI Devices;
ii. Demonstration License: demonstrate to third parties the Licensed Materials executing solely and exclusively
on TI Devices as they are used in Licensee Products, provided that such Licensed Materials are demonstrated in
object or executable versions only and
iii. Production and Distribution License: make, use, import, export and otherwise distribute the Licensed
Materials as part of a Licensee Product, provided that such Licensee Products include only embedded
executable copies of such Licensed Materials that execute solely and exclusively on TI Devices.
b. Contractors. The licenses granted to you hereunder shall include your on-site and off-site contractors (either an
individual or entity), while such contractors are performing work for or providing services to you, provided that such
contractors have executed work-for-hire agreements with you containing applicable terms and conditions consistent
with the terms and conditions set forth in this Agreement and provided further that you shall be liable to TI for any
breach by your contractors of this Agreement to the same extent as you would be if you had breached the
Agreement yourself.
c. No Other License. Nothing in this Agreement shall be construed as a license to any intellectual property rights of
TI other than those rights embodied in the Licensed Materials provided to you by TI. EXCEPT AS PROVIDED
HEREIN, NO OTHER LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY OTHER TI
INTELLECTUAL PROPERTY RIGHTS IS GRANTED HEREIN.
Page 1 of 5
Flash API Click-Wrap (May 2014)
d. Covenant not to Sue. During the term of this Agreement, you agree not to assert a claim against TI or its
licensees that the Licensed Materials infringe your intellectual property rights.
e. Restrictions. You shall not use the Licensed Materials with a processing device other than a TI Device, and you
agree that any such unauthorized use of the Licensed Materials is a material breach of this Agreement. You shall
not use the Licensed Materials for the purpose of analyzing or proving infringement of any of your patents by either
TI or TI’s customers. Except as expressly provided in this Agreement, you shall not copy, publish, disclose, display,
provide, transfer or make available the Licensed Materials to any third party and you shall not sublicense, transfer, or
assign the Licensed Materials or your rights under this Agreement to any third party. You shall not mortgage, pledge
or encumber the Licensed Materials in any way. You may use the Licensed Materials with Open Source Software or
with software developed using Open Source Software tools provided you do not incorporate, combine or distribute
the Licensed Materials in a manner that subjects the Licensed Materials to any license obligations or any other
intellectual property related terms of any license governing such Open Source Software. "Open Source Software"
means any software licensed under terms requiring that (A) the software provided under this Agreement
(“Proprietary Software”) incorporated, combined or distributed with such software or developed using such
software: (i) be disclosed or distributed in source code form; or (ii) otherwise be licensed on terms inconsistent with
the terms of this Agreement, including but not limited to permitting use of the Proprietary Software on or with devices
other than TI Devices, or (B) require the owner of Proprietary Software to license any of its patents to users of the
Open Source Software and/or Proprietary Software incorporated, combined or distributed with such Open Source
Software or developed using such Open Source Software.
f. Termination. This Agreement is effective on the date the Licensed Materials are delivered to you together with
this Agreement and will remain in full force and effect until terminated. You may terminate this Agreement at any
time by written notice to TI. Without prejudice to any other rights, if you fail to comply with the terms of this
Agreement or you are acquired, TI may terminate your right to use the Licensed Materials upon written notice to you.
Upon termination of this Agreement, you will destroy any and all copies of the Licensed Materials in your possession,
custody or control and provide to TI a written statement signed by your authorized representative certifying such
destruction. Except for Sections 1(a), 1(b) and 1(d), all provisions of this Agreement shall survive termination of this
Agreement.
2.
Licensed Materials Ownership. The Licensed Materials are licensed, not sold to you, and can only be used in
accordance with the terms of this Agreement. Subject to the licenses granted to you pursuant to this Agreement, TI,
and its licensors, own and shall continue to own all right, title and interest in and to the Licensed Materials, including
all copies thereof. You agree that all fixes, modifications and improvements to the Licensed Materials conceived of
or made by TI that are based, either in whole or in part, on your feedback, suggestions or recommendations are the
exclusive property of TI and all right, title and interest in and to such fixes, modifications or improvements to the
Licensed Materials will vest solely in TI. Moreover, you acknowledge and agree that when your independently
developed software or hardware components are combined, in whole or in part, with the Licensed Materials, your
right to use the combined work that includes the Licensed Materials remains subject to the terms and conditions of
this Agreement.
3.
Intellectual Property Rights.
a. The Licensed Materials contain copyrighted material, trade secrets and other proprietary information of TI and its
licensors and are protected by copyright laws, international copyright treaties, and trade secret laws, as well as other
intellectual property laws. To protect TI’s and its licensors’ rights in the Licensed Materials, you agree, except as
specifically permitted by statute by a provision that cannot be waived by contract, not to “unlock”, decompile, reverse
engineer, disassemble or otherwise translate to a human-perceivable form any portions of the Licensed Materials
provided to you in object code format only, nor permit any person or entity to do so. You shall not remove, alter,
cover, or obscure any confidentiality, trade secret, trade mark, patent, copyright or other proprietary notice or other
identifying marks or designs from any component of the Licensed Materials and you shall reproduce and include in
all copies of the Licensed Materials the copyright notice(s) and proprietary legend(s) of TI and its licensors as they
appear in the Licensed Materials. TI reserves all rights not specifically granted under this Agreement.
b. Certain Licensed Materials may be based on industry recognized standards or software programs published by
industry recognized standards bodies and certain third parties may claim to own patents, copyrights, and other
intellectual property rights that cover implementation of those standards. You acknowledge and agree that this
Page 2 of 5
Flash API Click-Wrap (May 2014)
Agreement does not convey a license to any such third party patents, copyrights, and other intellectual property
rights and that you are solely responsible for any patent, copyright, or other intellectual property right claim that
relates to your use or distribution of the Licensed Materials or your use or distribution of your products that include or
incorporate the Licensed Materials. Moreover, you acknowledge that you are responsible for any fees or royalties
that may be payable to any third party based on such third party’s interests in the Licensed Materials or any
intellectual property rights that cover implementation of any industry recognized standard, any software program
published by any industry recognized standards bodies or any other proprietary technology.
4.
Audit Right. At TI's request, and within thirty (30) calendar days after receiving written notice, you shall permit an
internal or independent auditor selected by TI to have access, no more than once each calendar year (unless the
immediately preceding audit revealed a discrepancy) and during your regular business hours, to all of your
equipment, records, and documents as may contain information bearing upon the use of the Licensed Materials.
You shall keep full, complete, clear and accurate records with respect to product sales and distributions for a period
beginning with the then-current calendar year and going back three (3) years.
5.
Confidential Information. You acknowledge and agree that the Licensed Materials contain trade secrets and other
confidential information of TI and its licensors. You agree to use the Licensed Materials solely within the scope of
the licenses set forth herein, to maintain the Licensed Materials in strict confidence, to use at least the same
procedures and degree of care that you use to prevent disclosure of your own confidential information of like
importance but in no instance less than reasonable care, and to prevent disclosure of the Licensed Materials to any
third party, except as may be necessary and required in connection with your rights and obligations hereunder;
provided, however, that you may not provide the Licensed Materials to any business organization or group within
your company or to customers or contractors that design or manufacture semiconductors unless TI gives written
consent. You agree to obtain executed confidentiality agreements with your employees and contractors having
access to the Licensed Materials and to diligently take steps to enforce such agreements in this respect. TI may
disclose your contact information to TI’s licensors.
6.
Warranties and Limitations. THE LICENSED MATERIALS ARE PROVIDED “AS IS”. FURTHERMORE, YOU
ACKNOWLEDGE AND AGREE THAT THE LICENSED MATERIALS HAVE NOT BEEN TESTED OR CERTIFIED
BY ANY GOVERNMENT AGENCY OR INDUSTRY REGULATORY ORGANIZATION OR ANY OTHER THIRD
PARTY ORGANIZATION. YOU AGREE THAT PRIOR TO USING, INCORPORATING OR DISTRIBUTING THE
LICENSED MATERIALS IN OR WITH ANY COMMERCIAL PRODUCT THAT YOU WILL THOROUGHLY TEST
THE PRODUCT AND THE FUNCTIONALITY OF THE LICENSED MATERIALS IN OR WITH THAT PRODUCT AND
BE SOLELY RESPONSIBLE FOR ANY PROBLEMS OR FAILURES.
TI AND ITS LICENSORS MAKE NO WARRANTY OR REPRESENTATION, WHETHER EXPRESS, IMPLIED OR
STATUTORY, REGARDING THE LICENSED MATERIALS, INCLUDING BUT NOT LIMITED TO ANY IMPLIED
WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT
OF ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADE SECRETS OR OTHER INTELLECTUAL PROPERTY
RIGHTS. YOU AGREE TO USE YOUR INDEPENDENT JUDGMENT IN DEVELOPING YOUR PRODUCTS.
NOTHING CONTAINED IN THIS AGREEMENT WILL BE CONSTRUED AS A WARRANTY OR
REPRESENTATION BY TI TO MAINTAIN PRODUCTION OF ANY TI SEMICONDUCTOR DEVICE OR OTHER
HARDWARE OR SOFTWARE WITH WHICH THE LICENSED MATERIALS MAY BE USED.
IN NO EVENT SHALL TI OR ITS LICENSORS, BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
PUNITIVE OR CONSEQUENTIAL DAMAGES, HOWEVER CAUSED, ON ANY THEORY OF LIABILITY, IN
CONNECTION WITH OR ARISING OUT OF THIS AGREEMENT OR THE USE OF THE LICENSED MATERIALS
REGARDLESS OF WHETHER TI HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. EXCLUDED
DAMAGES INCLUDE, BUT ARE NOT LIMITED TO, COST OF REMOVAL OR REINSTALLATION, OUTSIDE
COMPUTER TIME, LABOR COSTS, LOSS OF DATA, LOSS OF GOODWILL, LOSS OF PROFITS, LOSS OF
SAVINGS, OR LOSS OF USE OR INTERRUPTION OF BUSINESS. IN NO EVENT WILL TI’S OR ITS
LICENSORS’ AGGREGATE LIABILITY UNDER THIS AGREEMENT OR ARISING OUT OF YOUR USE OF THE
LICENSED MATERIALS EXCEED FIVE HUNDRED U.S. DOLLARS (US$500).
Because some jurisdictions do not allow the exclusion or limitation of incidental or consequential damages or
limitation on how long an implied warranty lasts, the above limitations or exclusions may not apply to you.
Page 3 of 5
Flash API Click-Wrap (May 2014)
7.
Indemnification Disclaimer. YOU ACKNOWLEDGE AND AGREE THAT TI SHALL NOT BE LIABLE FOR AND
SHALL NOT DEFEND OR INDEMNIFY YOU AGAINST ANY THIRD PARTY INFRINGEMENT CLAIM THAT
RELATES TO OR IS BASED ON YOUR MANUFACTURE, USE, OR DISTRIBUTION OF THE LICENSED
MATERIALS OR YOUR MANUFACTURE, USE, OFFER FOR SALE, SALE, IMPORTATION OR DISTRIBUTION OF
YOUR PRODUCTS THAT INCLUDE OR INCORPORATE THE LICENSED MATERIALS.
8.
No Technical Support. TI and its licensors are under no obligation to install, maintain or support the Licensed
Materials.
9.
Notices. All notices to TI hereunder shall be delivered to Texas Instruments Incorporated, 12500 TI Boulevard, Mail
Station 8638, Dallas, Texas 75243, Attention: Contracts Manager – Embedded Processing, with a copy to Texas
Instruments Incorporated, 13588 N. Central Expressway, Mail Station 3999, Dallas, Texas 75243, Attention: Law
Department – Embedded Processing. All notices shall be deemed served when received by TI.
10. Export Control. The Licensed Materials are subject to export control under the U.S. Commerce Department’s Export
Administration Regulations (“EAR”). Unless prior authorization is obtained from the U.S. Commerce Department, neither
you nor your subsidiaries shall export, re-export, or release, directly or indirectly (including, without limitation, by
permitting the Licensed Materials to be downloaded), any technology, software, or software source code, received from
TI, or export, directly or indirectly, any direct product of such technology, software, or software source code, to any
person, destination or country to which the export, re-export, or release of the technology, software, or software source
code, or direct product is prohibited by the EAR. You represent and warrant that you (i) are not located in, or under the
control of, a national or resident of Cuba, Iran, North Korea, Sudan and Syria or any other country subject to a U.S.
goods embargo; (ii) are not on the U.S. Treasury Department’s List of Specially Designated Nationals or the U.S.
Commerce Department’s Denied Persons List or Entity List; and (iii) will not use the Licensed Materials or transfer the
Licensed Materials for use in any military, nuclear, chemical or biological weapons, or missile technology end-uses. Any
software export classification made by TI shall not be construed as a representation or warranty regarding the proper
export classification for such software or whether an export license or other documentation is required for the
exportation of such software.
11. Governing Law and Severability; Waiver. This Agreement will be governed by and interpreted in accordance with
the laws of the State of Texas, without reference to conflict of laws principles. If for any reason a court of competent
jurisdiction finds any provision of the Agreement to be unenforceable, that provision will be enforced to the maximum
extent possible to effectuate the intent of the parties, and the remainder of the Agreement shall continue in full force
and effect. This Agreement shall not be governed by the United Nations Convention on Contracts for the
International Sale of Goods, or by the Uniform Computer Information Transactions Act (UCITA). The parties agree
that non-exclusive jurisdiction for any dispute arising out of or relating to this Agreement lies within the courts located
in the State of Texas. Notwithstanding the foregoing, any judgment may be enforced in any United States or foreign
court, and either party may seek injunctive relief in any United States or foreign court. Failure by TI to enforce any
provision of this Agreement shall not be deemed a waiver of future enforcement of that or any other provision in this
Agreement or any other agreement that may be in place between the parties.
12. PRC Provisions. If you are located in the People’s Republic of China (“PRC”) or if the Licensed Materials will be
sent to the PRC, the following provisions shall apply:
a.
Registration Requirements. You shall be solely responsible for performing all acts and obtaining all approvals
that may be required in connection with this Agreement by the government of the PRC, including but not limited to
registering pursuant to, and otherwise complying with, the PRC Measures on the Administration of Software
Products, Management Regulations on Technology Import-Export, and Technology Import and Export Contract
Registration Management Rules. Upon receipt of such approvals from the government authorities, you shall forward
evidence of all such approvals to TI for its records. In the event that you fail to obtain any such approval or
registration, you shall be solely responsible for any and all losses, damages or costs resulting therefrom, and shall
indemnify TI for all such losses, damages or costs.
b.
Governing Language. This Agreement is written and executed in the English language and shall be
authoritative and controlling, whether or not translated into a language other than English to comply with law or for
reference purposes. If a translation of this Agreement is required for any purpose, including but not limited to
Page 4 of 5
Flash API Click-Wrap (May 2014)
registration of the Agreement pursuant to any governmental laws, regulations or rules, you shall be solely
responsible for creating such translation.
13. Contingencies.
TI shall not be in breach of this Agreement and shall not be liable for any non-performance or
delay in performance if such non-performance or delay is due to a force majeure event or other circumstances
beyond TI’s reasonable control.
14. Entire Agreement. This is the entire agreement between you and TI and this Agreement supersedes any prior
agreement between the parties related to the subject matter of this Agreement. Notwithstanding the foregoing, any
signed and effective software license agreement relating to the subject matter hereof and stating expressly that such
agreement shall control regardless of any subsequent click-wrap, shrink-wrap or web-wrap, shall supersede the
terms of this Agreement. No amendment or modification of this Agreement will be effective unless in writing and
signed by a duly authorized representative of TI. You hereby warrant and represent that you have obtained all
authorizations and other applicable consents required empowering you to enter into this Agreement.
Page 5 of 5
Flash API Click-Wrap (May 2014)
Document Outline
3.4 - Release_Notes
3.6 - Release_Notess

F021 Flash API v2.01.00
Release Notes
May 20, 2014
The Texas Instruments' F021 Flash API provides functions that can be used to erase, program and
verify F021 Flash on TI Hercules 65nm devices.
The version 2.x.x series of the Flash API is the first series to follow ISO26262 development flow.
TABLE OF CONTENTS
1
New In This Release ..................................................................................... 2
2
Release Contents.......................................................................................... 4
3
Fixed In This Release ................................................................................... 5
4
Known Issues ............................................................................................... 5
F021 Flash API v2.01.00 Release Notes
Page 1 of 5

1
New In This Release
v2.01.00
o No new features in this release
v2.00.01
o No new features in this release
v2.00.00
o Replaced the user defined callback functions Fapi_setupEepromSectorEnable()
and Fapi_setupBankSectorEnable() with the functions
Fapi_enableEepromBankSectors() and Fapi_enableMainBankSectors.
o Deprecated the function Fapi_waitDelay().
o Removed the header files F021_FMC_BE.h and F021_FMC_LE.h as F021.h has
been updated to automatically determine compile endianness.
o Replaced the Fapi_initializeAPI() function with Fapi_initializeFlashBanks().
With this change, all global variables have been removed from the API.
o Added the Compatibility.h header file. This file contains some backwards
compatibility macros to work with projects that were previously built with
v1.51 of the API. The list of functions and global variables 2.00.00 with
compatibility defines are:
• Fapi_initializeAPI()
• Fapi_getFsmStatus()
• Fapi_issueFsmSuspendCommand()
• Fapi_writeEwaitValue(mEwait)
• Fapi_checkFsmForReady()
• Fapi_GlobalInit.m_poFlashControlRegisters
o Fapi_getBankSectors() was updated to return sector sizes in kilobytes and to
support 256kB sectors, au8SectorSizes which was an array uint8_t was
changed to an array of uint16_t and renamed au16SectorSizes.
o Added Fapi_remapMainAddress() to give an easy method to determine ECC
address for a main flash address.
o Removed unused status' from Fapi_StatusType
• Fapi_Status_AsyncBusy
• Fapi_Status_AsyncComplete
• Fapi_Error_StateMachineTimeout
• Fapi_Error_InvalidDelayValue
• Fapi_Error_InvalidCpu
o Removed the listing of structures. Please refer to the installed F021 Flash API
headers files for these.
F021 Flash API v2.01.00 Release Notes
Page 2 of 5

o Changed from the use of defined typedefs uint64, uint32, uint16, and uint8 to
the standard definitions in stdint.h, uint64_t, uint32_t, uint16_t, and uint8_t.
Also changed boolean to boolean_t
o Added #if defined guardbanding around the defines in Types.h that can
conflict with Autosar Platform_Types.h defines.
o Added appendix to reference guide describing the PSA calculation
F021 Flash API v2.01.00 Release Notes
Page 3 of 5

2
Release Contents
The following API files are distributed with the installer:
Library Files - (All library files were built using TI's code generation tools for ARM v5.1.3 with the
following compile options: -mv7R4 --abi=eabi --strict_ansi -g -O3 --symdebug:dwarf_version=3 --
diag_warning=225 --gen_func_subsections=on --enum_type=packed --code_state=16 )
o F021_API_CortexR4_BE.lib – This is the Flash API object file for Cortex R4 Big Endian
devices.
o F021_API_CortexR4_BE_v3D16.lib – This is the Flash API object file for Cortex R4 Big
Endian devices that are using floating point unit. (In addition to the general build options,
this library was built using : --float_support=VFPv3D16)
o F021_API_CortexR4_BE_L2FMC.lib – This is the Flash API object file for Cortex R4 Big
Endian devices using the L2FMC memory controller.
o F021_API_CortexR4_LE.lib – This is the Flash API object file for Cortex R4 Little Endian
devices. (In addition to the general build options, this library was built using : -me)
o F021_API_CortexR4_LE_v3D16.lib – This is the Flash API object file for Cortex R4 Little
Endian devices that are using floating point unit. (In addition to the general build options,
this library was built using : -me --float_support=VFPv3D16)
o F021_API_CortexR4_LE_L2FMC.lib – This is the Flash API object file for Cortex R4 Little
Endian devices using the L2FMC memory controller.
o F021_API_CortexR4_BE_L2FMC_v3D16.lib – This is the Flash API object file for Cortex
R4/R5 Big Endian devices using the L2FMC memory controller and floating point unit.
(In addition to the general build options, this library was built using :
--float_support=VFPv3D16).
o F021_API_CortexR4_LE_L2FMC_v3D16.lib – This is the Flash API object file for Cortex
R4/R5 Little Endian devices using the L2FMC memory controller and floating point unit.
(In addition to the general build options, this library was built using : -me
--float_support=VFPv3D16).
Source Files
o Fapi_UserDefinedFunctions.c – This is file that contains the user definable functions.
Include Files
o F021.h – This is the master include file and includes all other include files. This should be
the only include file added to the users's code.
The following include files should not be included directly by the user’s code, but are listed here
for user reference:
o Compatibility.h - A set of macros to be used for backwards compatibility for 1.x.x versions
of the API.
o Constants.h – Constant definitions used by the API.
o FapiFunctions.h - Contains all the Fapi function prototypes.
o Helpers.h – Set of helper defines
o Registers.h – Definitions common to all register implementations and includes the
appropriate register include file for the selected device type.
Registers_FMC_BE.h – Big Endian Flash memory controller registers structure
for TMS570/RM4 devices.
Registers_FMC_LE.h – Little Endian Flash memory controller registers structure
for TMS570/RM4 devices.
o Types.h – Contains all the enumerations and structures used by the API
Below are a set of compiler specific support header files:
o CGT.ARM.h - Contains a set of definitions used by the ARM compiler
o CGT.CCS.h - Contains a set of definitions used by the TI CCS compiler
o CGT.gcc.h - Contains a set of definitions used by the gcc compiler
o CGT.GHS.h - Contains a set of definitions used by the GreenHills compiler
o CGT.IAR.h - Contains a set of definitions used by the IAR EWARM compiler
F021 Flash API v2.01.00 Release Notes
Page 4 of 5

Library information files
o build_information.txt - This file contains function callgraphs, worst case stack usage for
each function, function size in bytes and MD5 and SHA1 checksums for all files delivered
in the installer package.
o License_Agreement.pdf - This is library’s license agreement.
o readme.txt - This file contains release specific information.
o Release_Notes.pdf - This file.
o spna148.pdf- This is the application note, Advanced F021 Flash API
Erase/Program Usage.
o spnu501.pdf – This is the reference guide for the library.
o spnz210.pdf - This is the library errata document.
3
Fixed In This Release
v2.01.00
Reference
Description
SDOCM00102756
Remove FLOCK register from register include files
SDOCM00103134
Sector size returned for FLEE banks by Fapi_getBankSectors() is
double the actual size
v2.00.01
Reference
Description
SDOCM00102084
Typo in CGT.CCS.H in GNU attribute check
SDOCM00102399
Restored FEDACSDIS and FEDACSDIS2 definitions
v2.00.00
Reference
Description
SDOCM00094147 Incorrect read in Verify functions in ECC regions on LE devices
4
Known Issues
None Known.
F021 Flash API v2.01.00 Release Notes
Page 5 of 5
3.7 - SPNA148
3.9 - SPNA148s
SPNA148 – May 2013
Advanced F021 Flash API Erase/Program Usage
John R. Hall
ABSTRACT
This application report gives the user of the F021 Flash API the ability to write program and erase code in
a way that is optimized to their applications.
Contents
1
Introduction .................................................................................................................. 2
2
Flash Registers Used ....................................................................................................... 2
3
Example Usage ............................................................................................................. 5
4
References ................................................................................................................. 11
List of Figures
1
Flash Address Register (FADDR) [offset = FFF8 7110h].............................................................. 2
2
Flash Wide Programming Write Data Register (FWPWRITE0) [offset = FFF8 7120h] ............................ 3
3
Flash Wide Programming Write Data Register (FWPWRITE1) [offset = FFF8 7124h] ............................ 3
4
Flash Wide Programming Write Data Register (FWPWRITE2) [offset = FFF8 7128h] ............................ 3
5
Flash Wide Programming Write Data Register (FWPWRITE3) [offset = FFF8 712Ch] ........................... 3
6
Flash Wide Programming Write Data Register (FWPWRITE4) [offset = FFF8 7130h] ............................ 3
7
Flash Wide Programming Write Data Register (FWPWRITE5) [offset = FFF8 7134h] ............................ 3
8
Flash Wide Programming Write Data Register (FWPWRITE6) [offset = FFF8 7138h] ............................ 3
9
Flash Wide Programming Write Data Register (FWPWRITE7) [offset = FFF8 713Ch] ........................... 3
10
Flash Wide Programming Write Data ECC Register - 288-Bit Bank (FWPWRITE_ECC) [offset = FFF8
7140h] ........................................................................................................................ 4
11
Flash Wide Programming Write Data ECC Register - 144-Bit Bank (FWPWRITE_ECC) [offset = FFF8
7140h] ........................................................................................................................ 4
12
Flash Wide Programming Write Data ECC Register - 72-Bit Bank (FWPWRITE_ECC) [offset = FFF8
7140h] ........................................................................................................................ 4
13
Flash State Machine Command Register (FSM_COMMAND) [offset = FFF8 720Ch] ............................ 5
14
Flash State Machine Command Execute Register (FSM_EXECUTE) [offset = FFF8 72B4h] ................... 5
15
Recommended Command Execution Flow.............................................................................. 7
List of Tables
1
Additional Flash Control Registers ....................................................................................... 2
2
Flash Address Register (FADDR) Field Descriptions .................................................................. 2
3
Flash Wide Programming Write Data Register (FWPWRITE0) Field Descriptions ................................ 4
4
Flash Wide Programming Write Data ECC Register (FWPWRITE_ECC) Field Descriptions .................... 4
5
Flash State Machine Command Register (FSM_COMMAND) Field Descriptions ................................. 5
6
Flash State Machine Command Register (FSM_COMMAND) Field Descriptions ................................. 5
All trademarks are the property of their respective owners.
SPNA148 – May 2013
Advanced F021 Flash API Erase/Program Usage
1
Submit Documentation Feedback
Copyright © 2013, Texas Instruments Incorporated
Introduction
www.ti.com
1
Introduction
The 65nm Flash Technology used on Hercules devices generally requires the use of the F021 Flash API
to do program and erase operations. Since these functions need to cover all possible uses, they are
generic, and not the most efficient functions available for all applications. Therefore, this document is
designed to allow the user to write erase and program functions that are optimized for their application
needs. The F021 Flash API is still required for Flash initialization and bank selection. For recommended
erase and program operation flows, see the F021 Flash API Reference Guide (SPNU501).
NOTE: This document applies to all versions of the F021 Flash API starting with v2.00.00.
2
Flash Registers Used
In addition to the registers listed in the F021 Flash Module chapter in the device-specific technical
reference manual, Table 1 lists registers specifically needed for program and erase operations.
Table 1. Additional Flash Control Registers
Offset
Acronym
Register Description
Section
FFF8 7110
FADDR
The absolute address of the data that the CPU would use to
Section 2.1
access the location.
FFF8 7120
FWPWRITE0
WPDATA[31: 00]
Section 2.2
FFF8 7124
FWPWRITE1
WPDATA[63:32]
Section 2.2
FFF8 7128
FWPWRITE2
WPDATA[95:64]
Section 2.2
FFF8 712C
FWPWRITE3
WPDATA[127:96]
Section 2.2
FFF8 7130
FWPWRITE4
WPDATA[159:128]
Section 2.2
FFF8 7134
FWPWRITE5
WPDATA[191:160]
Section 2.2
FFF8 7138
FWPWRITE6
WPDATA[223:192]
Section 2.2
FFF8 713C
FWPWRITE7
WPDATA[255:224]
Section 2.2
FFF8 7140
FWPWRITE_ECC
Contains the ECC bits for the FWPWRITE7:0 registers
Section 2.3
FFF8 720C
FSM_COMMAND
The command to be executed
Section 2.4
FFF8 72B4
FSM_EXECUTE
Execute the command in the FSM_COMMAND register
Section 2.5
2.1
Flash Address Register (FADDR)
This register contains the absolute address of the location to be programmed, or area to be erased. For
FSM operations, this register can contain the main Flash, data Flash or Customer OTP addresses. The
ECC regions at 0xF01x_xxxx or 0xF02x_xxxx are illegal regions because the ECC programs must be
done using the address of the data that ECC protects and the FWPWRITE_ECC register. FADDR is used
by Program and Erase commands.
The Flash address register is shown in Figure 1 and described in Table 2.
Figure 1. Flash Address Register (FADDR) [offset = FFF8 7110h]
31
0
ADDR
RWP
LEGEND: -n = value after reset, R=Read, WP=Write in Privilege Mode with FLOCK=any value
Table 2. Flash Address Register (FADDR) Field Descriptions
Bit
Field
Value
Description
31:0
ADDR
CPU address to be
Absolute address of the data that the CPU would use to access the location.
operated on by the
command
2
Advanced F021 Flash API Erase/Program Usage
SPNA148 – May 2013
Submit Documentation Feedback
Copyright © 2013, Texas Instruments Incorporated
www.ti.com
Flash Registers Used
2.2
Flash Wide Programming Write Data Register (FWPWRITE0-7)
The Flash wide programming write data register is shown in Figure 2 through Figure 9 and described in
Table 3.
Figure 2. Flash Wide Programming Write Data Register (FWPWRITE0) [offset = FFF8 7120h]
31
0
WPDATA[31:00]
RWP
LEGEND: -n = value after reset, R=Read, WP=Write in Privilege Mode
Figure 3. Flash Wide Programming Write Data Register (FWPWRITE1) [offset = FFF8 7124h]
31
0
WPDATA[63:32]
RWP
LEGEND: -n = value after reset, R=Read, WP=Write in Privilege Mode
Figure 4. Flash Wide Programming Write Data Register (FWPWRITE2) [offset = FFF8 7128h]
31
0
WPDATA[95:64]
RWP
LEGEND: -n = value after reset, R=Read, WP=Write in Privilege Mode
Figure 5. Flash Wide Programming Write Data Register (FWPWRITE3) [offset = FFF8 712Ch]
31
0
WPDATA[127:96]
RWP
LEGEND: -n = value after reset, R=Read, WP=Write in Privilege Mode
Figure 6. Flash Wide Programming Write Data Register (FWPWRITE4) [offset = FFF8 7130h]
31
0
WPDATA[159:128]
RWP
LEGEND: -n = value after reset, R=Read, WP=Write in Privilege Mode
Figure 7. Flash Wide Programming Write Data Register (FWPWRITE5) [offset = FFF8 7134h]
31
0
WPDATA[191:160]
RWP
LEGEND: -n = value after reset, R=Read, WP=Write in Privilege Mode
Figure 8. Flash Wide Programming Write Data Register (FWPWRITE6) [offset = FFF8 7138h]
31
0
WPDATA[223:192]
RWP
LEGEND: -n = value after reset, R=Read, WP=Write in Privilege Mode
Figure 9. Flash Wide Programming Write Data Register (FWPWRITE7) [offset = FFF8 713Ch]
31
0
WPDATA[255:224]
RWP
LEGEND: -n = value after reset, R=Read, WP=Write in Privilege Mode
SPNA148 – May 2013
Advanced F021 Flash API Erase/Program Usage
3
Submit Documentation Feedback
Copyright © 2013, Texas Instruments Incorporated
Flash Registers Used
www.ti.com
Table 3. Flash Wide Programming Write Data Register (FWPWRITE0) Field Descriptions
Bit
Field
Value
Description
255:0
WPDATA
Data to be
This register contains the data to program into the flash memory. Each write will set data bits and
[255:0]
programmed
another internal byte enable bit for each byte to be written by the FSM. The FWPWRITE register is
set to all ones after writing to the FADDR register or when the FSM completes an operation.
For 128-144-bit banks, only FWPWRITE0-3 are used during programming. FWPWRITE4-7 are
unused. For 64-72-bit banks, use only FWPWRITE0-1 are used during programming.
Unused bits can be written and read but they will not be part of the bank operations.
NOTE:
Do not write to this register while a FSM operation is active.
2.3
Flash Wide Programming Write Data ECC Register (FWPWRITE_ECC)
The Flash wide programming write ECC register is shown in Figure 10 through Figure 12 and
described in Table 4.
Figure 10. Flash Wide Programming Write Data ECC Register - 288-Bit Bank (FWPWRITE_ECC)
[offset = FFF8 7140h]
31
24 23
16 15
8
7
0
ECC for Bytes 7:0
ECC for Bytes 15:8
ECC for Bytes 23:16
ECC for Bytes 31:24
RWP
LEGEND: -n = value after reset, R=Read, WP=Write in Privilege Mode with FLOCK=any value
Figure 11. Flash Wide Programming Write Data ECC Register - 144-Bit Bank (FWPWRITE_ECC)
[offset = FFF8 7140h]
31
24 23
16 15
0
ECC for Bytes 7:0
ECC for Bytes 15:8
Reserved
RWP
RWP=FF
FF_FFFF
h
LEGEND: -n = value after reset, R=Read, WP=Write in Privilege Mode with FLOCK=any value
Figure 12. Flash Wide Programming Write Data ECC Register - 72-Bit Bank (FWPWRITE_ECC)
[offset = FFF8 7140h]
31
24 23
0
ECC for Bytes 7:0
Reserved
RWP
RWP=FFF
F_FFFFh
LEGEND: -n = value after reset, R=Read, WP=Write in Privilege Mode with FLOCK=any value
Table 4. Flash Wide Programming Write Data ECC Register (FWPWRITE_ECC) Field Descriptions
Bit
Field
Value
Description
31:0
ECC
ECC Data to be
This register contains the ECC bits for the FWPWRITE7:0 registers. The location of the ECC
[31:0]
programmed
bits corresponding to the data depends on the device configuration. The three supported
configurations are shown above.
Unused bits can be written and read but they will not be part of the bank operations.
This register is an extension of the FWPWRITE register. Do not write to this register while a
FSM operation is active. This register is set to all ones just like the FWPWRITEx registers.
4
Advanced F021 Flash API Erase/Program Usage
SPNA148 – May 2013
Submit Documentation Feedback
Copyright © 2013, Texas Instruments Incorporated
www.ti.com
Example Usage
2.4
Flash State Machine Command Register (FSM_COMMAND)
The Flash state machine command register is shown in Figure 13 and described in Table 5.
Figure 13. Flash State Machine Command Register (FSM_COMMAND) [offset = FFF8 720Ch]
31
6
5
4
3
2
1
0
Reserved
FSM_CMD
R-0
RWP
LEGEND: -n = value after reset, R=Read, WP=Write in Privilege Mode
Table 5. Flash State Machine Command Register (FSM_COMMAND) Field Descriptions
Bit
Field
Value
Description
31:6
Reserved
0
These are reserved bits
5:0
FSM_CMD
Refer to the supported commands listed in Appendix A of F021 Flash API Reference Guide
(SPNU501). Writes to this register are blocked if the state machine is busy. The only
exception is to write the suspend command.
2.5
Flash State Machine Command Execute Register (FSM_EXECUTE)
The Flash state machine command execute register is shown in Figure 14 and described in Table 6.
Figure 14. Flash State Machine Command Execute Register (FSM_EXECUTE) [offset = FFF8 72B4h]
31
20
19
18
17
16
Reserved
SUSPEND_NOW
R-0
RWP-1010
15
5
4
3
2
1
0
Reserved
FSMEXECUTE
R-0
RWP-01010
LEGEND: -n = value after reset, R=Read, WP=Write in Privilege Mode
Table 6. Flash State Machine Command Register (FSM_COMMAND) Field Descriptions
Bit
Field
Value
Description
31:20
Reserved
0
These are reserved bits
19:16
SUSPEND_NOW
0101
Writing a 5 to this register will suspend the Program or Erase sector command. Writes to
this register are ignored unless the FSM is busy with one of these commands. This field
resets to ‘1010’ when the FSM enters the standby state where it waits for the next
command. It will not retain the written value for long. The Bank erase command and every
command except those two commands above are not suspendable and will ignore the
suspend command. A suspend operation will exit the FSM with the proper setup and hold
times for the various modes.
15:5
Reserved
0
These are reserved bits
4:0
FSMEXECUTE
01010
To invoke a FSM command this register must be written with a value of 10101. This register
is reset back to 01010 by the FSM upon completion of the command operation. Writes to
this register are ignored while the FSM is busy. All others registers must be set up before
writing to this command. Writing a 15h to this field is the last step to starting an FSM
operation.
3
Example Usage
The following examples show some typically use cases in writing code using the Flash Memory Controller
registers. The example code segments make use of the following framework code. For API functions used
in these examples, see the F021 Flash API Reference Guide (SPNU501). For proper initialization of the
device prior to any Flash operations, see the device-specific initialization document. All FMC register
writes require the device to be in a privilege state.
SPNA148 – May 2013
Advanced F021 Flash API Erase/Program Usage
5
Submit Documentation Feedback
Copyright © 2013, Texas Instruments Incorporated
Example Usage
www.ti.com
#include “F021.h”
int main (void)
{
Fapi_StatusType oReturnCheck = Fapi_Status_Success;
FwpWriteByteAccessorType
* oFwpWriteByteAccessor
= FWPWRITE_BYTE_ACCESSOR_ADDRESS;
FwpWriteByteAccessorType
* oFwpWriteEccByteAccessor = FWPWRITE_ECC_BYTE_ACCESSOR_ADDRESS;
FwpWriteDWordAccessorType * oFwpWriteDWordAccessor
= FWPWRITE_DWORD_ACCESSOR_ADDRESS;
uint8 au8MainDataBuffer[16] = {0x78, 0x17, 0x19, 0x2E, 0x0A, 0xB9, 0x11, 0x70,
0x5F, 0xC1, 0x9C, 0xFD, 0x54, 0x51, 0xED, 0x86};
uint32 u32Index;
/*
For proper initialization of the device prior to any Flash
operations,
see the device-specific initialization document.
Assumes, unless otherwise noted, device has 144bit wide Flash Banks.
*/
oReturnCheck = Fapi_initializeFlashBanks(180);
/* Example code is assuming operating
frequency of 180 MHz */
if((oReturnCheck == Fapi_Status_Success) &&
(FLASH_CONTROL_REGISTER->FmStat.FMSTAT_BITS.Busy != Fapi_Status_FsmBusy))
{
oReturnCheck = Fapi_setActiveFlashBank(Fapi_FlashBank0);
/* Place specific example code here */
/* Wait for FSM to finish */
while(FLASH_CONTROL_REGISTER->FmStat.FMSTAT_BITS.Busy == Fapi_Status_FsmBusy);
/* Check the FSM Status to see if there were no errors */
if (FLASH_CONTROL_REGISTER->FmStat.u32Register != 0)
{
/* Put Error handling code here */
}
}
}
6
Advanced F021 Flash API Erase/Program Usage
SPNA148 – May 2013
Submit Documentation Feedback
Copyright © 2013, Texas Instruments Incorporated
www.ti.com
Example Usage
3.1
Typical Command Execution Flow
Figure 15 shows the typical flow for issuing an erase or program command.
Start
No
Yes
CHECK_FSM_READY_BUSY
== Fapi_Status_FsmReady
Load FSM_COMMAND register field
FSM_CMD with Fapi_ClearStatus
Load FSM_EXECUTE register field
FSM_EXECUTE with 0x15
For Erase and Program commands,
load FADDR register with
appropriate address
For Program command, load
FWPWRITEx register(s) with
appropriate data values
Load FSM_COMMAND register field
FSM_CMD with one of these
commands: Fapi_ProgramData,
Fapi_EraseSector, Fapi_EraseBank
Load FSM_EXECUTE register field
FSM_EXECUTE with 0x15
Done
Figure 15. Recommended Command Execution Flow
SPNA148 – May 2013
Advanced F021 Flash API Erase/Program Usage
7
Submit Documentation Feedback
Copyright © 2013, Texas Instruments Incorporated
Example Usage
www.ti.com
3.2
Programming Operations
3.2.1
Programming a Single Byte
The following code segement will write a single byte to the address specified.
FLASH_CONTROL_REGISTER->Fbprot.u32Register = 1U;
/* Disable Level 1 Protection */
/* Enable all sectors of current bank for erase and program.
For EEPROM banks with more
than 16 sectors, this must be 0xFFFF */
FLASH_CONTROL_REGISTER->Fbse.u32Register = 0xFFFF;
FLASH_CONTROL_REGISTER->Fbprot.u32Register = 0U;
/* Enable Level 1 Protection */
/*Unlock FSM registers for writing */
FLASH_CONTROL_REGISTER->FsmWrEna.u32Register
= 0x5U;
/* Set command to "Clear the Status Register" */
FLASH_CONTROL_REGISTER->FsmCommand.FSM_COMMAND_BITS.FSMCMD = Fapi_ClearStatus;
/* Execute the Clear Status command */
FLASH_CONTROL_REGISTER->FsmExecute.FSM_EXECUTE_BITS.FSMEXECUTE = 0x15U;
/* Write address to FADDR register */
FLASH_CONTROL_REGISTER->Faddr.u32Register = 0x0100U;
/* Placing byte at address 0x0102 */
oFwpWriteByteAccessor[2] = 0xA5;
/* Set command to "Program" */
FLASH_CONTROL_REGISTER->FsmCommand.FSM_COMMAND_BITS.FSMCMD = Fapi_ProgramData;
/* Execute the Program command */
FLASH_CONTROL_REGISTER->FsmExecute.FSM_EXECUTE_BITS.FSMEXECUTE = 0x15U;
/* re-lock FSM registers to prevent writing */
FLASH_CONTROL_REGISTER->FsmWrEna.u32Register
= 0x2U;
3.2.2
Programming 128-Bit Data and 16-Bit ECC
The following code segement will write 16 bytes starting at the 128-bit aligned address specified.
FLASH_CONTROL_REGISTER->Fbprot.u32Register = 1U;
/* Disable Level 1 Protection */
/* Enable all sectors of current bank for erase and program.
For EEPROM banks with more
than 16 sectors, this must be 0xFFFF */
FLASH_CONTROL_REGISTER->Fbse.u32Register = 0xFFFF;
FLASH_CONTROL_REGISTER->Fbprot.u32Register = 0U;
/* Enable Level 1 Protection */
/*Unlock FSM registers for writing */
FLASH_CONTROL_REGISTER->FsmWrEna.u32Register
= 0x5U;
/* Set command to "Clear the Status Register" */
FLASH_CONTROL_REGISTER->FsmCommand.FSM_COMMAND_BITS.FSMCMD = Fapi_ClearStatus;
/* Execute the Clear Status command */
FLASH_CONTROL_REGISTER->FsmExecute.FSM_EXECUTE_BITS.FSMEXECUTE = 0x15U;
/* Write address to FADDR register */
FLASH_CONTROL_REGISTER->Faddr.u32Register = 0x0100U;
/* Placing bytes at address 0x0100 - 0x010F */
8
Advanced F021 Flash API Erase/Program Usage
SPNA148 – May 2013
Submit Documentation Feedback
Copyright © 2013, Texas Instruments Incorporated
www.ti.com
Example Usage
for(u32Index=0;u32Index<16;u32Index++)
{
oFwpWriteByteAccessor[u32Index] = au8MainDataBuffer[u32Index];
}
/* Supply the address where ECC is being calculated */
FLASH_CONTROL_REGISTER->FemuAddr.u32Register
= 0x0100;
#if defined(_LITTLE_ENDIAN)
/* Supply the lower 32bit word */
FLASH_CONTROL_REGISTER->FemuDlsw.u32Register
= oFwpWriteDwordAccessor[1];
/* Supply the upper 32bit word */
FLASH_CONTROL_REGISTER->FemuDmsw.u32Register
= oFwpWriteDwordAccessor[0];
#else
/* Supply the upper 32bit word */
FLASH_CONTROL_REGISTER->FemuDlsw.u32Register
= oFwpWriteDwordAccessor[0];
/* Supply the lower 32bit word */
FLASH_CONTROL_REGISTER->FemuDmsw.u32Register
= oFwpWriteDwordAccessor[1];
#endif
/* Place the Wrapper calculated ECC into FWPWRITE_ECC */
oFwpWriteEccByteAccessor[EI8(0)] = FLASH_CONTROL_REGISTER->FemuEcc.FEMU_ECC_BITS.EMU_ECC);
/* Supply the address where ECC is being calculated */
FLASH_CONTROL_REGISTER->FemuAddr.u32Register
= 0x0108;
#if defined(_LITTLE_ENDIAN)
/* Supply the lower 32bit word */
FLASH_CONTROL_REGISTER->FemuDlsw.u32Register
= oFwpWriteDwordAccessor[3];
/* Supply the upper 32bit word */
FLASH_CONTROL_REGISTER->FemuDmsw.u32Register
= oFwpWriteDwordAccessor[2];
#else
/* Supply the upper 32bit word */
FLASH_CONTROL_REGISTER->FemuDlsw.u32Register
= oFwpWriteDwordAccessor[2];
/* Supply the lower 32bit word */
FLASH_CONTROL_REGISTER->FemuDmsw.u32Register
= oFwpWriteDwordAccessor[3];
#endif
/* Place the Wrapper calculated ECC into FWPWRITE_ECC */
oFwpWriteEccByteAccessor[EI8(1)] = FLASH_CONTROL_REGISTER->FemuEcc.FEMU_ECC_BITS.EMU_ECC);
/* Set command to "Program" */
FLASH_CONTROL_REGISTER->FsmCommand.FSM_COMMAND_BITS.FSMCMD = Fapi_ProgramData;
/* Execute the Program command */
FLASH_CONTROL_REGISTER->FsmExecute.FSM_EXECUTE_BITS.FSMEXECUTE = 0x15U;
/* re-lock FSM registers to prevent writing */
FLASH_CONTROL_REGISTER->FsmWrEna.u32Register
= 0x2U;
SPNA148 – May 2013
Advanced F021 Flash API Erase/Program Usage
9
Submit Documentation Feedback
Copyright © 2013, Texas Instruments Incorporated
Example Usage
www.ti.com
3.3
Erasing Operations
3.3.1
Erasing a Single Sector With Bank Erase
The following code segment will erase a single Flash sector using the Bank erase command.
NOTE:
The Bank Erase command is not a suspendable operation.
FLASH_CONTROL_REGISTER->Fbprot.u32Register = 1U;
/* Disable Level 1 Protection */
/* Enable all sectors of current bank for erase and program.
For EEPROM banks with more
than 16 sectors, this must be 0xFFFF */
FLASH_CONTROL_REGISTER->Fbse.u32Register = 0xFFFF;
FLASH_CONTROL_REGISTER->Fbprot.u32Register = 0U;
/* Enable Level 1 Protection */
/*Unlock FSM registers for writing */
FLASH_CONTROL_REGISTER->FsmWrEna.u32Register
= 0x5U;
FLASH_CONTROL_REGISTER-
>FsmSector.u32Register = 0xFFFE0000;
/* Disable all sectors except for sector 0 from bank
operation */
/* Set command to "Clear the Status Register" */
FLASH_CONTROL_REGISTER->FsmCommand.FSM_COMMAND_BITS.FSMCMD = Fapi_ClearStatus;
/* Execute the Clear Status command */
FLASH_CONTROL_REGISTER->FsmExecute.FSM_EXECUTE_BITS.FSMEXECUTE = 0x15U;
/* Write address to FADDR register.
This address must be within the bank to be erased */
FLASH_CONTROL_REGISTER->Faddr.u32Register = 0x0100U;
/* Set command to "Program" */
FLASH_CONTROL_REGISTER->FsmCommand.FSM_COMMAND_BITS.FSMCMD = Fapi_EraseBank;
/* Execute the Program command */
FLASH_CONTROL_REGISTER->FsmExecute.FSM_EXECUTE_BITS.FSMEXECUTE = 0x15U;
/* re-lock FSM registers to prevent writing */
FLASH_CONTROL_REGISTER->FsmWrEna.u32Register
= 0x2U;
10
Advanced F021 Flash API Erase/Program Usage
SPNA148 – May 2013
Submit Documentation Feedback
Copyright © 2013, Texas Instruments Incorporated
www.ti.com
References
3.3.2
Erasing a Single Sector With Sector Erase
The following code segment will erase a single Flash sector using the Sector erase command.
FLASH_CONTROL_REGISTER->Fbprot.u32Register = 1U;
/* Disable Level 1 Protection */
/* Enable all sectors of current bank for erase and program.
For EEPROM banks with more
than 16 sectors, this must be 0xFFFF */
FLASH_CONTROL_REGISTER->Fbse.u32Register = 0xFFFF;
FLASH_CONTROL_REGISTER->Fbprot.u32Register = 0U;
/* Enable Level 1 Protection */
/*Unlock FSM registers for writing */
FLASH_CONTROL_REGISTER->FsmWrEna.u32Register
= 0x5U;
/* Set command to "Clear the Status Register" */
FLASH_CONTROL_REGISTER->FsmCommand.FSM_COMMAND_BITS.FSMCMD = Fapi_ClearStatus;
/* Execute the Clear Status command */
FLASH_CONTROL_REGISTER->FsmExecute.FSM_EXECUTE_BITS.FSMEXECUTE = 0x15U;
/* Write address to FADDR register.
This address must be within the bank to be erased */
FLASH_CONTROL_REGISTER->Faddr.u32Register = 0x0100U;
/* Set command to "Program" */
FLASH_CONTROL_REGISTER->FsmCommand.FSM_COMMAND_BITS.FSMCMD = Fapi_EraseSector;
/* Execute the Program command */
FLASH_CONTROL_REGISTER->FsmExecute.FSM_EXECUTE_BITS.FSMEXECUTE = 0x15U;
/* re-lock FSM registers to prevent writing */
FLASH_CONTROL_REGISTER->FsmWrEna.u32Register
= 0x2U;
4
References
F021 Flash API Reference Guide (SPNU501)
SPNA148 – May 2013
Advanced F021 Flash API Erase/Program Usage
11
Submit Documentation Feedback
Copyright © 2013, Texas Instruments Incorporated
IMPORTANT NOTICE
Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, enhancements, improvements and other
changes to its semiconductor products and services per JESD46, latest issue, and to discontinue any product or service per JESD48, latest
issue. Buyers should obtain the latest relevant information before placing orders and should verify that such information is current and
complete. All semiconductor products (also referred to herein as “components”) are sold subject to TI’s terms and conditions of sale
supplied at the time of order acknowledgment.
TI warrants performance of its components to the specifications applicable at the time of sale, in accordance with the warranty in TI’s terms
and conditions of sale of semiconductor products. Testing and other quality control techniques are used to the extent TI deems necessary
to support this warranty. Except where mandated by applicable law, testing of all parameters of each component is not necessarily
performed.
TI assumes no liability for applications assistance or the design of Buyers’ products. Buyers are responsible for their products and
applications using TI components. To minimize the risks associated with Buyers’ products and applications, Buyers should provide
adequate design and operating safeguards.
TI does not warrant or represent that any license, either express or implied, is granted under any patent right, copyright, mask work right, or
other intellectual property right relating to any combination, machine, or process in which TI components or services are used. Information
published by TI regarding third-party products or services does not constitute a license to use such products or services or a warranty or
endorsement thereof. Use of such information may require a license from a third party under the patents or other intellectual property of the
third party, or a license from TI under the patents or other intellectual property of TI.
Reproduction of significant portions of TI information in TI data books or data sheets is permissible only if reproduction is without alteration
and is accompanied by all associated warranties, conditions, limitations, and notices. TI is not responsible or liable for such altered
documentation. Information of third parties may be subject to additional restrictions.
Resale of TI components or services with statements different from or beyond the parameters stated by TI for that component or service
voids all express and any implied warranties for the associated TI component or service and is an unfair and deceptive business practice.
TI is not responsible or liable for any such statements.
Buyer acknowledges and agrees that it is solely responsible for compliance with all legal, regulatory and safety-related requirements
concerning its products, and any use of TI components in its applications, notwithstanding any applications-related information or support
that may be provided by TI. Buyer represents and agrees that it has all the necessary expertise to create and implement safeguards which
anticipate dangerous consequences of failures, monitor failures and their consequences, lessen the likelihood of failures that might cause
harm and take appropriate remedial actions. Buyer will fully indemnify TI and its representatives against any damages arising out of the use
of any TI components in safety-critical applications.
In some cases, TI components may be promoted specifically to facilitate safety-related applications. With such components, TI’s goal is to
help enable customers to design and create their own end-product solutions that meet applicable functional safety standards and
requirements. Nonetheless, such components are subject to these terms.
No TI components are authorized for use in FDA Class III (or similar life-critical medical equipment) unless authorized officers of the parties
have executed a special agreement specifically governing such use.
Only those TI components which TI has specifically designated as military grade or “enhanced plastic” are designed and intended for use in
military/aerospace applications or environments. Buyer acknowledges and agrees that any military or aerospace use of TI components
which have not been so designated is solely at the Buyer's risk, and that Buyer is solely responsible for compliance with all legal and
regulatory requirements in connection with such use.
TI has specifically designated certain components as meeting ISO/TS16949 requirements, mainly for automotive use. In any case of use of
non-designated products, TI will not be responsible for any failure to meet ISO/TS16949.
Products
Applications
Audio
www.ti.com/audio
Automotive and Transportation
www.ti.com/automotive
Amplifiers
amplifier.ti.com
Communications and Telecom
www.ti.com/communications
Data Converters
dataconverter.ti.com
Computers and Peripherals
www.ti.com/computers
DLP® Products
www.dlp.com
Consumer Electronics
www.ti.com/consumer-apps
DSP
dsp.ti.com
Energy and Lighting
www.ti.com/energy
Clocks and Timers
www.ti.com/clocks
Industrial
www.ti.com/industrial
Interface
interface.ti.com
Medical
www.ti.com/medical
Logic
logic.ti.com
Security
www.ti.com/security
Power Mgmt
power.ti.com
Space, Avionics and Defense
www.ti.com/space-avionics-defense
Microcontrollers
microcontroller.ti.com
Video and Imaging
www.ti.com/video
RFID
www.ti-rfid.com
OMAP Applications Processors
www.ti.com/omap
TI E2E Community
e2e.ti.com
Wireless Connectivity
www.ti.com/wirelessconnectivity
Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265
Copyright © 2013, Texas Instruments Incorporated
Document Outline
- Advanced F021 Flash API Erase/Program Usage
3.10 - SPNU501F
3.11 - SPNU501F_ind
Page 1
Page 2
Page 3
Page 4
Page 5
Page 6
Page 7
Page 8
Page 9
Page 10
Page 11
Page 12
Page 13
Page 14
Page 15
Page 16
Page 17
Page 18
Page 19
Page 20
Page 21
Page 22
Page 23
Page 24
Page 25
Page 26
Page 27
Page 28
Page 29
Page 30
Page 31
Page 32
Page 33
Page 34
Page 35
Page 36
Page 37
Page 38
Page 39
Page 40
Page 41
Page 42
Page 43
Page 44
Page 45
Page 46
Page 47
Page 48
Page 49
Page 50
Page 51
3.12 - SPNU501Fs
Version 2.01.00
Reference Guide
Literature Number: SPNU501F
December 2012 – Revised May 2014
Contents
1
Introduction......................................................................................................................... 4
1.1
Reference Material ....................................................................................................... 4
1.2
Function Listing Format ................................................................................................. 4
2
F021 Flash API Overview ...................................................................................................... 6
2.1
Introduction................................................................................................................ 6
2.2
API Overview ............................................................................................................. 6
2.3
Using API.................................................................................................................. 7
3
API Functions .................................................................................................................... 10
3.1
Flash State Machine Functions ....................................................................................... 10
3.2
Asynchronous Functions .............................................................................................. 16
3.3
Program Functions ..................................................................................................... 18
3.4
Read Functions ......................................................................................................... 20
3.5
Informational Functions ................................................................................................ 29
3.6
Utility Functions ......................................................................................................... 32
3.7
User Definable Functions.............................................................................................. 33
4
API Macros ........................................................................................................................ 34
4.1
FAPI_CHECK_FSM_READY_BUSY ................................................................................ 34
4.2
FAPI_CLEAR_FSM_DONE_EVENT................................................................................. 34
4.3
FAPI_GET_FSM_STATUS ............................................................................................ 35
4.4
FAPI_SUSPEND_FSM ................................................................................................ 36
4.5
FAPI_WRITE_EWAIT .................................................................................................. 37
4.6
FAPI_WRITE_LOCKED_FSM_REGISTER ......................................................................... 37
5
Recommended FSM Flows .................................................................................................. 37
5.1
New Devices From Factory ........................................................................................... 37
5.2
Recommended Erase Flows .......................................................................................... 38
5.3
Recommended Program Flow ........................................................................................ 40
Appendix A Flash State Machine Commands................................................................................. 41
A.1
Flash State Machine Commands.................................................................................... 41
Appendix B Typedefs and Enumerations....................................................................................... 42
B.1
Type Definitions ....................................................................................................... 42
B.2
Enumerations .......................................................................................................... 42
Appendix C Flash Validation Procedure ........................................................................................ 47
Appendix D Parallel Signature Analysis (PSA) algorithm................................................................. 48
Appendix E Revision History ....................................................................................................... 49
2
Table of Contents
SPNU501F – December 2012 – Revised May 2014
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
www.ti.com
List of Figures
1
FMSTAT Register .......................................................................................................... 35
2
Recommended Sector Erase Flow....................................................................................... 38
3
Recommended Bank Erase Flow ........................................................................................ 39
4
Recommended Program Flow ............................................................................................ 40
List of Tables
1
Summary of Flash State Machine Functions............................................................................. 6
2
Summary of Asynchronous Command Functions ....................................................................... 6
3
Summary of Program Functions ........................................................................................... 6
4
Summary of Read Functions ............................................................................................... 7
5
Summary of Information Functions ........................................................................................ 7
6
Summary of User Defined Functions...................................................................................... 7
7
Summary of Utility Functions............................................................................................... 7
8
FMSTAT Register Field Descriptions .................................................................................... 35
9
Flash State Machine Commands ........................................................................................ 41
10
API Version History ........................................................................................................ 49
11
Document Revision History ............................................................................................... 50
SPNU501F – December 2012 – Revised May 2014
List of Figures
3
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
Reference Guide
SPNU501F – December 2012 – Revised May 2014
1
Introduction
Background
This reference guide provides a detailed description of Texas Instruments' F021 Flash API functions that
can be used to erase, program and verify F021 Flash on TI devices.
1.1
Reference Material
Use this guide in conjunction with the F021 Flash Module chapter in the device-specific technical
reference manual and data sheet that is being used. For additional options for programming and erasing
the Flash, see the Advanced F021 Flash API Erase/Program Usage (SPNA148).
1.2
Function Listing Format
This is the general format of an entry for a function, compiler intrinsic, or macro.
A short description of what function function_name() does.
Synopsis
Provides a prototype for function function_name().
<return_type> function_name(
<type_1> parameter_1,
<type_2> parameter_2,
<type_n> parameter_n
)
Parameters
parameter_1 [in]
Pointer to x
parameter_2 [out]
Handle for y
parameter_n [in/out]
Pointer to z
Parameter passing is categorized as follows:
•
In — Means the function uses one or more values in the parameter that you give it without storing any
changes.
•
Out — Means the function saves one or more of the values in the parameter that you give it. You can
examine the saved values to find out useful information about your application.
•
In/out — Means the function changes one or more of the values in the parameter that you give it and
saves the result. You can examine the saved values to find out useful information about your
application.
Description
Describes the function function_name(). This section also describes any special characteristics or
restrictions that might apply:
•
Function blocks or might block under certain conditions
•
Function has pre-conditions that might not be obvious
•
Function has restrictions or special behavior
All trademarks are the property of their respective owners.
4
SPNU501F – December 2012 – Revised May 2014
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
www.ti.com
Introduction
Return Value
Specifies any value or values returned by function function_name().
See Also
Lists other functions or data types related to function function_name().
Example
Provides an example (or a reference to an example) that illustrates the use of function function_name().
SPNU501F – December 2012 – Revised May 2014
5
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
F021 Flash API Overview
www.ti.com
2
F021 Flash API Overview
2.1
Introduction
The F021 Flash API is a library of routines that when called with the proper parameters in the proper
sequence, erases, programs, or verifies Flash memory on Texas Instruments microcontrollers using the
F021 (65nm) process. On ARM Cortex devices, these routines must be run in a privileged mode (a mode
other than user) to allow access to the Flash memory controller registers. The API verifies for the selected
bank, that the appropriate RWAIT or EWAIT value is set for the specified system frequency.
2.2
API Overview
Table 1. Summary of Flash State Machine Functions
API Function
Description
Fapi_disableAutoEccCalculation()(1)
Disables auto generation of ECC when data is written into an FWPWRITEx
register.
Fapi_disableBanksForOtpWrite()
Disables all banks from programming customer OTP
Fapi_disableFsmDoneEvent()
Disables the generation of an FSM_Done event at the end of a program or erase
operation.
Fapi_enableAutoEccCalculation()(1)
Enables auto generation of ECC when data is written into an FWPWRITEx register.
Fapi_enableBanksForOtpWrite()
Enables banks to allow programming of customer OTP
Fapi_enableEepromBankSectors()
Enables the sectors in EEPROM bank for program and erase operations
Fapi_enableFsmDoneEvent()
Enables the generation of an FSM_Done event at the end of a program or erase
operation.
Fapi_enableMainBankSectors()
Enables the sectors in Main banks for program and erase operations
Fapi_initializeFlashBanks()
Required Bank initialization before any erase, program, or verify API function.
Fapi_isAddressEcc()
Determines if address falls in Flash memory controller ECC ranges
Fapi_remapEccAddress()
Remaps an ECC address to corresponding main address
Fapi_remapMainAddress()
Remaps an Main address to corresponding ECC address
Fapi_setActiveFlashBank()
Sets the active bank for a erase or program command
(1)
This function is only available on devices with the L2FMC Flash Controller.
Table 2. Summary of Asynchronous Command Functions
API Function
Description
Fapi_issueAsyncCommand()
Issues a command to FSM for operations that do not require an address
Fapi_issueAsyncCommandWithAddress()
Issues a command to FSM for operations that require an address
Table 3. Summary of Program Functions
API Function
Description
Sets up the required registers for programming and issues the command to the
Fapi_issueProgrammingCommand()
FSM
Fapi_issueProgrammingCommandForEccAdd
Remaps an ECC address to the main data space and then call
ress()
Fapi_issueProgrammingCommand()
6
SPNU501F – December 2012 – Revised May 2014
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
www.ti.com
F021 Flash API Overview
Table 4. Summary of Read Functions
API Function
Description
Fapi_doVerify()
Verifies specified Flash memory range against supplied values
Fapi_doVerifyByByte()
Verifies specified Flash memory range against supplied values by byte
Fapi_doBlankCheck()(1)
Verifies specified Flash memory range against erased state
Fapi_doBlankCheckByByte()(1)
Verifies specified Flash memory range against erased state by byte
Fapi_doMarginRead()
Reads a specified Flash memory range using the specified read-margin mode
Fapi_doMarginReadByByte()
Reads a specified Flash memory range using the specified read-margin mode by
byte
Fapi_doPsaVerify()
Verifies a specified Flash memory range against the supplied PSA value
Fapi_calculatePsa()
Calculates a PSA value for the specified Flash memory range
Fapi_flushPipeline()
Flushes the pipeline buffers in the Flash memory controller
(1)
On devices using L2FMC memory controller, ECC may not be disabled for Banks 0 - 6 and therefore performing a blank check
with the Flash API functions are not supported.
Table 5. Summary of Information Functions
API Function
Description
Fapi_getLibraryInfo()
Returns the information specific to the compiled version of the API library
Fapi_getDeviceInfo()
Returns the information specific to the device the API library is being executed on
Fapi_getBankSectors()
Returns the sector information for a bank
Table 6. Summary of User Defined Functions
API Function
Description
Fapi_serviceWatchdogTimer()
User modifiable function to service watchdog timer
Table 7. Summary of Utility Functions
API Function
Description
Fapi_calculateFletcherChecksum()
Function calculates a Fletcher checksum for the memory range specified
Fapi_calculateEcc()
Calculates the ECC for the supplied address and 64-bit word
Fapi_waitDelay()(1)
Creates a delay
(1)
This function is deprecated and should not be used in new projects
2.3
Using API
This section describes how to use the various API functions and any relevant flows.
2.3.1
Initialization Flow
For proper initialization of the device prior to any Flash operations, see the device-specific initialization
document. Additionally, all API functions require execution in privilege mode.
2.3.1.1
Before Using Any Erase, Program or Read Flash API Function
Before using any asynchronous command Table 2 , program Table 3 or read Table 4 functions, the
function Fapi_initializeFlashBanks() must be called to correctly initialize the Flash Memory controller.
SPNU501F – December 2012 – Revised May 2014
7
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
F021 Flash API Overview
www.ti.com
2.3.1.2
Bank Setup
Before performing a Flash erase or program operation for the first time or on a different Bank than is the
current active Bank, the function Fapi_setActiveFlashBank() must be called. Additionally,
Fapi_enableMainBankSectors() (for banks 0-6) or Fapi_enableEepromBankSectors() (for bank 7) must be
called before the first sector erase or program operation and always before a bank erase operation.
2.3.1.3
On System Frequency Change
If the System operating frequency (HCLK) is changed after the initial call to Fapi_initializeFlashBanks(),
this function along with Fapi_setActiveFlashBank() must be called again before any asynchronous
command Table 2 , program Table 3 or read Table 4 function. This will update the Flash Memory
controller to the new system frequency.
2.3.2
Flash Addressing
For program and erase operations on Bank 0 to Bank 6, the API and the FMC requires the standard Flash
memory map where Bank 0, Sector 0 begins at address 0. For the read functions on the Flash memory in
Bank 0 to Bank 6, they need either current address mapping (Flash addresses starting at either 0 {Power
On State} or 0x0800_0000 {RAM-Flash swap) or mirrored addresses starting at 0x2000_0000.
2.3.3
Building With the API
The macro _L2FMC must be defined before the inclusion of the header file F021.h on devices with the
L2FMC Flash controller.
#define _L2FMC
2.3.3.1
Object Library Files
All ARM Cortex Flash API object files are distributed in the ARM standard EABI ELF object format. For the
CortexR4/R5 cores, the library files are built using Thumb2 mode.
2.3.3.2
Distribution Files
The following API files are distributed with the installer:
•
Library Files - (All library files were built using TI's code generation tools for ARM v5.1.3 with the
following compile options: -mv7R4 --abi=eabi --strict_ansi -g -O3 --symdebug:dwarf_version=3 --
diag_warning=225 --gen_func_subsections=on --enum_type=packed --code_state=16 )
–
F021_API_CortexR4_BE.lib – This is the Flash API object file for Cortex R4 Big Endian devices.
–
F021_API_CortexR4_BE_v3D16.lib – This is the Flash API object file for Cortex R4 Big Endian
devices that are using floating point unit. (In addition to the general build options, this library was
built using : --float_support=VFPv3D16)
–
F021_API_CortexR4_BE_L2FMC.lib – This is the Flash API object file for Cortex R4 Big Endian
devices using the L2FMC memory controller.
–
F021_API_CortexR4_LE.lib – This is the Flash API object file for Cortex R4 Little Endian devices.
(In addition to the general build options, this library was built using : -me)
–
F021_API_CortexR4_LE_v3D16.lib – This is the Flash API object file for Cortex R4 Little Endian
devices that are using floating point unit. (In addition to the general build options, this library was
built using : -me --float_support=VFPv3D16)
–
F021_API_CortexR4_LE_L2FMC.lib – This is the Flash API object file for Cortex R4 Little Endian
devices using the L2FMC memory controller.
–
F021_API_CortexR4_BE_L2FMC_v3D16.lib – This is the Flash API object file for Cortex R4/R5 Big
Endian devices using the L2FMC memory controller and float point unit. (In addition to the general
build options, this library was built using : --float_support=VFPv3D16)
–
F021_API_CortexR4_LE_L2FMCv3D16.lib – This is the Flash API object file for Cortex R4/R5 Little
Endian devices using the L2FMC memory controller and float point unit. (In addition to the general
build options, this library was built using : -me --float_support=VFPv3D16)
8
SPNU501F – December 2012 – Revised May 2014
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
www.ti.com
F021 Flash API Overview
•
Source Files
–
Fapi_UserDefinedFunctions.c – This is file that contains the user definable functions.
•
Include Files
–
F021.h – This is the master include file and includes all other include files. This should be the only
include file added to the users's code.
•
The following include files should not be included directly by the user’s code, but are listed here for
user reference:
–
Compatibility.h - A set of macros to be used for backwards compatibility for 1.x.x versions of the
API.
–
Constants.h – Constant definitions used by the API.
–
FapiFunctions.h - Contains all the Fapi function prototypes.
–
Helpers.h – Set of helper defines
–
Registers.h – Definitions common to all register implementations and includes the appropriate
register include file for the selected device type.
–
Registers_FMC_BE.h – Big Endian Flash memory controller registers structure for TMS570/RM4
devices.
–
Registers_FMC_LE.h – Little Endian Flash memory controller registers structure for TMS570/RM4
devices.
–
Types.h – Contains all the enumerations and structures used by the API
–
Below are a set of compiler specific support header files:
•
CGT.ARM.h - Contains a set of definitions used by the ARM compiler
•
CGT.CCS.h - Contains a set of definitions used by the TI CCS compiler
•
CGT.gcc.h - Contains a set of definitions used by the gcc compiler
•
CGT.GHS.h - Contains a set of definitions used by the GreenHills compiler
•
CGT.IAR.h - Contains a set of definitions used by the IAR EWARM compiler
•
Library information files
–
build_information.txt - This file contains function callgraphs, worst case stack usage for each
function, function size in bytes and MD5 and SHA1 checksums for all files delivered in the installer
package.
–
License_Agreement.pdf - This file contains the libraries license agreement.
–
readme.txt - This file contains build specific information.
–
Release_Notes.pdf - This file contains release specific information.
–
spna148.pdf - This is the application note, Advanced F021 Flash API Erase/Program Usage.
–
spnu501e.pdf - This file.
–
spnz210.pdf - This is the library errata document.
2.3.4
Executing API From Flash
NOTE:
The F021 Flash API library cannot be executed from the same bank as the active bank
selected for the API commands to operate on. On single bank devices, the F021 Flash API
must be executed from RAM.
2.3.5
Memory Regions Required to be Readable
NOTE:
The F021 Flash API library must be able to read from addresses 0x000, 0x100, 0x200,
0x300, and the TI OTP region, 0xF008_0000 - 0xF00B_0000, for the API to operate
correctly.
SPNU501F – December 2012 – Revised May 2014
9
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
API Functions
www.ti.com
3
API Functions
3.1
Flash State Machine Functions
3.1.1
Fapi_disableAutoEccCalculation()
Disables auto generation of ECC on L2FMC devices
Synopsis
Fapi_StatusType Fapi_disableAutoEccCalculation(void)
Parameters
None
Description
NOTE:
This function is only available on devices using the L2FMC Flash Memory Controller.
This function disables the auto generation of ECC when data is written to the FWPWRITEx registers on
L2FMC devices. The use of this function is primarily intended for those users writing their own
programming functions based on the application note, Advanced F021 Flash API Erase/Program Usage
(SPNA148). The function Fapi_issueProgrammingCommand() Section 3.2.2 will automatically set this bit
depending on the programming mode used (enabled for Fapi_AutoEccGeneration, disabled for all other
modes) and will stay that way when this function returns.
Return Value
•
Fapi_Status_Success (success)
3.1.2
Fapi_disableBanksForOtpWrite()
Disables ability to program the Customer OTP on all Flash Banks.
Synopsis
Fapi_StatusType Fapi_disableBanksForOtpWrite(void)
Parameters
None
Description
This function sets OTPPRODIS field in the FBAC register to disable the ability to program the Customer
OTP for all banks.
Return Value
•
Fapi_Status_Success (success)
10
SPNU501F – December 2012 – Revised May 2014
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
www.ti.com
API Functions
3.1.3
Fapi_disableFsmDoneEvent()
Disables generation of the FSM_DONE event.
Synopsis
Fapi_StatusType Fapi_disableFsmDoneEvent(void)
Parameters
None
Description
This function disables the generation of the FSM_DONE event. For more information on the FSM_DONE
event, see the device-specific technical reference manual.
Return Value
•
Fapi_Status_Success (success)
3.1.4
Fapi_enableAutoEccCalculation()
Enables auto generation of ECC on L2FMC devices
Synopsis
Fapi_StatusType Fapi_enableAutoEccCalculation(void)
Parameters
None
Description
NOTE:
This function is only available on devices using the L2FMC Flash Memory Controller.
This function enables the auto generation of ECC when data is written to the FWPWRITEx registers on
L2FMC devices. The use of this function is primarily intended for those users writing their own
programming functions based on Advanced F021 Flash API Erase/Program Usage (SPNA148). The
function Fapi_issueProgrammingCommand() Section 3.2.2 will automatically set this bit depending on the
programming mode used (enabled for Fapi_AutoEccGeneration, disabled for all other modes) and will stay
that way when this function returns.
Return Value
•
Fapi_Status_Success (success)
SPNU501F – December 2012 – Revised May 2014
11
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
API Functions
www.ti.com
3.1.5
Fapi_enableBanksForOtpWrite()
Enables ability to program the Customer OTP region for the specified banks
Synopsis
Fapi_StatusType Fapi_enableBanksForOtpWrite(
uint8_t u8Banks)
Parameters
u8Banks [in]
Bit mask indicating each bank to be enabled for OTP programming
Description
This function sets up the OTPPRODIS field in the FBAC register to enable the ability to program Customer
OTP for the banks specified in the bitfield mask u8Banks. The bitfield mask has Bank 0 as bit 1 up to
Bank 7 as bit 7.
Return Value
•
Fapi_Status_Success (success)
3.1.6
Fapi_enableEepromBankSectors()
Sets up the sectors available on EEPROM banks for erase and programming
Synopsis
Fapi_StatusType Fapi_enableEepromBankSectors(
uint32_t u32SectorsEnables_31_0,
uint32_t u32SectorsEnables_63_32)
Parameters
u32SectorsEnables_31_0 [in]
Bit mask indicating which of sectors 0-31 are enabled for erase and
programming.
u32SectorsEnables_63_32 [in]
Bit mask indicating which of sectors 32-63 are enabled for erase and
programming.
Description
This function sets up the sectors in the EEPROM banks that are available for erase and programming
operations. This function must be called with the EEPROM bank (Flash Bank 7) as the active bank.
Additionally, the function must be called once before performing program and sector erase operations and
always before a bank erase operation. Each bit refers to a single sector with Sector 0 is bit 0 in
u32SectorEnables_31_0 to Sector 31 is bit 31 in u32SectorEnables_31_0 and Sector 32 is bit 0 in
u32SectorEnables_63_32 to Sector 63 is bit 31 in u32SectorEnables_63_32.
Return Value
•
Fapi_Status_Success (success)
12
SPNU501F – December 2012 – Revised May 2014
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
www.ti.com
API Functions
3.1.7
Fapi_enableFsmDoneEvent()
Enables the generation of the FSM_DONE event
Synopsis
Fapi_StatusType Fapi_enableBanksForOtpWrite(void)
Parameters
None
Description
This function enables the generation of the FSM_DONE event. This event is generated when the FSM
finishes a program or erase operation. The FSM_DONE event flag resides in the FEDACSTATUS register
at bit 24. For a complete description of the FEDACSTATUS register and FSM_DONE event, see the F021
Flash Module chapter in the device-specific technical reference manual. This FSM_DONE flag must be
cleared by writing a one to this bit in order for the event signal to stop. There is a helper macro
CLEAR_FSM_DONE_EVENT defined to accomplish this.
Return Value
•
Fapi_Status_Success (success)
3.1.8
Fapi_enableMainBankSectors()
Sets up the sectors available on non-EEPROM banks for erase and programming
Synopsis
Fapi_StatusType Fapi_enableMainBankSectors(
uint16_t u16SectorsEnables)
Parameters
u16SectorsEnables [in]
Bit mask indicating which of sectors 0-15 are enabled for erase and
programming.
Description
This function sets up the sectors in the non-EEPROM banks that are available for erase and programming
operations. This function must be called with the bank intended for the erase or program operation as the
active bank. Additionally, the function must be called once before performing program and sector erase
operations and always before a bank erase operation. Each bit refers to a single sector where Sector 0 is
bit 0 to Sector 15 is bit 15 in u16SectorEnables.
Return Value
•
Fapi_Status_Success (success)
SPNU501F – December 2012 – Revised May 2014
13
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
API Functions
www.ti.com
3.1.9
Fapi_isAddressEcc()
Indicates if an address is in the Flash Memory Controller ECC space
Synopsis
boolean_t Fapi_isAddressEcc(
uint32_t u32Address)
Parameters
u32Address [in]
Address to determine if it lies in ECC address space
Description
This function returns True if the address in u32Address is in ECC address space or False if it is not.
Return Value
•
false (Address is not in ECC address space)
•
true (Address is in ECC address space)
3.1.10
Fapi_initializeFlashBanks()
Initializes the Flash Banks for API operations
Synopsis
Fapi_StatusType Fapi_initializeFlashBanks(
uint32_t u32HclkFrequency)
Parameters
u32HclkFrequency [in]
System clock frequency in MHz. The value should be rounded up to
the next integer. For example, if the system clock frequency is
133.3MHz, then the u32HclkFrequency value should be 134.
Description
This function is required to initialize the Flash Banks before using any asynchronous command Table 2 ,
program Table 3 or read Table 4 functions. This function must also be called if the system frequency is
changed and/or RWAIT/EWAIT values are changed.
NOTE:
This function requires that Bank 7 be enabled and powered. Once this function has
completed, Bank 7 may be disabled and powered off.
RWAIT and EWAIT register values must be set before calling this function. There is a helper
macro FAPI_WRITE_EWAIT(_mEwait) is provided to make writing the EWAIT value easier
due to the need for the EEPROM_CONFIG register to be unlocked before you can write the
EWAIT value.
Return Value
•
Fapi_Status_Success (success)
•
Fapi_Error_InvalidHclkValue (failure: System clock does not match specified wait value)
•
Fapi_Error_OtpChecksumMismatch (failure: Calculated TI OTP checksum does not match value in
TI OTP)
14
SPNU501F – December 2012 – Revised May 2014
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
www.ti.com
API Functions
3.1.11
Fapi_remapEccAddress()
Takes ECC address and remaps it to main address space
Synopsis
uint32_t Fapi_remapEccAddress(
uint32_t u32EccAddress)
Parameters
u32EccAddress [in]
ECC address to remap
Description
This function returns the main Flash address for the given ECC Flash address passed in u32EccAddress.
Return Value
•
32-bit Main Flash Address
3.1.12
Fapi_remapMainAddress()
Takes Flash Main address and remaps it to its corresponding ECC address
Synopsis
uint32_t Fapi_remapMainAddress(
uint32_t u32MainAddress)
Parameters
u32MainAddress [in]
Main address to remap
Description
This function returns the ECC Flash address for the given Main Flash address passed in
u32MainAddress.
Return Value
•
32-bit ECC Flash Address
SPNU501F – December 2012 – Revised May 2014
15
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
API Functions
www.ti.com
3.1.13
Fapi_setActiveFlashBank()
Sets the active Flash Bank
Synopsis
Fapi_StatusType Fapi_setActiveFlashBank(
Fapi_FlashBankType oNewFlashBank)
Parameters
oNewFlashBank [in]
Bank number to set as active
Description
This function sets the active bank (passed in oNewFlashBank) for any Flash operation issued after calling
this function.
Return Value
•
Fapi_Status_Success (success)
•
Fapi_Error_InvalidBank (failure: Bank specified does not exist on device)
3.2
Asynchronous Functions
3.2.1
Fapi_issueAsyncCommand()
Issues a command to the Flash State Machine that only requires a command
Synopsis
Fapi_StatusType Fapi_issueAsyncCommand(
Fapi_FlashStateCommandsType oCommand)
Parameters
oCommand [in]
Command to issue to the FSM
Description
This function issues a command to the Flash State Machine for commands not requiring any additional
information. Typical commands are Clear Status, Program Resume, Erase Resume and Clear_More.
Return Value
•
Fapi_Status_Success (success)
•
Fapi_Error_InvalidCommand (failure: Command specified requires an address to be specified)
16
SPNU501F – December 2012 – Revised May 2014
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
www.ti.com
API Functions
3.2.2
Fapi_issueAsyncCommandWithAddress()
Issues a command to the Flash State Machine with an address
Synopsis
Fapi_StatusType Fapi_issueAsyncCommandWithAddress(
Fapi_FlashStateCommandsType oCommand,
uint32_t *pu32StartAddress)
Parameters
oCommand [in]
Command to issue to the FSM
pu32StartAddress [in]
Address for needed for Flash State Machine operation
Description
This function issues a command to the Flash State Machine for commands requiring an address to
function correctly. Primary commands used with function are Erase Sector and Erase Bank.
NOTE:
Reading a Flash memory location from the bank that an erase command (sector or bank) is
currently being performed will stall the CPU until the erase command finishes and the
FMSTAT register indicates the FSM is not busy.
The Bank Erase command is not a suspendable operation.
Return Value
•
Fapi_Status_Success (success)
•
Fapi_Error_InvalidCommand (failure: Command specified does not require an address to be
specified or is a program command)
SPNU501F – December 2012 – Revised May 2014
17
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
API Functions
www.ti.com
3.3
Program Functions
3.3.1
Fapi_issueProgrammingCommand()
Sets up data and issues program command to valid Flash memory addresses
Synopsis
Fapi_StatusType Fapi_issueProgrammingCommand(
uint32_t *pu32StartAddress,
uint8_t
*pu8DataBuffer,
uint8_t
u8DataBufferSizeInBytes,
uint8_t
*pu8EccBuffer,
uint8_t
u8EccBufferSizeInBytes,
Fapi_FlashProgrammingCommandType oMode)
Parameters
pu32StartAddress [in]
start address in Flash for the data and ECC to be programmed
pu8DataBuffer [in]
pointer to the Data buffer address
u8DataBufferSizeInBytes [in]
number of bytes in the Data buffer
pu8EccBuffer [in]
pointer to the ECC buffer address
u8EccBufferSizeInBytes [in]
number of bytes in the ECC buffer
oMode [in]
Indicates the programming mode to use:
Fapi_DataOnly
Programs only the data buffer
Fapi_AutoEccGeneration
Programs the data buffer and
auto generates and programs the
ECC.
Fapi_DataAndEcc
Programs both the data and ECC
buffers
Fapi_EccOnly
Programs only the ECC buffer
Description
This function sets up the programming registers of the Flash State Machine based on the supplied
parameters. It offers four different programming modes to the user and handles multiple bank widths
automatically.
Programming modes:
Fapi_DataOnly – This mode will only program the data portion in Flash at the address specified. It can
program from 1 byte up to the bank width (8,16,32) bytes based on the bank architecture. The supplied
starting address to program at plus the data buffer length cannot exceed the bank data width. (Ex.
Programming 14 bytes on a 16 byte wide bank starting at address 0x4 is not allowed.)
Fapi_AutoGeneration – This will program the supplied data portion in Flash along with automatically
generated ECC. ECC is calculated on 64-bit aligned addresses up to the data width of the bank. Data not
supplied is treated as 0xFF. For example, on a device with a 144-bit wide bank width, if data is written
only to bytes 0x0-0x7 (or 0x8-0xF), then the ECC will only be calculated for those 64 bits. If the data
supplied crosses a 64-bit boundary, ECC will be calculated for both 64-bit words. For example, on a
device with a 144-bit wide bank width, data is written to bytes 0x4 - 0xB, the 2 bytes of ECC data will be
calculated. The data restrictions for Fapi_DataOnly also exist for this option.
Fapi_DataAndEcc – This will program both the supplied data and ECC in Flash at the address specified.
The data supplied must be aligned on a 64-bit word and the length of data must correlate to the supplied
ECC. (For example, data buffer length is 8 bytes, the ECC buffer must be 1 byte).
Fapi_EccOnly – This mode will only program the ECC portion in Flash at the address specified. It can
program from 1 byte up to the bank ECC width (1, 2, 4) bytes based on the bank architecture. The
supplied starting address to program at plus the ECC buffer length cannot exceed the bank ECC width
(programming 3 bytes on a 2 byte ECC wide bank starting at address 0x0 is not allowed).
18
SPNU501F – December 2012 – Revised May 2014
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
www.ti.com
API Functions
NOTE:
Reading a Flash memory location from the bank that an program command is currently
being performed will stall the CPU until the program command finishes and the FMSTAT
register indicates the FSM is not busy.
The length of pu8DataBuffer and pu8EccBuffer cannot exceed the bank width of the current
active bank. For bank width information, see the F021 Flash Module chapter in the device-
specific technical reference manual.
Return Value
•
Fapi_Status_Success (success)
•
Fapi_Error_AsyncIncorrectDataBufferLength (failure: Data buffer size specified exceeds Data bank
width)
•
Fapi_Error_AsyncIncorrectEccBufferLength (failure: ECC buffer size specified exceeds ECC bank
width)
•
Fapi_Error_AsyncDataEccBufferLengthMismatch (failure: Data buffer size either is not 64-bit
aligned or Data length exceeds amount ECC supplied)
3.3.2
Fapi_issueProgrammingCommandForEccAddress()
Synopsis
Fapi_StatusType Fapi_issueProgrammingCommandForEccAddress(
uint32_t *pu32StartAddress,
uint8_t
*pu8EccBuffer,
uint8_t
u8EccBufferSizeInBytes)
Parameters
pu32StartAddress [in]
ECC start address in Flash for the ECC to be programmed
pu8EccBuffer [in]
pointer to the ECC buffer address
u8EccBufferSizeInBytes [in]
number of bytes in the ECC buffer
Description
This function will remap an address in the ECC memory space to the corresponding data address space
and then call Fapi_issueProgrammingCommand() to program the supplied ECC data. The same
limitations for Fapi_issueProgrammingCommand() using Fapi_EccOnly mode applies to this function.
NOTE:
Reading a Flash memory location from the bank that a program command is currently being
performed will stall the CPU until the program command finishes and the FMSTAT register
indicates the FSM is not busy.
The length of pu8EccBuffer cannot exceed the bank width of the current active bank. For
bank width information, see the F021 Flash Module chapter in the device-specific technical
reference manual.
Return Value
•
Fapi_Status_Success (success)
•
Fapi_Error_AsyncIncorrectEccBufferLength (failure: Data buffer size specified exceeds ECC bank
width)
SPNU501F – December 2012 – Revised May 2014
19
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
API Functions
www.ti.com
3.4
Read Functions
The read functions do not combine main and ECC ranges. Because this, if you need a read operation
performed on the data and corresponding ECC, you must call the function for both. For example, if you
have erased Bank 0, Sector 0, you would need to perform a blank check on Sector 0 main address range
and ECC address range.
3.4.1
Fapi_doBlankCheck()
Verifies region specified is erased value
Synopsis
Fapi_StatusType Fapi_doBlankCheck(
uint32_t *pu32StartAddress,
uint32_t
u32Length,
Fapi_FlashStatusWordType *poFlashStatusWord)
Parameters
pu32StartAddress [in]
start address for region to blank check
u32Length [in]
length of region in 32-bit words to blank check
poFlashStatusWord [out]
returns the status of the operation if result is not
Fapi_Status_Success
->au32StatusWord[0]
address of first non-blank location
->au32StatusWord[1]
data read at first non-blank location
->au32StatusWord[2]
value of compare data (always 0xFFFFFFFF)
->au32StatusWord[3]
indicates read mode that failed blank check
Description
This function checks the device for blank (erase state) starting at the specified address for the length of
32-bit words specified. If a non-blank location is found, these results will be returned in the
poFlashStatusWord parameter. This will use read margin 1 mode for this check. As the erase state of the
Flash is not a valid ECC condition, on Banks 0 - 6 ECC correction at a minimum must be disabled. On
Bank 7, ECC can either be temporarily disabled by writing 0101 to the EE_EDACEN bits or setting the
EE_ALL1_OK bit EE_CTRL1 register.
This function assumes the value passed in pu32StartAddress is a 32bit aligned address.
NOTE:
On devices using L2FMC memory controller, ECC may not be disabled for Banks 0 - 6 and
therefore performing a blank check with the Flash API functions are not supported.
Restrictions
The region being blank checked cannot cross bank address boundary.
Return Value
•
Fapi_Status_Success (success)
•
Fapi_Error_Fail (failure: region specified is not blank)
20
SPNU501F – December 2012 – Revised May 2014
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
www.ti.com
API Functions
3.4.2
Fapi_doBlankCheckByByte()
Verifies region specified is erased value by byte
Synopsis
Fapi_StatusType Fapi_doBlankCheckByByte(
uint8_t *pu8StartAddress,
uint32_t
u32Length,
Fapi_FlashStatusWordType *poFlashStatusWord)
Parameters
pu8StartAddress [in]
start address for region to blank check
u32Length [in]
length of region in 32-bit words to blank check
poFlashStatusWord [out]
returns the status of the operation if result is not
Fapi_Status_Success
->au32StatusWord[0]
address of first non-blank location
->au32StatusWord[1]
data read at first non-blank location
->au32StatusWord[2]
value of compare data (always 0xFF)
->au32StatusWord[3]
indicates read mode that failed blank check
Description
This function checks the device for blank (erase state) starting at the specified address for the length of 8-
bit words specified. If a non-blank location is found, these results will be returned in the
poFlashStatusWord parameter. This will use read margin 1 mode for this check. As the erase state of the
Flash is not a valid ECC condition, on Banks 0 - 6 ECC correction at a minimum must be disabled. On
Bank 7, ECC can either be temporarily disabled by writing 0101 to the EE_EDACEN bits or setting the
EE_ALL1_OK bit EE_CTRL1 register.
NOTE:
On devices using L2FMC memory controller, ECC may not be disabled for Banks 0 - 6 and
therefore performing a blank check with the Flash API functions are not supported.
Restrictions
The region being blank checked cannot cross bank address boundary.
Return Value
•
Fapi_Status_Success (success)
•
Fapi_Error_Fail (failure: region specified is not blank)
SPNU501F – December 2012 – Revised May 2014
21
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
API Functions
www.ti.com
3.4.3
Fapi_doVerify()
Verifies region specified against supplied data
Synopsis
Fapi_StatusType Fapi_doVerify(
uint32_t *pu32StartAddress,
uint32_t
u32Length,
uint32_t *pu32CheckValueBuffer,
Fapi_FlashStatusWordType *poFlashStatusWord)
Parameters
pu32StartAddress [in]
start address for region to verify
u32Length [in]
length of region in 32-bit words to verify
pu32CheckValueBuffer
address of buffer to verify region against
[in]
poFlashStatusWord [out]
returns the status of the operation if result is not
Fapi_Status_Success
->au32StatusWord[0]
address of first verify failure location
->au32StatusWord[1]
data read at first verify failure location
->au32StatusWord[2]
value of compare data
->au32StatusWord[3]
indicates read mode that failed verify
Description
This function verifies the device against the supplied data starting at the specified address for the length of
32-bit words specified. If a location fails to compare, these results will be returned in the
poFlashStatusWord parameter. This will use normal read, read margin 0 and read margin 1 modes for
verifying the data.
This function assumes the value passed in pu32StartAddress is a 32bit aligned address.
Restrictions
The region being verified cannot cross bank address boundary.
Return Value
•
Fapi_Status_Success (success)
•
Fapi_Error_Fail (failure: region specified does not match supplied data)
22
SPNU501F – December 2012 – Revised May 2014
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
www.ti.com
API Functions
3.4.4
Fapi_doVerifyByByte()
Verifies region specified against supplied data by byte
Synopsis
Fapi_StatusType Fapi_doVerifyByByte(
uint8_t *pu8StartAddress,
uint32_t
u32Length,
uint8_t *pu8CheckValueBuffer,
Fapi_FlashStatusWordType *poFlashStatusWord)
Parameters
pu8StartAddress [in]
start address for region to verify by byte
u32Length [in]
length of region in 8-bit words to verify
pu8CheckValueBuffer
address of buffer to verify region against by byte
[in]
poFlashStatusWord [out]
returns the status of the operation if result is not
Fapi_Status_Success
->au32StatusWord[0]
address of first verify failure location
->au32StatusWord[1]
data read at first verify failure location
->au32StatusWord[2]
value of compare data
->au32StatusWord[3]
indicates read mode that failed verify
Description
This function verifies the device against the supplied data by the byte starting at the specified address for
the length of 8-bit words specified. If a location fails to compare, these results will be returned in the
poFlashStatusWord parameter. This will use normal read, read margin 0 and read margin 1 modes
checking for verifying the data.
Restrictions
The region being verified cannot cross bank address boundary.
Return Value
•
Fapi_Status_Success (success)
•
Fapi_Error_Fail (failure: region specified does not match supplied data)
SPNU501F – December 2012 – Revised May 2014
23
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
API Functions
www.ti.com
3.4.5
Fapi_doPsaVerify()
Verifies region specified against specified PSA value
Synopsis
Fapi_StatusType Fapi_doPsaVerify(
uint32_t *pu32StartAddress,
uint32_t
u32Length,
uint32_t
u32PsaValue,
Fapi_FlashStatusWordType *poFlashStatusWord)
Parameters
pu32StartAddress [in]
start address for region to verify PSA value
u32Length [in]
length of region in 32-bit words to verify PSA value
u32PsaValue [in]
PSA value to compare region against
poFlashStatusWord [out]
returns the status of the operation if result is not
Fapi_Status_Success
->au32StatusWord[0]
Actual PSA for read-margin 0
->au32StatusWord[1]
Actual PSA for read-margin 1
->au32StatusWord[2]
Actual PSA for normal read
Description
This function verifies the device against the supplied PSA value starting at the specified address for the
length of 32-bit words specified. The calculated PSA values for all 3 margin modes are returned in the
poFlashStatusWord parameter.
This function assumes the value passed in pu32StartAddress is a 32bit aligned address.
Restrictions
The region being verified checked cannot cross bank address boundary.
Return Value
•
Fapi_Status_Success (success)
•
Fapi_Error_Fail (failure: region specified does not match supplied data)
24
SPNU501F – December 2012 – Revised May 2014
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
www.ti.com
API Functions
3.4.6
Fapi_calculatePsa()
Calculates the PSA for a specified region
Synopsis
uint32_t Fapi_calculatePsa(
uint32_t *pu32StartAddress,
uint32_t
u32Length,
uint32_t
u32PsaSeed,
Fapi_FlashReadMarginModeType oReadMode)
Parameters
pu32StartAddress [in]
start address for region to calculate PSA value
u32Length [in]
length of region in 32-bit words to calculate PSA value
u32PsaSeed [in]
seed value for PSA calculation
oReadMode [in]
indicates which margin mode (normal, RM0, RM1) to use
Description
This function calculates the PSA value for the region specified starting at pu32StartAddress for u32Length
32-bit words using u32PsaSeed value in the margin mode specified.
This function assumes the value passed in pu32StartAddress is a 32bit aligned address.
Restrictions
The region that the PSA is being calculated must be 32-bit aligned.
Return Value
•
Fapi_Status_Success (success)
•
Fapi_Error_InvalidReadMode (failure: read mode specified is not valid)
SPNU501F – December 2012 – Revised May 2014
25
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
API Functions
www.ti.com
3.4.7
Fapi_doMarginRead()
Reads a region of Flash Memory using specified margin mode
Synopsis
Fapi_StatusType Fapi_doMarginRead(
uint32_t *pu32StartAddress,
uint32_t *pu32ReadBuffer,
uint32_t
u32Length,
Fapi_FlashReadMarginModeType oReadMode)
Parameters
pu32StartAddress [in]
start address for region to read
pu32ReadBuffer [out]
address of buffer to return read data
u32Length [in]
length of region in 32-bit words to read
oReadMode [in]
indicates which margin mode (normal, RM0, RM1) to use
Description
This function reads the region specified starting at pu32StartAddress for u32Length 32-bit words using
pu32ReadBuffer to store the read values.
This function assumes the value passed in pu32StartAddress is a 32bit aligned address.
NOTE:
The region that is being read cannot cross bank address boundary.
Return Value
•
Fapi_Status_Success (success)
•
Fapi_Error_InvalidReadMode (failure: read mode specified is not valid)
•
Fapi_Error_NullPointer (failure: pu32ReadBuffer is a NULL pointer)
26
SPNU501F – December 2012 – Revised May 2014
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
www.ti.com
API Functions
3.4.8
Fapi_doMarginReadByByte()
Reads a region of Flash Memory using specified margin mode by byte
Synopsis
Fapi_StatusType Fapi_doMarginReadByByte(
uint8_t *pu8StartAddress,
uint8_t *pu8ReadBuffer,
uint32_t
u32Length,
Fapi_FlashReadMarginModeType oReadMode)
Parameters
pu8StartAddress [in]
start address for region to read by byte
pu8ReadBuffer [out]
address of buffer to return read data by byte u32
Length [in]
length of region in 32-bit words to read
oReadMode [in]
indicates which margin mode (normal, RM0, RM1) to use
Description
This function reads the region specified starting at pu8StartAddress for u32Length 8-bit words using
pu8ReadBuffer to store the read values.
Restrictions
The region that is being read cannot cross bank address boundary.
Return Value
•
Fapi_Status_Success (success)
•
Fapi_Error_InvalidReadMode (failure: read mode specified is not valid)
•
Fapi_Error_NullPointer (failure: pu8ReadBuffer is a NULL pointer)
SPNU501F – December 2012 – Revised May 2014
27
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
API Functions
www.ti.com
3.4.9
Fapi_flushPipeline()
Flushes the FMC pipeline buffers
Synopsis
void Fapi_flushPipeline(void)
Parameters
None
Description
This function flushes the FMC pipeline buffers.
NOTE:
The pipeline must be flushed before the first non-API Flash read after an operation that
modifies the Flash contents (Erasing and Programming).
This function makes the assumption that is can read from Flash Addresses 0, 0x100, 0x200,
0x300.
If the Flash and RAM memory regions are swapped, you will need to do 2 dummy reads 128
bytes apart from the remapped Flash memory addresses after an operation that modifies the
Flash contents (Erasing and Programming) before performing any API read functions.
Return Value
None
28
SPNU501F – December 2012 – Revised May 2014
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
www.ti.com
API Functions
3.5
Informational Functions
3.5.1
Fapi_getLibraryInfo()
Returns information about this compile of the Flash API
Synopsis
Fapi_LibraryInfoType Fapi_getLibraryInfo(void)
Parameters
None
Description
This function returns information specific to the compile of the Flash API library. The information is
returned in a struct Fapi_LibraryInfoType. The members are as follows:
•
u8ApiMajorVersion – Major version number of this compile of the API
•
u8ApiMinorVersion – Minor version number of this compile of the API
•
u8ApiRevision – Revision version number of this compile of the API
•
oApiProductionStatus – Production status of this compile (Alpha_Internal, Alpha, Beta_Internal, Beta,
Production)
•
u32ApiBuildNumber – Build number of this compile. Used to differentiate between different alpha and
beta builds
•
u8ApiTechnologyType – Indicates the Flash technology supported by the API. F021 is tech type of
0x04
•
u8ApiTechnologyRevision – Indicates the revision of the Technology supported by the API
•
u8ApiEndianness – Indicates if this compile of the API is for Big Endian or Little Endian memory
•
u32ApiCompilerVersion – Version number of the Code Composer Studio code generation tools used to
compile the API
Return Value
•
Fapi_LibraryInfoType (gives the information retrieved about this compile of the API)
SPNU501F – December 2012 – Revised May 2014
29
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
API Functions
www.ti.com
3.5.2
Fapi_getDeviceInfo()
Returns information about specific to device code is being executed on
Synopsis
Fapi_DeviceInfoType Fapi_getDeviceInfo(void)
Parameters
None
Description
This function returns information about the specific device the Flash API library is being executed on. The
information is returned in a struct Fapi_DeviceInfoType. The members are as follows:
•
u16NumberOfBanks – Number of banks on the device
•
u16DevicePackage – Device package pin count
•
u16DeviceMemorySize – Device memory size
•
u32AsicId – Device ASIC id
•
u32LotNumber – Device lot number
•
u16FlowCheck – Device Flow check
•
u16WaferNumber – Device wafer number
•
u16WaferXCoordinate – Device wafer X coordinate
•
u16WaferYCoordinate – Device wafer Y coordinate
Return Value
•
Fapi_DeviceInfoType (gives the information retrieved about this compile of the API)
30
SPNU501F – December 2012 – Revised May 2014
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
www.ti.com
API Functions
3.5.3
Fapi_getBankSectors()
Returns the sector information for the requested bank
Synopsis
Fapi_StatusType Fapi_getBankSectors(
Fapi_FlashBankType oBank,
Fapi_FlashBankSectorsType *poFlashBankSectors)
Parameters
oBank [in]
Bank to get information on
poFlashBankSectors [out]
Returned structure with the bank information
Description
This function returns information about the bank starting address, number of sectors, sector sizes in
kilobytes, and bank technology type. The information is returned in a struct Fapi_FlashBankSectorsType.
The members are as follows:
•
oFlashBankTech – Indicates if bank is an FLEP, FLEE or FLES bank type
•
u32NumberOfSectors – Indicates the number of sectors in the bank
•
u32BankStartAddress – Starting address of the bank
•
au16SectorSizes[] – An array of sectors sizes for each sector in the bank (As all sectors on FLEE
banks are the same size, only au16SectorSizes[0] is returned with a sector size)
Return Value
•
Fapi_Status_Success (success)
•
Fapi_Error_FeatureNotAvailable (failure: Not all devices have this support in the Flash Memory
Controller)
•
Fapi_Error_InvalidBank (failure: Bank does not exist on this device)
•
Fapi_Error_NullPointer (failure: poFlashBankSectors is a NULL pointer)
SPNU501F – December 2012 – Revised May 2014
31
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
API Functions
www.ti.com
3.6
Utility Functions
3.6.1
Fapi_calculateFletcherChecksum()
Calculates the Fletcher checksum from the given address and length
Synopsis
uint32_t Fapi_calculateFletcherChecksum(
uint16_t *pu16Data,
uint16_t u16Length)
Parameters
pu16Data [in]
Address to start calculating the checksum from
u16Length [in]
Number of 16-bit words to use in calculation
Description
This function generates a 32-bit Fletcher checksum starting at the supplied address for the number of 16-
bit words specified.
This function assumes the value passed in pu16Data is a 16bit aligned address.
Return Value
•
• 32-bit Fletcher Checksum value
3.6.2
Fapi_calculateEcc()
Calculates the ECC for a 64-bit value
Synopsis
uint8_t Fapi_calculateEcc(
uint32_t u32Address,
uint64 u64Data)
Parameters
u32Address [in]
Address of the 64-bit value to calculate the ECC
u64Data [in]
64-bit value to calculate ECC on
Description
This function will calculate the ECC for a 64-bit aligned word including address if device supports address
in ECC calculation.
This function assumes the value passed in u32Address is a 64bit aligned address.
NOTE:
As of version 1.51.0 of the API, this function expects the value in u64Data to be in the
natural Endianness of the system the function is being called on.
Return Value
•
8-bit calculated ECC
32
SPNU501F – December 2012 – Revised May 2014
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
www.ti.com
API Functions
3.6.3
Fapi_waitDelay() -- Deprecated
Generates a delay roughly proportional to the value passed. The delay is created with a simple software
loop. The time is not adjusted to account for operating frequency, CPU type or memory access time. This
function will not be supported in future versions of this API.
Synopsis
uint8_t Fapi_waitDelay(
uint32_t u32WaitDelay)
Parameters
u32WaitDelay [in]
Number of arbitrary units to delay
Description
This function will generate a wait for a time rougnly proportional to the value of u32WaitDelay.
Return Value
•
Fapi_Status_Success (success)
3.7
User Definable Functions
These callback functions are distributed in the file Fapi_UserDefinedFunctions.c and used by the read
Table 4 functions. These are the base functions called by the API and can be modified to meet the user’s
need for these operations. This file must be compiled with the user’s code.
3.7.1
Fapi_serviceWatchdogTimer()
Services the watchdog timer
Synopsis
Fapi_StatusType Fapi_serviceWatchdogTimer(void)
Parameters
None
Description
This function allows the user to service their watchdog timer in the read Table 4 functions. It is called
when the address being read crosses the 256 byte aligned address boundaries.
Return Value
•
Fapi_Status_Success (success)
Sample Implementation
#include “F021.h”
Fapi_StatusType Fapi_serviceWatchdogTimer(void)
{
/* User to add their own watchdog servicing code here */
return(Fapi_Status_Success);
}
SPNU501F – December 2012 – Revised May 2014
33
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
API Macros
www.ti.com
4
API Macros
The API includes a set of helper macros that may be used by the developer.
4.1
FAPI_CHECK_FSM_READY_BUSY
Returns state of FSM.
Synopsis
#define FAPI_CHECK_FSM_READY_BUSY (FLASH_CONTROL_REGISTER-
>FmStat.FMSTAT_BITS.BUSY ? Fapi_Status_FsmBusy : Fapi_Status_FsmReady)
Parameters
None
Description
This macro returns the state of the FSM.
Return Value
•
Fapi_Status_FsmReady (FSM is ready to accept a new command)
•
Fapi_Status_FsmBusy (FSM is busy and may only accept a suspend command if operation is
program or erase sector)
4.2
FAPI_CLEAR_FSM_DONE_EVENT
Helper macro to clear FSM_DONE event
Synopsis
#define FAPI_CLEAR_FSM_DONE_EVENT (FLASH_CONTROL_REGISTER-
>FedAcStatus.FEDACSTATUS_BITS.FSM_DONE = 1U)
Parameters
None
Description
This macro writes a 1 to the FSM_DONE bit in the FEDACSTATUS register to clear the FSM_DONE
event.
Return Value
None
34
SPNU501F – December 2012 – Revised May 2014
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
www.ti.com
API Macros
4.3
FAPI_GET_FSM_STATUS
Returns the value of the FMSTAT register
Synopsis
#define GET_FSM_STATUS (FLASH_CONTROL_REGISTER->FmStat.u32Register)
Parameters
None
Description
This macro is used to get the value of the FMSTAT register.
FMSTAT Register Value
Figure 1. FMSTAT Register
31
24
Reserved
23
16
Reserved
15
14
13
12
11
10
9
8
Reserved
ILA
Reserved
PGV
Reserved
EV
Reserved
BUSY
7
6
5
4
3
2
1
0
ERS
PGM
INV-DAT
CSTAT
VOLTSTAT
ESUSP
PSUSP
SLOCK
Table 8. FMSTAT Register Field Descriptions
Bit
Field
Description
15
Reserved
Read returns 0. Writes have no effect.
Illegal Address
14
ILA
When set, indicates that an illegal address is detected. Three conditions can set illegal address
flags.
• Writing to a hole (un-implemented logical address space) within a Flash bank.
• Writing to an address location to an un-implemented Flash space.
• Input address for write is decoded to select a different bank from the bank ID register.
• The address range does not match the type of FSM command. For example, the erase_sector
and erase_OTP commands must match the address regions.
• TI-OTP address selected but CMD_EN in FSM_ST_MACHINE is not set.
13
Reserved
Read returns 0. Writes have no effect.
Program verify When set, indicates that a word is not successfully programmed after the maximum
12
PGV
allowed number of program pulses are given for program operation.
11
Reserved
Read returns 0. Writes have no effect.
Erase verify When set, indicates that a sector is not successfully erased after the maximum
10
EV
allowed number of erase pulses are given for erase operation. During Erase verify command, this
flag is set immediately if a bit is found to be 0.
9
Reserved
Read returns 0. Writes have no effect.
8
BUSY
When set, this bit indicates that a program, erase, or suspend operation is being processed.
Erase Active. When set, this bit indicates that the Flash module is actively performing an erase
7
ERS
operation. This bit is set when erasing starts and is cleared when erasing is complete. It is also
cleared when the erase is suspended and set when the erase resumes.
Program Active. When set, this bit indicates that the Flash module is currently performing a
program operation. This bit is set when programming starts and is cleared when programming is
6
PGM
complete. It is also cleared when programming is suspended and set when programming is
resumes.
SPNU501F – December 2012 – Revised May 2014
35
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
API Macros
www.ti.com
Table 8. FMSTAT Register Field Descriptions (continued)
Bit
Field
Description
Invalid Data. When set, this bit indicates that the user attempted to program a “1” where a “0” was
5
INVDAT
already present. This bit is cleared by the Clear Status command.
Command Status. Once the FSM starts any failure will set this bit. When set, this bit informs the
host that the program, erase, or validate sector command failed and the command was stopped.
4
CSTAT
This bit is cleared by the Clear Status command. For some errors, this will be the only indication of
an FSM error because the cause does not fall within the other error bit types.
Core Voltage Status. When set, this bit indicates that the core voltage generator of the pump power
3
VOLTSTAT
supply dipped below the lower limit allowable during a program or erase operation. This bit is
cleared by the Clear Status command. Version 3.0.9, 3.1.0 Preliminary Flash Registers
Erase Suspend. When set, this bit indicates that the Flash module has received and processed an
2
ESUSP
erase suspend operation. This bit remains set until the erase resume command has been issued or
until the Clear_More command is run.
Program Suspend. When set, this bit indicates that the Flash module has received and processed
1
PSUSP
a program suspend operation. This bit remains set until the program resume command has been
issued or until the Clear_More command is run.
Sector Lock Status. When set, this bit indicates that the operation was halted because the target
0
SLOCK
sector was locked for erasing and the programming either by the sector protect bit or by OTP write
protection disable bits. This bit is cleared by the Clear Status command.
No SLOCK FSM error will occur if all sectors in a bank erase operation are set to 1. All the sectors
will be checked but no LOCK will be set if no operation occurs due to the SECT_ERASED bits
being set to all ones. A SLOCK error will occur if attempting to do a sector erase with either BSE is
cleared or SECT_ERASED is set. For FLEE Flash banks over 16 sectors, the BSE register must
be set to all ones for a bank or sector erase.
4.4
FAPI_SUSPEND_FSM
Issues FSM suspend command
Synopsis
#define FAPI_SUSPEND_FSM
(FAPI_WRITE_LOCKED_FSM_REGISTER(FLASH_CONTROL_REGISTER-
>FsmExecute.FSM_EXECUTE_BITS.SUSPEND_NOW, 0x5U))
Parameters
None
Description
This macro will issue a FSM suspend command. Only program and erase sector operations are valid
suspendable operations.
Return Value
None
36
SPNU501F – December 2012 – Revised May 2014
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
www.ti.com
API Macros
4.5
FAPI_WRITE_EWAIT
Helper macro to write EWAIT value
Synopsis
#define FAPI_WRITE_EWAIT(_mEwait) (FAPI_WRITE_LOCKED_FSM_REGISTER(FLASH_CONTROL_REGISTER-
>EepromConfig.EEPROM_CONFIG_BITS.EWAIT,_mEwait))
Parameters
_mEwait [in]
EWAIT value to be written
Description
This macro writes _mEwait to the EWAIT bits in the EEPROM_CONFIG register.
Return Value
None
4.6
FAPI_WRITE_LOCKED_FSM_REGISTER
Allow easy writing to Flash Memory Controller registers that need to be unlocked first.
Synopsis
#define FAPI_WRITE_LOCKED_FSM_REGISTER(mRegister,mValue)
\
do {
\
Fapi_GlobalInit.m_poFlashControlRegisters->FsmWrEna.FSM_WR_ENA_BITS.WR_ENA
= 0x5U; \
mRegister = mValue;
\
Fapi_GlobalInit.m_poFlashControlRegisters->FsmWrEna.FSM_WR_ENA_BITS.WR_ENA
= 0x2U; \
}while(0)
Parameters
mRegister [in]
Address or bitfield of the locked register to be written to
mValue [in]
Value to be written to the locked register
Description
This function sets up the sectors in the non EEPROM banks that are available for erase and programming
operations.
Return Value
None
5
Recommended FSM Flows
5.1
New Devices From Factory
Devices are shipped erased from the Factory. It is recommended, but not required to do a blank check on
devices received to verify that they are erased.
SPNU501F – December 2012 – Revised May 2014
37
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
Recommended FSM Flows
www.ti.com
5.2
Recommended Erase Flows
Figure 2 and Figure 3 describe the flow for erasing a sector(s) or bank(s) on a device. For further
information, see Section 3.2.2.
Start
Call
Fapi_issueAsyncCommandWithAddress()
Using Fapi_EraseSector command
Properly Initialized Device
Call
Fapi_initializeFlashBanks()
No
Execute other
CHECK_FSM_READY_BUSY
code as
!= Fapi_Status_FsmBusy
needed
Call
Fapi_setActiveFlashBank()
for current bank
Yes
Call either
Fapi_enableMainBankSectors() or
Fapi_enableEepromBankSectors()
No
appropriate for current bank
GET_FSM_STATUS
DUT fails Program
== 0
Yes
Yes
CHECK_FSM_READY_BUSY
== Fapi_Status_FsmReady
No
Another Sector to Erase?
Done
No
Yes
No
Is Sector in a different
bank?
Yes
Figure 2. Recommended Sector Erase Flow
38
SPNU501F – December 2012 – Revised May 2014
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
www.ti.com
Recommended FSM Flows
Start
Call
Fapi_issueAsyncCommandWithAddress()
Using Fapi_EraseBank command
Properly Initialized Device
Call
Fapi_initializeFlashBanks()
No
Execute other
CHECK_FSM_READY_BUSY
code as
!= Fapi_Status_FsmBusy
needed
Call
Fapi_setActiveFlashBank()
for current bank
Yes
Call either
Fapi_enableMainBankSectors() or
Fapi_enableEepromBankSectors()
No
appropriate for current bank
GET_FSM_STATUS
DUT fails Program
== 0
Yes
Yes
CHECK_FSM_READY_BUSY
== Fapi_Status_FsmReady
Yes
Another Bank to Erase?
No
No
Done
Figure 3. Recommended Bank Erase Flow
SPNU501F – December 2012 – Revised May 2014
39
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
Recommended FSM Flows
www.ti.com
5.3
Recommended Program Flow
Figure 4 describes the flow for programming a device. This flow assumes the user has already erased all
affected sectors or banks following the Recommended Erase Flow (see Section 5.2). For further
information, see Section 3.3.1.
Start
Call Fapi_issueProgrammingCommand()
Supplying address, data and mode
Properly Initialized Device
No
Call
Execute other
CHECK_FSM_READY_BUSY
Fapi_initializeFlashBanks()
code as
!= Fapi_Status_FsmBusy
needed
Call
Yes
Fapi_setActiveFlashBank()
for current bank
No
Call either
GET_FSM_STATUS
DUT fails Program
Fapi_enableMainBankSectors() or
== 0
Fapi_enableEepromBankSectors()
appropriate for current bank
Yes
Yes
CHECK_FSM_READY_BUSY
No
== Fapi_Status_FsmReady
More data to program?
Done
No
Yes
Is data in same bank?
No
Figure 4. Recommended Program Flow
40
SPNU501F – December 2012 – Revised May 2014
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
www.ti.com
Appendix A Flash State Machine Commands
A.1
Flash State Machine Commands
Table 9. Flash State Machine Commands
Command
Description
Enumeration Type
API Call(s)
Program
Used to program data to
Fapi_ProgramData
Fapi_issueProgrammingCommandForEccAddress()
Data
any valid Flash address
Used to erase a Flash
Erase Sector sector located by the
Fapi_EraseSector
specified address
Fapi_issueAsyncCommandWithAddress()
Used to erase a Flash bank
Erase Bank
located by the specified
Fapi_EraseBank
address
Clear Status
Clears the status register
Fapi_ClearStatus
Fapi_issueAsyncCommand()
Program
Resumes a suspended
Fapi_ProgramResume
Fapi_issueAsyncCommand()
Resume
programming operation
Erase
Resumes a suspended
Fapi_EraseResume
Fapi_issueAsyncCommand()
Resume
erase operation
Clear More
Clears the status register
Fapi_ClearMore
Fapi_issueAsyncCommand()
SPNU501F – December 2012 – Revised May 2014
Flash State Machine Commands
41
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
www.ti.com
Appendix B Typedefs and Enumerations
B.1
Type Definitions
typedef unsigned char boolean_t;
B.2
Enumerations
B.2.1
Fapi_CpuSelectorType
This is used to indicate which CPU is being used.
typedef enum
{
Fapi_MasterCpu,
Fapi_SlaveCpu0
} ATTRIBUTE_PACKED Fapi_CpuSelectorType;
B.2.2
Fapi_CpuType
This is used to indicate what type of Cpu is being used.
typedef enum
{
ARM7 = 0U,
/* ARM7 core, Legacy placeholder */
M3
= 1U,
/* ARM Cortex M3 core */
R4
= 2U,
/* ARM Cortex R4 core without ECC logic */
R4F
= 3U,
/* ARM Cortex R4, R4F, and R5 cores with ECC logic*/
C28
= 4U,
/* TI C28x core */
Undefined1 = 5U,
/* To Be Determined.
Future core placeholder */
Undefined2 = 6U,
/* To Be Determined.
Future core placeholder */
Undefined3 = 7U
/* To Be Determined.
Future core placeholder */
}
ATTRIBUTE_PACKED Fapi_CpuType;
B.2.3
Fapi_FamilyType
This is used to indicate what type of Family is being used.
typedef enum
{
Family_FMC
= 0x00,
Family_L2FMC
= 0x10,
Family_Sonata
= 0x20,
Family_Stellaris = 0x30,
Family_Future
= 0x40
} ATTRIBUTE_PACKED Fapi_FamilyType;
42
Typedefs and Enumerations
SPNU501F – December 2012 – Revised May 2014
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
www.ti.com
Enumerations
B.2.4
Fapi_AddressMemoryType
This is used to indicate what type of Address is being used.
typedef enum
{
Fapi_Flash,
Fapi_FlashEcc,
Fapi_Otp,
Fapi_OtpEcc,
Fapi_Undefined
}
ATTRIBUTE_PACKED Fapi_AddressMemoryType;
B.2.5
Fapi_FlashProgrammingCommandsType
This contains all the possible modes used in the Fapi_IssueAsyncProgrammingCommand().
typedef enum
{
Fapi_AutoEccGeneration, /* This is the default mode for the command and will auto generate
the ecc for the provided data buffer */
Fapi_DataOnly,
/* Command will only process the data buffer */
Fapi_EccOnly,
/* Command will only process the ecc buffer */
Fapi_DataAndEcc
/* Command will process data and ecc buffers */
}
ATTRIBUTE_PACKED Fapi_FlashProgrammingCommandsType;
B.2.6
Fapi_FlashBankType
This is used to indicate which Flash bank is being used.
typedef enum
{
Fapi_FlashBank0=0,
Fapi_FlashBank1=1,
Fapi_FlashBank2=2,
Fapi_FlashBank3=3,
Fapi_FlashBank4=4,
Fapi_FlashBank5=5,
Fapi_FlashBank6=6,
Fapi_FlashBank7=7
}
ATTRIBUTE_PACKED Fapi_FlashBankType;
SPNU501F – December 2012 – Revised May 2014
Typedefs and Enumerations
43
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
Enumerations
www.ti.com
B.2.7
Fapi_FlashBankTechType
This is used to indicate what F021 Bank Technology the bank is.
typedef enum
{
Fapi_FLEP=0,
Fapi_FLEE=1,
Fapi_FLES=2,
Fapi_FLHV=3
}
ATTRIBUTE_PACKED Fapi_FlashBankTechType;
B.2.8
Fapi_FlashSectorType
This is used to indicate which Flash sector is being used.
typedef enum
{
Fapi_FlashSector0,
Fapi_FlashSector1,
Fapi_FlashSector2,
Fapi_FlashSector3,
Fapi_FlashSector4,
Fapi_FlashSector5,
Fapi_FlashSector6,
Fapi_FlashSector7,
Fapi_FlashSector8,
Fapi_FlashSector9,
Fapi_FlashSector10,
Fapi_FlashSector11,
Fapi_FlashSector12,
Fapi_FlashSector13,
Fapi_FlashSector14,
Fapi_FlashSector15,
Fapi_FlashSector16,
Fapi_FlashSector17,
Fapi_FlashSector18,
Fapi_FlashSector19,
Fapi_FlashSector20,
Fapi_FlashSector21,
Fapi_FlashSector22,
Fapi_FlashSector23,
Fapi_FlashSector24,
Fapi_FlashSector25,
Fapi_FlashSector26,
Fapi_FlashSector27,
Fapi_FlashSector28,
Fapi_FlashSector29,
Fapi_FlashSector30,
Fapi_FlashSector31,
Fapi_FlashSector32,
Fapi_FlashSector33,
Fapi_FlashSector34,
Fapi_FlashSector35,
Fapi_FlashSector36,
Fapi_FlashSector37,
Fapi_FlashSector38,
Fapi_FlashSector39,
Fapi_FlashSector40,
Fapi_FlashSector41,
Fapi_FlashSector42,
44
Typedefs and Enumerations
SPNU501F – December 2012 – Revised May 2014
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
www.ti.com
Enumerations
Fapi_FlashSector43,
Fapi_FlashSector44,
Fapi_FlashSector45,
Fapi_FlashSector46,
Fapi_FlashSector47,
Fapi_FlashSector48,
Fapi_FlashSector49,
Fapi_FlashSector50,
Fapi_FlashSector51,
Fapi_FlashSector52,
Fapi_FlashSector53,
Fapi_FlashSector54,
Fapi_FlashSector55,
Fapi_FlashSector56,
Fapi_FlashSector57,
Fapi_FlashSector58,
Fapi_FlashSector59,
Fapi_FlashSector60,
Fapi_FlashSector61,
Fapi_FlashSector62,
Fapi_FlashSector63
}
ATTRIBUTE_PACKED Fapi_FlashSectorType;
B.2.9
Fapi_FlashStateCommandsType
This contains all the possible Flash State Machine commands.
typedef enum
{
Fapi_ProgramData
= 0x0002,
Fapi_EraseSector
= 0x0006,
Fapi_EraseBank
= 0x0008,
Fapi_ValidateSector = 0x000E,
Fapi_ClearStatus
= 0x0010,
Fapi_ProgramResume
= 0x0014,
Fapi_EraseResume
= 0x0016,
Fapi_ClearMore
= 0x0018
}
ATTRIBUTE_PACKED Fapi_FlashStateCommandsType;
B.2.10
Fapi_FlashReadMarginModeType
This contains all the possible Flash State Machine commands.
typedef enum
{
Fapi_NormalRead = 0x0,
Fapi_RM0
= 0x1,
Fapi_RM1
= 0x2
}
ATTRIBUTE_PACKED Fapi_FlashReadMarginModeType;
SPNU501F – December 2012 – Revised May 2014
Typedefs and Enumerations
45
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
Enumerations
www.ti.com
B.2.11
Fapi_StatusType
This is the master type containing all possible returned status codes.
typedef enum
{
Fapi_Status_Success=0,
/* Function completed successfully */
Fapi_Status_FsmBusy,
/* FSM is Busy */
Fapi_Status_FsmReady,
/* FSM is Ready */
Fapi_Error_Fail,
/* Generic Function Fail code */
Fapi_Error_NullPointer,
/* One of the pointer parameters is a null pointer */
Fapi_Error_InvalidCommand,
/* Command used is invalid for the function called */
Fapi_Error_InvalidEccAddress,
/* Returned if the ECC Address given to a function is
invalid for that function */
Fapi_Error_OtpChecksumMismatch,
/* Returned if OTP checksum does not match expected value */
Fapi_Error_InvalidHclkValue,
/* Returned if FClk is above max FClk value -
FClk is a calculated from HClk and
RWAIT/EWAIT */
Fapi_Error_InvalidBank,
/* Returned if the specified bank does not exist */
Fapi_Error_InvalidAddress,
/* Returned if the specified Address does not exist in
Flash or OTP */
Fapi_Error_InvalidReadMode,
/* Returned if the specified read mode does not exist */
Fapi_Error_AsyncIncorrectDataBufferLength,
/* Returned if Data buffer size specified
exceeds Data bank width */
Fapi_Error_AsyncIncorrectEccBufferLength,
/* Returned if ECC buffer size specified
exceeds ECC bank width */
Fapi_Error_AsyncDataEccBufferLengthMismatch, /* Returned if Data buffer size either is not
64bit aligned or Data
length exceeds amount ECC supplied */
Fapi_Error_FeatureNotAvailable
/* FMC feature is not available on this device */
}
ATTRIBUTE_PACKED Fapi_StatusType;
B.2.12
Fapi_ApiProductionStatusType
This lists the different production status values possible for the API.
typedef enum
{
Alpha_Internal,
/* For internal TI use only.
Not intended to be used by customers
*/
Alpha,
/* Early Engineering release.
May not be functionally complete */
Beta_Internal,
/* For internal TI use only.
Not intended to be used by customers
*/
Beta,
/* Functionally complete, to be used for testing and validation */
Production
/* Fully validated, functionally complete, ready for production use
*/
}
ATTRIBUTE_PACKED Fapi_ApiProductionStatusType;
46
Typedefs and Enumerations
SPNU501F – December 2012 – Revised May 2014
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
www.ti.com
Appendix C Flash Validation Procedure
TI distributes the F021 Flash API as pre-compiled object libraries which has been fully qualified for use on
Hercules devices. This ensures that the object code for programming will be the same as was qualified by
TI. However it might be still possible that the application program does not use the API functions correctly
by either passing incorrect values or using the API functions in a manner not in accordance with the API
documentation. In order to ensure proper usage of the Flash API, the in application and 3rd programming
tools must be validated.
1. Erase and program at least 4 devices with customer's object code using the method selected by the
customer for programming.
2. Using the TI profiling tool (contact local TI representative to obtain), generate profiles for each device
programmed in 1.
3. Erase and program these devices again using the same data pattern used in step 1 with the TI tool,
UniFlash.
4. Repeat step 2 on the devices programmed with UniFlash.
The profiles generated in steps 2 and 4 should correlate within 100mV or 18 indices on the 0's Vt and be
within 3 indices on the 1's BCC.
NOTE:
It is also highly recommended that the F021 Flash API usage be thouroughly reviewed by
someone who was not involved with writing the code for Flash usage.
SPNU501F – December 2012 – Revised May 2014
Flash Validation Procedure
47
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
www.ti.com
Appendix D Parallel Signature Analysis (PSA) algorithm
The functions Section 3.4.6 and Section 3.4.5 make use of the Parallel Signature Analysis (PSA) algoritm.
Those functions are typically used to verify a particular pattern is programmed in the Flash Memory
without transferring the complete data pattern. The PSA signature is based on this primative polynomial:
f(X) = 1 + X + X2 + X22 + X31
uint32_t calculatePSA (uint32_t* pu32StartAddress,
uint32_t
u32Length,
/* Number of 32bit words */
uint32_t
u32InitialSeed)
{
uint32_t u32Seed, u32SeedTemp;
u32Seed = u32InitialSeed;
while(u32Length--)
{
u32SeedTemp = (u32Seed << 1)^*(pu32StartAddress++);
if(u32Seed & 0x80000000)
{
u32SeedTemp ^= 0x00400007;
/* XOR the seed value with mask */
}
u32Seed = u32SeedTemp;
}
return u32Seed;
}
48
Parallel Signature Analysis (PSA) algorithm
SPNU501F – December 2012 – Revised May 2014
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
www.ti.com
Appendix E Revision History
Table 10 lists the API versions.
Table 10. API Version History
Version
Additions/Modifications/Deletions
1.00.0
Initial Revision
1.00.1
Added missing extern reference for Fapi_getBankSectors()
• Added support for Concerto devices.
• Corrected issue with with Fapi_doBlankCheck() and Fapi_doVerify that could cause an illegal address
1.50.0
abort.
• Added ECC read support for 72-bit wide FLEE banks
• SDOCM00086276 - Changed the u64Data parameter passed to Fapi_calculateEcc() to be consistent
behavior on Big and Little Endian Systems.
• SDOCM00087304 - Updated Fapi_doBlankCheck to use Read Margin mode 0 only.
• SDOCM00086404 - Added macro FAPI_WRITE_LOCKED_FSM_REGISTER() to allow easier writes to
locked register in the Flash Memory Controller.
• SDOCM00086405 - Changed the functions Fapi_setupEepromSectorEnable() and
Fapi_setupBankSectorEnable() in Fapi_UserDefinedFunctions.c to use the macro
1.51.0
FAPI_WRITE_LOCKED_FSM_REGISTER() as the register that were being written to are locked
register in the Flash Memory Controller.
• SDOCM00086402 - Corrected the issue in Fapi_doMarginRead() that did not return all the requested
data in the ECC memory regions.
• SDOCM00088256 - Changed the check that insures max FCLK value for the device is not exceeded
from a defined constant in the API to a check from the device OTP value.
• SDOCM00087302 - Updated the structures in Types.h to support linking in gcc toolchain.
• Replaced the user defined callback functions Fapi_setupEepromSectorEnable() and
Fapi_setupBankSectorEnable() with the functions Fapi_enableEepromBankSectors() and
Fapi_enableMainBankSectors.
• Deprecated the function Fapi_waitDelay().
• Removed the header files F021_FMC_BE.h and F021_FMC_LE.h as F021.h has been updated to
automatically determine compile endianness.
• Replaced the Fapi_initializeAPI() function with Fapi_initializeFlashBanks(). With this change, all global
variables have been removed from the API.
• Added the Compatibility.h header file. This file contains some backwards compatibility macros to work
with projects that were previously built with v1.51 of the API. The list of functions and global variables
with compatibility defines are:
2.00.00
–
Fapi_initializeAPI()
–
Fapi_getFsmStatus()
–
Fapi_issueFsmSuspendCommand()
–
Fapi_writeEwaitValue(mEwait)
–
Fapi_checkFsmForReady()
–
Fapi_GlobalInit.m_poFlashControlRegisters
• Fapi_getBankSectors() was updated to return sector sizes in kilobytes and to support 256kB sectors,
au8SectorSizes which was an array uint8_t was changed to an array of uint16_t and renamed
au16SectorSizes.
SPNU501F – December 2012 – Revised May 2014
Revision History
49
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
Appendix E
www.ti.com
Table 10. API Version History (continued)
Version
Additions/Modifications/Deletions
• Added Fapi_remapMainAddress() to give an easy method to determine ECC address for a main flash
address
• Removed unused status' from Fapi_StatusType
–
Fapi_Status_AsyncBusy
–
Fapi_Status_AsyncComplete
–
Fapi_Error_StateMachineTimeout
2.00.00
–
Fapi_Error_InvalidDelayValue
–
Fapi_Error_InvalidCpu
• Removed the listing of structures. Please refer to the installed F021 Flash API headers files for these.
• Changed from the use of defined typedefs uint64, uint32, uint16, and uint8 to the standard definitions in
stdint.h, uint64_t, uint32_t, uint16_t, and uint8_t. Also changed boolean to boolean_t
• Added #if defined guardbanding around the defines in Types.h that can conflict with Autosar
Platform_Types.h defines.
• Added appendix describing the PSA calculation
• Corrected the function description for Fapi_enableMainBanks().
2.00.01
• Added additional files that are distributed with the library.
• Added additional library files for L2FMC with floating point support.
• SDOCM00102756 - Remove FLOCK register from register include file.
2.01.00
• SDOCM00103134 - Sector size returned for FLEE banks by Fapi_getBankSectors() is double the
actual size.
Table 11 lists the API changes made since the previous revision of this document.
Table 11. Document Revision History
Reference
Additions/Modifications/Deletions
-
Initial revision
A
Updated for v1.50.0
B
Updated the example code for Fapi_issueProgrammingCommand()
C
Updated for v1.51.0
D
Updated for v2.00.00
E
Updated for v2.00.01
• Added the Validation procedure
F
• Corrected the register field name to disable ECC on bank 7 before calling a Blank Check function.
G
Updated for v2.01.00
50
Revision History
SPNU501F – December 2012 – Revised May 2014
Submit Documentation Feedback
Copyright © 2012–2014, Texas Instruments Incorporated
IMPORTANT NOTICE
Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, enhancements, improvements and other
changes to its semiconductor products and services per JESD46, latest issue, and to discontinue any product or service per JESD48, latest
issue. Buyers should obtain the latest relevant information before placing orders and should verify that such information is current and
complete. All semiconductor products (also referred to herein as “components”) are sold subject to TI’s terms and conditions of sale
supplied at the time of order acknowledgment.
TI warrants performance of its components to the specifications applicable at the time of sale, in accordance with the warranty in TI’s terms
and conditions of sale of semiconductor products. Testing and other quality control techniques are used to the extent TI deems necessary
to support this warranty. Except where mandated by applicable law, testing of all parameters of each component is not necessarily
performed.
TI assumes no liability for applications assistance or the design of Buyers’ products. Buyers are responsible for their products and
applications using TI components. To minimize the risks associated with Buyers’ products and applications, Buyers should provide
adequate design and operating safeguards.
TI does not warrant or represent that any license, either express or implied, is granted under any patent right, copyright, mask work right, or
other intellectual property right relating to any combination, machine, or process in which TI components or services are used. Information
published by TI regarding third-party products or services does not constitute a license to use such products or services or a warranty or
endorsement thereof. Use of such information may require a license from a third party under the patents or other intellectual property of the
third party, or a license from TI under the patents or other intellectual property of TI.
Reproduction of significant portions of TI information in TI data books or data sheets is permissible only if reproduction is without alteration
and is accompanied by all associated warranties, conditions, limitations, and notices. TI is not responsible or liable for such altered
documentation. Information of third parties may be subject to additional restrictions.
Resale of TI components or services with statements different from or beyond the parameters stated by TI for that component or service
voids all express and any implied warranties for the associated TI component or service and is an unfair and deceptive business practice.
TI is not responsible or liable for any such statements.
Buyer acknowledges and agrees that it is solely responsible for compliance with all legal, regulatory and safety-related requirements
concerning its products, and any use of TI components in its applications, notwithstanding any applications-related information or support
that may be provided by TI. Buyer represents and agrees that it has all the necessary expertise to create and implement safeguards which
anticipate dangerous consequences of failures, monitor failures and their consequences, lessen the likelihood of failures that might cause
harm and take appropriate remedial actions. Buyer will fully indemnify TI and its representatives against any damages arising out of the use
of any TI components in safety-critical applications.
In some cases, TI components may be promoted specifically to facilitate safety-related applications. With such components, TI’s goal is to
help enable customers to design and create their own end-product solutions that meet applicable functional safety standards and
requirements. Nonetheless, such components are subject to these terms.
No TI components are authorized for use in FDA Class III (or similar life-critical medical equipment) unless authorized officers of the parties
have executed a special agreement specifically governing such use.
Only those TI components which TI has specifically designated as military grade or “enhanced plastic” are designed and intended for use in
military/aerospace applications or environments. Buyer acknowledges and agrees that any military or aerospace use of TI components
which have not been so designated is solely at the Buyer's risk, and that Buyer is solely responsible for compliance with all legal and
regulatory requirements in connection with such use.
TI has specifically designated certain components as meeting ISO/TS16949 requirements, mainly for automotive use. In any case of use of
non-designated products, TI will not be responsible for any failure to meet ISO/TS16949.
Products
Applications
Audio
www.ti.com/audio
Automotive and Transportation
www.ti.com/automotive
Amplifiers
amplifier.ti.com
Communications and Telecom
www.ti.com/communications
Data Converters
dataconverter.ti.com
Computers and Peripherals
www.ti.com/computers
DLP® Products
www.dlp.com
Consumer Electronics
www.ti.com/consumer-apps
DSP
dsp.ti.com
Energy and Lighting
www.ti.com/energy
Clocks and Timers
www.ti.com/clocks
Industrial
www.ti.com/industrial
Interface
interface.ti.com
Medical
www.ti.com/medical
Logic
logic.ti.com
Security
www.ti.com/security
Power Mgmt
power.ti.com
Space, Avionics and Defense
www.ti.com/space-avionics-defense
Microcontrollers
microcontroller.ti.com
Video and Imaging
www.ti.com/video
RFID
www.ti-rfid.com
OMAP Applications Processors
www.ti.com/omap
TI E2E Community
e2e.ti.com
Wireless Connectivity
www.ti.com/wirelessconnectivity
Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265
Copyright © 2014, Texas Instruments Incorporated
Document Outline
- F021 Flash API
- Table of Contents
- 1 Introduction
- 2 F021 Flash API Overview
- 3 API Functions
- 3.1 Flash State Machine Functions
- 3.1.1 Fapi_disableAutoEccCalculation()
- 3.1.2 Fapi_disableBanksForOtpWrite()
- 3.1.3 Fapi_disableFsmDoneEvent()
- 3.1.4 Fapi_enableAutoEccCalculation()
- 3.1.5 Fapi_enableBanksForOtpWrite()
- 3.1.6 Fapi_enableEepromBankSectors()
- 3.1.7 Fapi_enableFsmDoneEvent()
- 3.1.8 Fapi_enableMainBankSectors()
- 3.1.9 Fapi_isAddressEcc()
- 3.1.10 Fapi_initializeFlashBanks()
- 3.1.11 Fapi_remapEccAddress()
- 3.1.12 Fapi_remapMainAddress()
- 3.1.13 Fapi_setActiveFlashBank()
- 3.2 Asynchronous Functions
- 3.3 Program Functions
- 3.4 Read Functions
- 3.5 Informational Functions
- 3.6 Utility Functions
- 3.7 User Definable Functions
- 3.1 Flash State Machine Functions
- 4 API Macros
- 5 Recommended FSM Flows
- Appendix A Flash State Machine Commands
- Appendix B Typedefs and Enumerations
- B.1 Type Definitions
- B.2 Enumerations
- B.2.1 Fapi_CpuSelectorType
- B.2.2 Fapi_CpuType
- B.2.3 Fapi_FamilyType
- B.2.4 Fapi_AddressMemoryType
- B.2.5 Fapi_FlashProgrammingCommandsType
- B.2.6 Fapi_FlashBankType
- B.2.7 Fapi_FlashBankTechType
- B.2.8 Fapi_FlashSectorType
- B.2.9 Fapi_FlashStateCommandsType
- B.2.10 Fapi_FlashReadMarginModeType
- B.2.11 Fapi_StatusType
- B.2.12 Fapi_ApiProductionStatusType
- Appendix C Flash Validation Procedure
- Appendix D Parallel Signature Analysis (PSA) algorithm
- Appendix E Revision History
3.13 - SPNZ210
3.15 - SPNZ210s
Flash API
Errata
Literature Number: SPNZ210
July 2013
Contents
1
All Errata Listed With Software Version Numbers ................................................................... 4
2
Revision History ................................................................................................................. 5
3
Known Design Exceptions to Function Specifications ............................................................. 5
2
Table of Contents
SPNZ210 – July 2013
Submit Documentation Feedback
Copyright © 2013, Texas Instruments Incorporated
www.ti.com
List of Tables
1
Overview .....................................................................................................................
4
2
Revision History .............................................................................................................
5
3
Known Design Exceptions to Function Specifications .................................................................
5
SPNZ210 – July 2013
List of Tables
3
Submit Documentation Feedback
Copyright © 2013, Texas Instruments Incorporated
Errata
SPNZ210 – July 2013
Hercules™ F021 Flash API
This document describes the known exceptions to the functional specifications for the software.
1
All Errata Listed With Software Version Numbers
Table 1. Overview
Advisory ID
v01.50.00
v01.51.00
v02.00.00
v02.00.01
SDOCM00086402
X
-
-
-
SDOCM00086405
X
-
NA
NA
SDOCM00094147
X
X
-
-
SDOCM00102084
NA
NA
X
-
SDOCM00102399
-
-
X
-
LEGEND: X = Advisory applies to this version, NA = Not Applicable to this version of the library, - = Advisory does not affect this
version
4
Hercules™ F021 Flash API
SPNZ210 – July 2013
Submit Documentation Feedback
Copyright © 2013, Texas Instruments Incorporated
www.ti.com
Revision History
2
Revision History
This software errata revision history highlights the technical changes made from the previous to the
current revision.
Table 2. Revision History
Advisory Changes in Advisory List
Advisory ID
SDOCM00086402, SDOCM00086405, SDOCM00094147, SDOCM00102084,
Added advisory(s)
SDOCM00102399
Removed advisory(s)
None
Modified advisory(s)
None
Other
None
3
Known Design Exceptions to Function Specifications
Table 3. Known Design Exceptions to Function Specifications
Title ......................................................................................................................................
Page
SDOCM00086402 — Fapi_doMarginRead() does not read all requested data ..................................................
6
SDOCM00086405 — Fapi_UserDefinedFunctions.c needs FSM unlock/lock sequence for FSM_SECTOR/1/2 writes ....
7
SDOCM00094147 — Incorrect read in Verify functions in ECC regions on LE devices ........................................
8
SDOCM00102084 — Typo in CGT.CCS.H in GNU attribute check................................................................
9
SDOCM00102399 — FEDACSDIS and FEDACSDIS2 are missing from Fapi_FmcRegistersType definition..............
10
SPNZ210 – July 2013
Hercules™ F021 Flash API
5
Submit Documentation Feedback
Copyright © 2013, Texas Instruments Incorporated
SDOCM00086402 — Fapi_doMarginRead() does not read all requested data
www.ti.com
SDOCM00086402
Fapi_doMarginRead() does not read all requested data
Severity
S2 - Major
Expected Behavior
To read all data for the given range.
Issue
The function Fapi_doMarginRead() only returns 3/4 of the data requested on ECC
regions.
Conditions
Using this function on ECC region will exhibit this behavior.
Implications
Wrong data or invalid reads may occur.
Workaround(s)
None
6
Hercules™ F021 Flash API
SPNZ210 – July 2013
Submit Documentation Feedback
Copyright © 2013, Texas Instruments Incorporated
www.ti.com
SDOCM00086405 — Fapi_UserDefinedFunctions.c needs FSM unlock/lock sequence for FSM_SECTOR/1/2
writes
SDOCM00086405
Fapi_UserDefinedFunctions.c needs FSM unlock/lock sequence for
FSM_SECTOR/1/2 writes
Severity
S3 - Minor
Expected Behavior
Set sectors enabled for programming and erasing.
Issue
The example versions of the user defined functions Fapi_setupEepromSectorEnable()
and Fapi_setupBankSectorEnable() does not show unlock the registers
FSM_SECTOR/1/2.
Conditions
When trying to do an erase a bank after it has already been erased once after power on
reset.
Implications
The bank will not erase.
Workaround(s)
As this is intended for the customer to modify, the unlock code can be added by them.
Fapi_GlobalInit.m_poFlashControlRegisters-
>FsmWrEna.FSM_WR_ENA_BITS.WR_ENA
= 0x5U;
/* Unlock the regtisters */
Fapi_GlobalInit.m_poFlashControlRegisters-
>FsmWrEna.FSM_WR_ENA_BITS.WR_ENA
= 0x2U; /* Lock the registers */
SPNZ210 – July 2013
Hercules™ F021 Flash API
7
Submit Documentation Feedback
Copyright © 2013, Texas Instruments Incorporated
SDOCM00094147 — Incorrect read in Verify functions in ECC regions on LE devices
www.ti.com
SDOCM00094147
Incorrect read in Verify functions in ECC regions on LE devices
Severity
S2 - Major
Expected Behavior
Verification will work on ECC regions on Little Endian devices.
Issue
The read functions, Fapi_doVerify(), Fapi_doPsaVerify(), and Fapi_calculatePsa() will fail
on Little Endian devices in the ECC regions do to a byte swap issue.
Conditions
When trying to use the functions Fapi_doVerify(), Fapi_doPsaVerify(), and
Fapi_calculatePsa() on ECC regions on Little Endian devices.
Implications
This will cause false failures for Fapi_doVerify() and Fapi_doPsaVerify() and cause
incorrect return value for Fapi_calculatePsa() on ECC regions on Little Endian devices.
Workaround(s)
For the function Fapi_doVerify(), use the byte variant Fapi_doVerifyByByte().
For the functions Fapi_doPsaVerify() and Fapi_calculatePsa(), none.
8
Hercules™ F021 Flash API
SPNZ210 – July 2013
Submit Documentation Feedback
Copyright © 2013, Texas Instruments Incorporated
www.ti.com
SDOCM00102084 — Typo in CGT.CCS.H in GNU attribute check
SDOCM00102084
Typo in CGT.CCS.H in GNU attribute check
Severity
S3 - Minor
Expected Behavior
if --gcc option is enabled, ATTRIBUTE_PACKED will be defined.
Issue
In this code segment in CGT.CCS.h, __TI_GNU_ATTRIBUTE_SUPPORT__ is missing
the R:
#if defined(__TI_GNU_ATTIBUTE_SUPPORT__)
/* --gcc option enabled so we can specify this */
#define ATTRIBUTE_PACKED
__attribute__((packed))
#else
Conditions
On CCS compilers, ATTRIBUTE_PACKED will always be an empty definition.
Implications
On builds expecting --gcc option to use attributes defined in code, enums will not be
packed if the compile option to pack enums is not explicitly set.
Workaround(s)
Add the R to __TI_GNU_ATTIBUTE_SUPPORT__.
SPNZ210 – July 2013
Hercules™ F021 Flash API
9
Submit Documentation Feedback
Copyright © 2013, Texas Instruments Incorporated
SDOCM00102399 — FEDACSDIS and FEDACSDIS2 are missing from Fapi_FmcRegistersType definition
www.ti.com
SDOCM00102399
FEDACSDIS and FEDACSDIS2 are missing from Fapi_FmcRegistersType definition
Severity
S3 - Minor
Expected Behavior
It is expected theat Fapi_FmcRegistersType contains all registers defined in the devices
TRM and SPNA148/
Issue
In the register update for v2.00.00, these registers were unintentionally removed.
Conditions
The registers do not exist in the Fapi_FmcRegistersType.
Implications
User cannot reference the FEDACSDIS and FEDACSDIS2 registers through the API
reference.
Workaround(s)
Directly address the registers.
10
Hercules™ F021 Flash API
SPNZ210 – July 2013
Submit Documentation Feedback
Copyright © 2013, Texas Instruments Incorporated
IMPORTANT NOTICE
Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, enhancements, improvements and other
changes to its semiconductor products and services per JESD46, latest issue, and to discontinue any product or service per JESD48, latest
issue. Buyers should obtain the latest relevant information before placing orders and should verify that such information is current and
complete. All semiconductor products (also referred to herein as “components”) are sold subject to TI’s terms and conditions of sale
supplied at the time of order acknowledgment.
TI warrants performance of its components to the specifications applicable at the time of sale, in accordance with the warranty in TI’s terms
and conditions of sale of semiconductor products. Testing and other quality control techniques are used to the extent TI deems necessary
to support this warranty. Except where mandated by applicable law, testing of all parameters of each component is not necessarily
performed.
TI assumes no liability for applications assistance or the design of Buyers’ products. Buyers are responsible for their products and
applications using TI components. To minimize the risks associated with Buyers’ products and applications, Buyers should provide
adequate design and operating safeguards.
TI does not warrant or represent that any license, either express or implied, is granted under any patent right, copyright, mask work right, or
other intellectual property right relating to any combination, machine, or process in which TI components or services are used. Information
published by TI regarding third-party products or services does not constitute a license to use such products or services or a warranty or
endorsement thereof. Use of such information may require a license from a third party under the patents or other intellectual property of the
third party, or a license from TI under the patents or other intellectual property of TI.
Reproduction of significant portions of TI information in TI data books or data sheets is permissible only if reproduction is without alteration
and is accompanied by all associated warranties, conditions, limitations, and notices. TI is not responsible or liable for such altered
documentation. Information of third parties may be subject to additional restrictions.
Resale of TI components or services with statements different from or beyond the parameters stated by TI for that component or service
voids all express and any implied warranties for the associated TI component or service and is an unfair and deceptive business practice.
TI is not responsible or liable for any such statements.
Buyer acknowledges and agrees that it is solely responsible for compliance with all legal, regulatory and safety-related requirements
concerning its products, and any use of TI components in its applications, notwithstanding any applications-related information or support
that may be provided by TI. Buyer represents and agrees that it has all the necessary expertise to create and implement safeguards which
anticipate dangerous consequences of failures, monitor failures and their consequences, lessen the likelihood of failures that might cause
harm and take appropriate remedial actions. Buyer will fully indemnify TI and its representatives against any damages arising out of the use
of any TI components in safety-critical applications.
In some cases, TI components may be promoted specifically to facilitate safety-related applications. With such components, TI’s goal is to
help enable customers to design and create their own end-product solutions that meet applicable functional safety standards and
requirements. Nonetheless, such components are subject to these terms.
No TI components are authorized for use in FDA Class III (or similar life-critical medical equipment) unless authorized officers of the parties
have executed a special agreement specifically governing such use.
Only those TI components which TI has specifically designated as military grade or “enhanced plastic” are designed and intended for use in
military/aerospace applications or environments. Buyer acknowledges and agrees that any military or aerospace use of TI components
which have not been so designated is solely at the Buyer's risk, and that Buyer is solely responsible for compliance with all legal and
regulatory requirements in connection with such use.
TI has specifically designated certain components as meeting ISO/TS16949 requirements, mainly for automotive use. In any case of use of
non-designated products, TI will not be responsible for any failure to meet ISO/TS16949.
Products
Applications
Audio
www.ti.com/audio
Automotive and Transportation
www.ti.com/automotive
Amplifiers
amplifier.ti.com
Communications and Telecom
www.ti.com/communications
Data Converters
dataconverter.ti.com
Computers and Peripherals
www.ti.com/computers
DLP® Products
www.dlp.com
Consumer Electronics
www.ti.com/consumer-apps
DSP
dsp.ti.com
Energy and Lighting
www.ti.com/energy
Clocks and Timers
www.ti.com/clocks
Industrial
www.ti.com/industrial
Interface
interface.ti.com
Medical
www.ti.com/medical
Logic
logic.ti.com
Security
www.ti.com/security
Power Mgmt
power.ti.com
Space, Avionics and Defense
www.ti.com/space-avionics-defense
Microcontrollers
microcontroller.ti.com
Video and Imaging
www.ti.com/video
RFID
www.ti-rfid.com
OMAP Applications Processors
www.ti.com/omap
TI E2E Community
e2e.ti.com
Wireless Connectivity
www.ti.com/wirelessconnectivity
Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265
Copyright © 2013, Texas Instruments Incorporated