Other Parts Discussed in Thread: C2000WARE
FLASH编程正常,擦除总是报错,每次擦除会进入非法中断:Interrupt_illegalOperationHandler,然后就卡死了。
核心代码如下:
const Uint32 flashSectorStart[14] =
{
0x080000, 0x082000, 0x084000, 0x086000,
0x088000, 0x090000, 0x098000, 0x0A0000, 0x0A8000, 0x0B0000,
0x0B8000, 0x0BA000, 0x0BC000, 0x0BE000
};
const Uint32 flashSectorSize[14] =
{
0x2000, 0x2000, 0x2000, 0x2000,
0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
0x2000, 0x2000, 0x2000, 0x2000,
};
// sector = a-n
#pragma CODE_SECTION(eraseFlashSector,".TI.ramfunc");
Uint32 eraseFlashSector(Uint16 sector)
{
Uint32 addr = 0;
Fapi_StatusType oReturnCheck;
Fapi_FlashStatusType oFlashStatus;
if(sector < 'a' || sector > 'n')
{
return 0;
}
addr = flashSectorStart[sector - 'a'];
#if 1
DINT;
EALLOW;
oReturnCheck = Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector, (uint32*)addr);
while (Fapi_checkFsmForReady() != Fapi_Status_FsmReady){}
if(oReturnCheck != Fapi_Status_Success)
{
printx("oReturnCheck = 0x__\r\n", oReturnCheck);
}
oFlashStatus = Fapi_getFsmStatus();
if(oFlashStatus != 0)
{
printx("oFlashStatus = 0x__\r\n", oFlashStatus);
}
EDIS;
EINT;
#endif
return addr;
}
PLL输出120M,使用内部INTOSC2和外部16M晶振都试过,现象一样。
cmd文件中通过-lF021_API_F2837xD_FPU32.lib(.text)将F021库放入SRAM,并且通过map文件检查,相关代码都在SRAM中。
F021库版本为1.54,F28075和F2837x使用相同的F021固件库没错吧?是否有需要特别注意的地方?