Yahoo Groups archive

Lpc2000

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

Message

Re: Flash fails to write a bit or zeroes other bit

2004-05-25 by chazeltopman

--- In lpc2000@yahoogroups.com, "chazeltopman" <rob@n...> wrote:
> I've received an anonymous reply that addresses the
> flash writing limitations:
> 
> : The flash can not be used '32 bit word' wise.
> : You could try to write 16 bytes at once (4x 32 bit word),
> : but the number of partial writes per 512 bytes (the normal
> : size) is limited (I don't believe this number is specified).
> :
> : Note the '16 byte'data should be properly aligned on 16 byte
> : multiples (but again the number of 'partial write'is limited
> : .. let's say .. 16 times or so :-) ).

 After doing some more experimenting, I believe I have found the
 happy compromise.  If all the bytes in a 16 byte aligned sector are
 0xFFFFFFFF, then one or more of them can be changed, but only
 all at once.  This is done with the write to flash IAP command.
 Calling the flash IAP command multiple times with the same
 section, can be done without error (I tried it 1000s of times
 with zero errors).  Putting these two lemmata together gives
 me my flash management algorithm.

 As I write values to flash, I do so on 16 byte boundaries. So
 if I'm only writing 32-bits, I waste 12 bytes or 75%.  But this
 wastage can be reduced to 0% if I cache four 32 bit values and
 then write them out at the same time to an empty 16 byte
 section. This solves one problem and the dumb algorithm
 solves the other.  This worked on both the 8K and 64K sectors.

 Onward.

 Rob

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.