How to verify a Flash word in the erased state?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to verify a Flash word in the erased state?

1,249 次查看
xiaokangkp
Contributor III

I am writting the driver about D-flash of mc9s12xep100, when i refered to the datasheet, it said : "A Flash word must be in the erased state before being programmed.", BUT How to  verify a D-Flash word in the erased state?

unsigned char DFlash_Erase_check(word ADDR16, unsigned char N_words)
{
while(FSTAT_CCIF==0);
if(FSTAT_ACCERR) 
FSTAT_ACCERR=1;
if(FSTAT_FPVIOL) 
FSTAT_FPVIOL=1;

FCCOBIX_CCOBIX=0x00;
FCCOB = 0x1010;  
FCCOBIX_CCOBIX=0x01;
FCCOB = ADDR16; 
FCCOBIX_CCOBIX=0x10;
FCCOB = N_words; 

FSTAT_CCIF=1; 
while(FSTAT_CCIF==0); 

if(FSTAT_ACCERR == 1)
return 1;  //Error
else
return 0;  //OK
}

标记 (2)
2 回复数

1,117 次查看
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello,

Please refer to the attached example code.

There is DFLASH_Erase_Verify function. 
I have noticed you write FCCOBIX_CCOBIX=0x10, but you can write only to [2:0] bits .

Best regards,

Diana

1,117 次查看
xiaokangkp
Contributor III

Is there some flags can be checked for it?

0 项奖励
回复