ZHCADD5A November 2023 – April 2024 TMS320F28P650DH , TMS320F28P650DK , TMS320F28P650SH , TMS320F28P650SK , TMS320F28P659DH-Q1 , TMS320F28P659DK-Q1 , TMS320F28P659SH-Q1
EEPROM_CheckStatus 函数提供检查闪存 API 状态以及在每次对闪存进行编程/擦除后检查闪存状态机状态的功能。在执行擦除操作之后,还需执行额外的检查以确认闪存为空白。如果检测到任何意外状态,程序会停止。该工程中未实现错误处理。
Fapi_FlashStatusType oFlashStatus;
Fapi_FlashStatusWordType oFlashStatusWord;
uint32_t sectorAddress = FLASH_BANK_SELECT + FIRST_AND_LAST_SECTOR[EEPROM_ACTIVE_UNIT^1][0] * FLASH_SECTOR_SIZE;
uint16_t sectorSize = (FIRST_AND_LAST_SECTOR[EEPROM_ACTIVE_UNIT^1][1] - FIRST_AND_LAST_SECTOR[EEPROM_ACTIVE_UNIT^1][0] + 1) * (FLASH_SECTOR_SIZE / 2);
// Wait until the Flash program operation is over
while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy);
if(*oReturnCheck != Fapi_Status_Success)
{
// Check Flash API documentation for possible errors
Sample_Error();
}
// Read FMSTAT register contents to know the status of FSM after
// program command to see if there are any program operation related
// errors
oFlashStatus = Fapi_getFsmStatus();
if (Erase_Inactive_Unit && Erase_Blank_Check){
*oReturnCheck = Fapi_doBlankCheck((uint32_t *) sectorAddress,
sectorSize, &oFlashStatusWord);
Erase_Blank_Check = 0;
}
if(*oReturnCheck != Fapi_Status_Success || oFlashStatus != 3)
{
//Check FMSTAT and debug accordingly
Sample_Error();
}