UM10208_2
© NXP B.V. 2007. All rights reserved.
User manual
Rev. 02 — 1 June 2007
33 of 362
NXP Semiconductors
UM10208
Chapter 5: LPC2800 Flash
4.4 Presetting data latches
The Flash memory has data latches to store the data that is to be programmed into the
Flash array. When only a part of a Flash page (512 bytes) has to be programmed, the data
latches for the rest of the page must be preset to logical ones. This can be done with a
single control by setting and clearing the FC_SET_DATA bit in the F_CTRL register.
It is possible to read back the data latches by setting bit FD_RD_LATCH in the F_CTRL
register.
4.5 Writing and loading
Writing a Word to the Flash controller is done via the AHB. Every write takes 2 clock
cycles (1 wait state), and results in a partial update of the data input of the Flash module.
Writing is done one word at a time. Byte or halfword writing is not possible. However,
because writing logical ones leaves the Flash contents unchanged, it is possible to do
byte writing by encapsulating this byte in a Word of logical ones. This encapsulation must
be done by the AHB master that initiates the transfer.
Every fourth write, a Flash Word (four data words) is loaded automatically into the data
latches of the Flash module. Loading is done per Flash Word.
For example, when addresses 0x00 through 0x0C are to be loaded, loading is done
automatically after writing to address 0x0C (note that these four addresses form a single
complete Flash Word). This requires that values are already written to addresses 0x00 to
0x08.
Loading can also be done manually by writing a 1 to the FC_LOADREQ bit in the F_CTRL
register.
4.6 Programming
First, a sector to be erased must be unprotected as previously described. Programming is
the data transfer from the data latches of the Flash module into the Flash array. Before
programming, the programming time must be written to the FPT_TIME field of the
F_PROG_TIME register, and the timer must be enabled via the FPT_ENABLE bit in the
F_PROG_TIME register. During programming, the timer register counts down to zero.
Therefore, the timer register must be rewritten before every programming cycle.
The programmed programming time must satisfy the requirement:
(512
×
FP 2)
×
(AHB clock time)
≥
1ms
Which is to say, write FPT_TIME with the integer greater than or equal to:
((1,000,000 / AHB tcyc (in ns)) - 2) / 512
Programming is started by writing a trigger value to the F_CTRL register. The trigger value
for programming has the following bits set: FC_PROG_REQ, FC_PROTECT, FC_FUNC,
and FC_CS. The other bits are zero.
The page address that is offered to the Flash module during programming is the page
address of the most recent write to an address within the Flash memory range.