ssinfod

Flash programming (HCS08AW60)

Discussion created by ssinfod on Mar 28, 2008
Latest reply on Mar 30, 2008 by ssinfod
Hi,
 
I am currently testing a function which writes a byte in the flash memory of the MCU (HCS08AW60).
 
I would like to know if I have to erase the sector before programming the byte for a second time.
 
Example :
  unsigned char fdata = 0;
  unsigned int faddress = 0x870;
 
  fdata = flash_sector_erase(faddress); // Erase page
  delay(1000);
  
  fdata = flash_read(faddress);         // read operation (0xFF)
  delay(1000);
 
  //1st Write
  fdata = 'U';
  fdata = flash_write(faddress, fdata); // write operation
  delay(1000);
 
  // Read
  fdata = flash_read(faddress);         // read operation ( 'U')
  delay(1000);
 
  // 2nd Write
  fdata = 'A';
  fdata = flash_write(faddress, fdata); // write operation
  delay(1000);
 
  // Read
  fdata = flash_read(faddress);         // read operation ('A')
  delay(1000);
 
It seems I can write the byte at the same address (0x870) a second time without having to erase the sector. Is that true ? Do I have the erase the sector before programming any bytes ?
 
I also tried it without erasing the sector at all and it works.
 
Thanks
 
 
 

Outcomes