SPRUJB8 April 2024
Sets up the flash state machine registers for the 512-bit (32 16-bit words) programming with user provided flash data and ECC data and issues the programing command to valid Flash and OTP memory.
Fapi_StatusType Fapi_issueDataAndEcc512ProgrammingCommand(
uint32 *pu32StartAddress,
uint16 *pu16DataBuffer,
uint16 u16DataBufferSizeInWords,
uint16 *pu16EccBuffer,
uint16 u16EccBufferSizeInBytes
)
pu32StartAddress [in] | 512-bit aligned flash address to program the provided data and ECC. |
pu16DataBuffer [in] | Pointer to the Data buffer address. Address of the Data buffer should be 512-bit aligned. |
u16DataBufferSizeInWords [in] | Number of 16-bit words in the Data buffer. Max Databuffer size in words should not exceed 32. |
pu16EccBuffer [in] | Pointer to the ECC buffer address |
u16EccBufferSizeInBytes [in] | Number of 8-bit bytes in the ECC buffer. Max Eccbuffer size in words should not exceed 8 |
This function programs both the user provided 512-bit data (second parameter) and 8 bytes of ECC data (fourth parameter) together at the user provided 512-bit aligned flash address. The address of data provided must be aligned on a 512-bit memory boundary and the length of data must correlate to the supplied ECC. That means, if the data buffer length is 32 16-bit words, the ECC buffer must be 8 bytes (1 ECC bytes corresponding to 64-bit data).
Each byte of pu16EccBuffer corresponds to each 64-bit of the main array data provided in the pu16DataBuffer. Refer Table 3-6 for more details.
The Fapi_calculateEcc() function can be used to calculate ECC for a given 64-bit aligned address and the corresponding data.
Refer below Table 3-4 for allowed programming range for the function.
Flash API | Main Array | DCSM OTP | ECC | Link Pointer |
---|---|---|---|---|
Fapi_issueDataAndEcc512ProgrammingCommand() | Allowed | Allowed | Allowed | Not allowed |
As described above, this function can program only a max of 512-bits (given the address provided is 512-bit aligned) at a time. If the user wants to program more than that, this function should be called in a loop to program 512-bits at a time.
The Main Array flash programming must be aligned to 512-bit address boundaries and 32 16-bit word may only be programmed once per write or erase cycle.
512-bit address range starting with link pointer address shall always be programmed using 128-bit Fapi_issueProgrammingCommand().
Fapi_Status_Success (success)
Fapi_Status_FsmBusy (FSM busy)
Fapi_Error_AsyncIncorrectDataBufferLength (failure: Data buffer size specified is incorrect. Also, this error will be returned if Fapi_EccOnly mode is selected when programming the Bank0 DCSM OTP space)
Fapi_Error_AsyncIncorrectEccBufferLength (failure: ECC buffer size specified is incorrect)
Fapi_Error_AsyncDataEccBufferLengthMismatch (failure: Data buffer size either is not 64-bit aligned or data length crosses the 128-bit aligned memory boundary)
Fapi_Error_FlashRegsNotWritable (failure: Flash register writes failed. The user should make sure that the API is executing from the same zone as that of the target address for flash operation OR the user should unlock before the flash operation.
Fapi_Error_FeatureNotAvailable (failure: User passed a mode that is not supported)
Fapi_Error_InvalidAddress (failure: User provided an invalid address. For the valid address range, see the TMS320F28P65x Microcontrollers Data Manual.)
(Please refer to the flash programming example provided in C2000Ware at “C2000Ware_.....\driverlib\F28P65x\examples\....\flash\flashapi_512bit_programming\flashapi_cpu1_512bitprogramming.c”)