Forums

IAP clarification

Started by embeddedjanitor August 16, 2004
Hi

I have read http://groups.yahoo.com/group/lpc2000/message/2999 but
still have a few questions...

1) Do I need to erase the flash before programming it?

2) Does the "prepare for write" command just unlock the flash or does
it erase the flash too?

3) If I wish to program using partial pages (let's say 64 bytes at a
time), is the following the way to do it?

prepare for write
erase block
prepare for write
write first partial page
prepare for write
write second partial page
......
Where the partial page programming means writing 512 bytes all 0xFF
except for the bytes I intend writing (as per msg 2999).

Thanx

-- CHarles




An Engineer's Guide to the LPC2100 Series

> 1) Do I need to erase the flash before programming it?

In most cases, yes. It is best to erase the flash area u want before
writing new a new program to it. Note that u can successfully write
data to flash without an erase but there's a limit to the number of
writes u can use in between erases.

> 2) Does the "prepare for write" command just unlock the flash or
does it erase the flash too?

Prepare only unlocks the flash

> 3) If I wish to program using partial pages (let's say 64 bytes at
> a time), is the following the way to do it?
>
> prepare for write
> erase block
> prepare for write
> write first partial page
> prepare for write
> write second partial page
> ......
> Where the partial page programming means writing 512 bytes all
0xFF
> except for the bytes I intend writing (as per msg 2999).

The minimum page size allowable during reads/writes is 512 bytes,
and goes up to 8192 bytes.
U can only erase 1 sector at a time, and each sector is usually 8192
bytes (16 pages).

Revise the IAP routines in the chapter "Flash Memory System &
Programming" of your lpc Usr manual for more details.

Leighton