Miguel Silva

flash erase verify

Discussion created by Miguel Silva on Aug 22, 2011
Latest reply on Aug 23, 2011 by Miguel Silva

Hello,

 

I'm trying to use the flash command erase verify, but it doesn't seem to work (always returns 0). I'm following the flowchart in the datasheet. The device is mc9s08qe128, and I'm using codewarrior 10.1. Here is my code:

 

byte flashEraseVerify(const byte * flash_block){ if(FCDIV_FDIVLD) {  while(!FSTAT_FCBEF)   ;  if(FSTAT_FACCERR | FSTAT_FPVIOL)   FSTAT = FSTAT & 0x30;  *((byte*)flash_block) = 0xA; // dummy write  FCMD = 0x05; // erase verify command  FSTAT_FCBEF = 1;  while(!FSTAT_FCCF)   ;  return FSTAT_FBLANK; } return 0;}

 Using debug I've checked that FDIVLD is set and that the page isn't erased. I'm not sure if I can write the flash block address like this 

*((byte*)flash_destination) = 0xA; // dummy write

 I'm assuming that this function doesn't need to be executed from ram because it only needs to read from flash.

 

Thanks

Outcomes