ZHCADD5B November   2023  – August 2025 F28377D-SEP , F29H850TU , F29H859TU-Q1 , TMS320F28P650DH , TMS320F28P650DK , TMS320F28P650SH , TMS320F28P650SK , TMS320F28P659DH-Q1 , TMS320F28P659DK-Q1 , TMS320F28P659SH-Q1

 

  1.   1
  2.   摘要
  3.   商标
  4. 简介
  5. EEPROM 与片上闪存的区别
  6. 概述
    1. 3.1 基本概念
    2. 3.2 单存储单元方法
    3. 3.3 乒乓方法
    4. 3.4 创建 EEPROM 节(页)和页标识
  7. 软件说明
  8. 乒乓仿真
    1. 5.1 用户配置
      1. 5.1.1 EEPROM_PingPong_Config.h
      2. 5.1.2 F28P65x_EEPROM_PingPong.c
    2. 5.2 测试示例
  9. EEPROM 函数
    1. 6.1  EEPROM_Config_Check
    2. 6.2  Configure_Protection_Masks
    3. 6.3  EEPROM_Write
    4. 6.4  EEPROM_Read
    5. 6.5  EEPROM_Erase
      1. 6.5.1 Erase_Bank
    6. 6.6  EEPROM_GetValidBank
    7. 6.7  EEPROM_UpdateBankStatus
    8. 6.8  EEPROM_UpdatePageStatus
    9. 6.9  EEPROM_UpdatePageData
    10. 6.10 EEPROM_Get_64_Bit_Data_Address
    11. 6.11 EEPROM_Program_64_Bits
    12. 6.12 EEPROM_CheckStatus
    13. 6.13 ClearFSMStatus
  10. 单存储单元仿真
    1. 7.1 用户配置
      1. 7.1.1 EEPROM_Config.h
      2. 7.1.2 F28P65x_EEPROM.c
    2. 7.2 EEPROM 函数
      1. 7.2.1  EEPROM_Config_Check
      2. 7.2.2  Configure_Protection_Masks
      3. 7.2.3  EEPROM_Write
      4. 7.2.4  EEPROM_Read
      5. 7.2.5  EEPROM_Erase
      6. 7.2.6  EEPROM_GetValidBank
      7. 7.2.7  EEPROM_Get_64_Bit_Data_Address
      8. 7.2.8  EEPROM_UpdateBankStatus
      9. 7.2.9  EEPROM_UpdatePageStatus
      10. 7.2.10 EEPROM_UpdatePageData
      11. 7.2.11 EEPROM_Get_64_Bit_Data_Address
      12. 7.2.12 EEPROM_Program_64_Bits
      13. 7.2.13 EEPROM_CheckStatus
      14. 7.2.14 ClearFSMStatus
    3. 7.3 测试示例
  11. 应用集成
    1. 8.1 软件功能和流程
  12. 适配其他第 3 代 C2000 MCU
  13. 10闪存 API
    1. 10.1 闪存 API 检查清单
      1. 10.1.1 使用闪存 API 时的注意事项
  14. 11源文件清单
  15. 12排查
    1. 12.1 通用
  16. 13结语
  17. 14参考资料
  18. 15修订历史记录

EEPROM_CheckStatus

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();
}