AnsweredAssumed Answered

K22 FLASH, Question about (re) writing to a longword

Question asked by Chris Keeser on Apr 20, 2017
Latest reply on Apr 21, 2017 by Mark Butcher

I am attempting to write an easier-to-work-with flash utility and I want to be as efficient as possible when an erase needs to occur (due to how long it takes).  I am curious about the following situations:

 

Situation: The flash sector is previously erased, and a single byte was written into a longword.  The other 3 bytes are still erased, and the longword looks like this:  (erased) 0xFF 0xFF 0xFF 0xFF -> (programmed) 0x01 0xFF 0xFF 0xFF


Q1.) If I wanted to program the second byte to 0x02, resulting in 0x01 0x02 0xFF 0xFF, can I program the longword with 0x01 0x02 0xFF 0xFF, or do I have to erase the entire sector to write that single new byte into an already erased byte?


Q2.) If reprogramming the 0x01 in the first byte will overstress the device (which I have seen warnings that say writing a '0' multiple times will overstress the FLASH) then, can I be cheeky and attempt to program 0xFF 0x02 0xFF 0xFF into the already programmed long word?  The first byte would be "programmed" to 0xFF (which means that no zeros would be re-programmed), or will this result in some sort of fault (either during programming, or attempting to read the flash)?

 

Thanks, and Looking forward to hearing the answers!

Outcomes