How to verify a Flash word in the erased state?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to verify a Flash word in the erased state?

1,246 Views
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
}

Tags (2)
2 Replies

1,114 Views
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,114 Views
xiaokangkp
Contributor III

Is there some flags can be checked for it?

0 Kudos
Reply