AnsweredAssumed Answered

Erasing sector 0 clears whole flash block?

Question asked by lineage on May 10, 2013
Latest reply on May 1, 2014 by lineage

I'm seeing some odd behavior on a Kinetis (K60) when erasing sector 0 in the program flash. Erasing sector 0 with a debugger, seems to erase (or invalidate) the rest of my flash. I ran the following sequence with a debugger

 

put content into sector 0, 1, 2, 3

reset

check content - all OK

erase sector 3, reset, check OK

erase sector 1, reset, check OK

 

So now there is data in sector 0 and 2. I can read it back OK.

 

Erase sector 0. reset. flash a vectortable etc into sector 0. reset.

 

Now sector 0 has content and is readable, but sector 2 (and any other sector that had data) now reads as 0xff.

I'm pretty sure I'm not doing anything to request a mass erase.

The debugger reports the same sector erase time for sector zero as for other sectors, and confirms it thinks it only erased sector 0.

 

There is nothing explicitely programmed into the security bytes, so they are effectively all 0xff.

 

Is this a side effect of the flash security? Is the flash controller doing a background erase or just invalidating the data?

Is there somewhere that its documented (I can't see anything relevant in AN4507)  and is it posible to stop it happening?

 

Thanks

Outcomes