Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] Questions on LPC Flash Programming Routines

2005-04-08 by Robert Adsett

At 03:56 PM 4/8/05 +1000, Bruce Paterson wrote:
>....and one more question after further study....
>
>5/ I notice you copy from the flash into the temporary buffer if we're
>not 512byte aligned, or for the final fragment of size < 512.
>You also say:
>   *  NOTE: When programming data into a sector that is already partially
>   *  programmed, all new data MUST be programmed into previously
>   *  unprogrammed 16-byte (128-bit) [Ed: Assume 512-byte now] blocks.
>The statement implies you cannot write a block unless the flash has been
>previously erased => all 0's or FF's. So why bother copying these (dst)
>back into the temporary buffer prior to copying the partial (src) over
>the top ?

Semantics I believe.  Cannot in this case means not that the flash won't 
get written, but that the value that results from the write won't match the 
actual value written unless it is an exact match for what was already in 
the flash.  In addition to the corruption due to previously high bit being 
programmed low the internal EDC code will be wrong for that 16 byte block 
now.  Basically once a 16 byte block has been modified no further 
successful changes can be made to it, any modifications will result in 
corrupted memory.

Oh, BTW, erasing flash results in all high bits (0xFF).

>May as well dispense with the temporary buffer and just back the (src)
>pointer back into whatever crap is in RAM there and write that into the
>512-aligned-dst (similar with the far end).
>
>Seems to me the only way to achieve what I think you're trying to do is
>to make a whole segment copy prior to erase, and then write overwrite
>that huge (8k or more) buffer with (src), then program that. Have I got
>misunderstood something here ?

You can (must?) program a 512byte chunk at once, but you must take care to 
preserve anything already written.  This is no different than any other 
flash memory.  They only differ in the details of what may be written and 
in what size of chunk.  Many allow any high bit to be programmed low, the 
LPC error correction circuitry treats 16byte block as a single location 
that must be dealt with as a unit and only programmed from all 1's once 
between erases.  Erase, on the other hand, uses larger chunk sizes.  8K I 
think is the smallest.

I hope that clears things up a bit.

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,   be 
they legal, genetic, or physical.  If you don't believe me, try to chew a 
radio signal. "  -- Kelvin Throop, III
http://www.aeolusdevelopment.com/

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.