SPRADE8A November 2023 – April 2024 F29H850TU , F29H859TU-Q1 , TMS320F28P650DH , TMS320F28P650DK , TMS320F28P650SH , TMS320F28P650SK , TMS320F28P659DH-Q1 , TMS320F28P659DK-Q1 , TMS320F28P659SH-Q1
The EEPROM_Get_64_Bit_Data_Address() provides functionality for determining if the EEPROM unit is full and assigning the proper address if required. If a full EEPROM unit is detected, EEPROM is erased using the EEPROM_Erase() function and the address is reset to the beginning of the first Flash Sector.
First, the end address of EEPROM is set according to the device being used and the configuration. The END_OF_SECTOR directive is set in the EEPROM_Config.h file.
End_Address = (uint16 *)END_OF_SECTOR; // Set End_Address for sector
Next, the EEPROM bank pointer is compared to the end address. If writing four 16-bit words beginning at the current EEPROM bank pointer would go beyond the End Address, this indicates the sector is full. At this point, the EEPROM unit is erased, performs a blank check and the EEPROM Bank Pointer is reset to the beginning of the EEPROM Unit.
if(Bank_Pointer > End_Address-3) // Test if EEPROM is full
{
Erase_Inactive_Unit = 1;
Erase_Blank_Check = 1;
EEPROM_Erase();
Erase_Inactive_Unit = 0;
RESET_BANK_POINTER;
}