Yahoo Groups archive

Lpc2000

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

Message

Partial (Less than 512 bytes) Flash Programming

2004-07-07 by philips_apps

Many group members have experimented with the IAP calls to write less 
than 512 bytes of data. The follwing information and Q&A attempts to 
address relevant concerns.

Why 16 bytes
------------

To improve Reliability, the Flash module uses built-in single-bit 
Error Correction which is capable of correcting single-bit errors in 
128-bit quadwords. To do this, 8-bits of ECC are computed and stored 
in the Flash with every 128-bit quadword that is written. Yes, this 
means the actual physical size of the memory in a 128K part is 136K 
Bytes.

The memory is managed by a memory controller which has the following 
operational modes:

Read: The Memory returns 128-bits (4 32-bit words) per access. 

Erase: The memory is organized as 256 rows of 512 bytes each (256 * 
512 = 128K). From a Sector point of view, there are 16 sectors per 
Module with 8K bytes per sector = 128K. This also means that each 
Sector consists of 16 rows of 512 Bytes each (16 * 16 * 512 = 128K). 
Erasing is always done on a per Sector basis (multiple contiguous 
sectors can be erased). After Erase, all bits are Logical 1. Since a 
minimum of one sector can be erased, each erase operation erases at 
least 8K Bytes of Flash memory. Erase operations will erase the ECC 
bits as well.

Writing: Writing is done on a per-Row basis. The Flash Controller 
therefore writes 512 bytes. The ECC fields are also computed and 
written on a 128-bit quadword basis as part of the Row write. Note 
that if you write all 1's to a quadword then the ECC bits are also 
all 1s and hence can be over-written correctly (this is the only 
case).

Q1. Is it impossible to write data over and over again into the 
LPC2106's flash without erasing the sector, even if it's the same 
data?

A1. Since writing is done on a per Row basis, each write operation 
causes a write voltage to be applied to the entire Row. This means 
that every cell on that Row sees some electrical disturbance (whether 
it's over-written or not). Because the sum of these disturbances can 
cause charge loss, the number of writes are limited to 16 per Row. 
Cells whose contents do not change should have 1s written to them. 
This means every 4K-aligned area can only be written to a maximum of 
16 times before it must be erased.


Q2. Is the only way to handle the limitations in our case is to erase 
and re-write the whole sector each time we want to add a couple of 
bytes to it?

A2. You don't need to erase and re-write the whole sector but you 
must update a minimum of 128-bits at a time; any non-zero value will 
cause the ECC bits to be updated and subsequent writes (excluding all 
1s) will produce bit errors since the ECC value will not match the 
128-bit field. So you cannot do updates on a byte (or two byte) 
basis. The minimum size of an updae is 128-bits (quadword aligned) 
and the maximum is 256-bits (16 * 256 = 4k bits = 512 bytes). IAP 
function allows more than 512 bytes by software looping.

Philips Apps

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.