SPRADE8 November 2023 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 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
{
EEPROM_Erase();
RESET_BANK_POINTER;
}