SPRADE8 November 2023 TMS320F28P650DH , TMS320F28P650DK , TMS320F28P650SH , TMS320F28P650SK , TMS320F28P659DH-Q1 , TMS320F28P659DK-Q1 , TMS320F28P659SH-Q1
The EEPROM_Erase() function provides functionality for erasing the inactive sector(s) used for emulation. At least one entire sector must be erased as partial erase is not supported. Before erasing, you must ensure that stored data is no longer needed/valid. In the Ping Pong implementation, this function is only called when all EEPROM banks and pages in one EEPROM unit are used and data is successfully written to the other EEPROM unit. The function begins by re-calculating the Write/Erase Protection masks for the inactive (full) EEPROM unit, and then calls the Erase_Bank function.
// Re-Configure Write/Erase Protection Masks used by the Flash API
uint64 WE_Protection_AB_Mask =
Configure_Protection_Masks(FIRST_AND_LAST_SECTOR[EEPROM_ACTIVE_UNIT ^ 1], NUM_EEPROM_SECTORS);
// Assign individual protection masks accordingly
WE_Protection_A_Mask = 0xFFFFFFFF ^ (uint32)WE_Protection_AB_Mask;
WE_Protection_B_Mask = 0x00000FFF ^ WE_Protection_AB_Mask >> 32;
Erase_Bank();