SPRADE8A November 2023 – April 2024 F29H850TU , F29H859TU-Q1 , TMS320F28P650DH , TMS320F28P650DK , TMS320F28P650SH , TMS320F28P650SK , TMS320F28P659DH-Q1 , TMS320F28P659DK-Q1 , TMS320F28P659SH-Q1
The EEPROM_Program_64_Bits() function provides functionality for programming four 16-bit words to memory. The first parameter, Num_Words, allows the user to specify how many valid words will be written. The data words should be assigned to the first 4 locations of the Write_Buffer to be used by the Fapi_issueProgrammingCommand function. If less than four words are specified in the function call, missing words will be filled with 0xFFFF. This is done to comply with ECC requirements.
First, a full EEPROM unit is tested for.
EEPROM_Get_64_Bit_Data_Address();
Next, the Write Buffer is filled with 1s if less than 4 words are specified.
int i;
for(i = Num_Words; i < 4; i++)
{
Write_Buffer[i] = 0xFFFF;
}
Next, data is programmed and the pointer is incremented to the next location to program data.
// Clears status of previous Flash operation
ClearFSMStatus();
Fapi_setupBankSectorEnable(FLASH_WRAPPER_PROGRAM_BASE+FLASH_O_CMDWEPROTA, WE_Protection_A_Mask);
Fapi_setupBankSectorEnable(FLASH_WRAPPER_PROGRAM_BASE+FLASH_O_CMDWEPROTB, WE_Protection_B_Mask);
oReturnCheck = Fapi_issueProgrammingCommand((uint32*) Bank_Pointer,
Write_Buffer, 4, 0, 0,
Fapi_AutoEccGeneration);
// Wait for completion and check for any programming errors
EEPROM_CheckStatus(&oReturnCheck);
// Increment to next location
Bank_Pointer += 4;
Once programming is complete, the Erase_Inactive_Unit flag is checked. If set, the inactive unit is erased, performs a blank check and the Write/Erase Protection masks are reconfigured.
if (Erase_Inactive_Unit) {
// Erase inactive unit
Erase_Blank_Check = 1;
EEPROM_Erase();
Erase_Inactive_Unit = 0;
uint64 WE_Protection_AB_Mask = Configure_Protection_Masks(
FIRST_AND_LAST_SECTOR[EEPROM_ACTIVE_UNIT],
NUM_EEPROM_SECTORS);
WE_Protection_A_Mask = 0xFFFFFFFF ^ (uint32)WE_Protection_AB_Mask;
WE_Protection_B_Mask = 0x00000FFF ^ WE_Protection_AB_Mask >> 32;
}