This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

28377D flash api 连仿真器能运行,不连仿真器擦除flash出错

Other Parts Discussed in Thread: CONTROLSUITE

打算在28377D上 用flash api向flash中写入数据,擦除flash不成功。程序下载到flash中,FLASH api库复制到RAM中运行。仿真时能正常擦除和写入,断开仿真单独上电时擦除失败。

cmd文件中flash api对应部分:

Flash28_API: {
-lF021_API_F2837xD_FPU32.lib(.text)
-lF021_API_F2837xD_FPU32.lib(.ebss)
} LOAD = FLASHA,
RUN = RAMGS14,
LOAD_START(_Flash28_API_LoadStart),
LOAD_END(_Flash28_API_LoadEnd),
RUN_START(_Flash28_API_RunStart),
LOAD_SIZE(_Flash28_API_LoadSize),
PAGE = 0

程序开始时把flash api 库复制到RAMGS14中:

memcpy(&Flash28_API_RunStart, &Flash28_API_LoadStart,(uint32_t)&Flash28_API_LoadSize);

flash api初始化的相关代码:

EALLOW;
FlashPumpSemaphoreRegs.PUMPREQUEST.all=0x5a5a0002;
Flash0EccRegs.ECC_ENABLE.bit.ENABLE = 0x0;
oReturnCheck=Fapi_initializeAPI(F021_CPU0_BASE_ADDRESS,200);
EDIS;

用Fapi_issueAsyncCommandWithAddress函数擦除一个sector,然后用Fapi_doBlankCheck检查是不是已经擦除

在连接仿真器调试的时候,能够擦除成功。但是断开仿真器,重新上电后,擦除失败。