AnsweredAssumed Answered

MC9s12G64 P-Flash trouble with reading and writing There has been an error erasing the 0x4000 address

Question asked by songxiang li on Sep 17, 2017
Latest reply on Sep 19, 2017 by lama

MC9s12G64 P-Flash trouble with reading and writing。There has been an error erasing the P-Flash 0x4000 address,

The code reads as follows:

void EEPROM_Erase(unsigned long ADDR18)
{
while(FSTAT_CCIF==0);
if(FSTAT_ACCERR) //判断并清除标志位;
FSTAT_ACCERR=1;
if(FSTAT_FPVIOL) //判断并清除标志位;
FSTAT_FPVIOL=1;

FCCOBIX_CCOBIX=0x00;
FCCOB = 0x0A00;             //  Erase P-Flash Sector
FCCOBIX_CCOBIX=0x01;
FCCOB = (unsigned int)ADDR18; //写入低16位的地址
FSTAT_CCIF=1; //启动执行命令
while(FSTAT_CCIF==0); //等待执行完成
}

Run to FSTAT_CCIF=1 , happen  ACCERR = 1  。。。

How to do?

Thank YOU!!!

Outcomes