Content originally posted in LPCWare by celephicus on Mon May 21 20:17:07 MST 2012
Quote: frame
Actually, yes.
The problem with Flash is, you can erase only blockwise, i.e. one page.
Erasing sets all bits to 1, thus empty pages contain 0xFF Once you 'programmed' one bit/byte to 0, you can't change it without erasing the whole page.
But you can change all bits down to zeros at any time.
There is a further wrinkle: writes (setting a bit from '1' to '0') should only be done [B]once[/B] per 16 byte page, due to the error correction hardware associated with the Flash. Multiple writes per page may give errors on read. This is gone into in the (somewhat misleadingly titled) Flash Programming Hardware chapter of the LPC111x User Manual.
Full marks to NXP for allowing access to the IAP routines.