Writing Flash LPC1114

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Writing Flash LPC1114

504 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by celephicus on Sun May 20 21:31:01 MST 2012
Greetings.

I am investigating the IAP commands to write Flash. They only write a complete Flash page (256 bytes), so I need to allocate a 256 byte buffer in RAM, copy the Flash contents to it, write my data to the buffer, and then call IAP to write the buffer to Flash. Is there any way to write just a few bytes?
0 Kudos
3 Replies

318 Views
lpcware
NXP Employee
NXP Employee
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.
0 Kudos

318 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by frame on Mon May 21 03:09:56 MST 2012
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.

If that's not sufficient for you, get a part with internal EEPROM (this is byte-wise erasable), or use an external EEPROM.




Quote: Zero
No :mad:

IAP AN: http://www.nxp.com/documents/application_note/AN10995.zip

0 Kudos

318 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Mon May 21 00:24:13 MST 2012

Quote: celephicus
Flash. Is there any way to write just a few bytes?



No :mad:

IAP AN: http://www.nxp.com/documents/application_note/AN10995.zip
0 Kudos