SPRADE8A November 2023 – April 2024 F29H850TU , F29H859TU-Q1 , TMS320F28P650DH , TMS320F28P650DK , TMS320F28P650SH , TMS320F28P650SK , TMS320F28P659DH-Q1 , TMS320F28P659DK-Q1 , TMS320F28P659SH-Q1
The Erase_Bank function leverages the Flash API to erase the inactive (full) EEPROM Unit. This function is separate from EEPROM_Erase to minimize the CPU cycles required to erase both units in the EEPROM_Config function. It begins by configuring the Write/Erase Protection masks for the appropriate Flash Sectors and then calls Fapi_issueBankEraseCommand. Finally, it waits for completion and checks for any errors.
Fapi_StatusType oReturnCheck;
// Clears status of previous Flash operation
ClearFSMStatus();
// Enable program/erase protection for select sectors
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);
// Erase the inactive EEPROM Bank
oReturnCheck = Fapi_issueBankEraseCommand((uint32*) FLASH_BANK_SELECT);
// Wait for completion and check for any programming errors
EEPROM_CheckStatus(&oReturnCheck);
For comparison, the F28003x Ping Pong example project's EEPROM_Bank function issuesthe Flash API erase command and then waits for completion, checking for any programming errors that occur. Write/Erase protection masks are provided outside of the scope of the function.