UM10147_2
© NXP B.V. 2008. All rights reserved.
User manual
Rev. 02 — 28 April 2008
109 of 134
NXP Semiconductors
UM10147
P89LPC952/954 User manual
OI flag (FMCON.0) after each erase-programming operation to see if the operation was
aborted. If the operation was aborted, the user’s code will need to repeat the process
starting with loading the page register.
The erase-program cycle takes 4 ms (2 ms for erase, 2 ms for programming) to complete,
regardless of the number of bytes that were loaded into the page register.
Erasing-programming of a single byte (or multiple bytes) in code memory is
accomplished using the following steps:
•
Write the LOAD command (00H) to FMCON. The LOAD command will clear all
locations in the page register and their corresponding update flags.
•
Write the address within the page register to FMADRL. Since the loading the page
register uses FMADRL[5:0], and since the erase-program command uses FMADRH
and FMADRL[7:6], the user can write the byte location within the page register
(FMADRL[5:0]) and the code memory page address (FMADRH and FMADRL[7:6]) at
this time.
•
Write the data to be programmed to FMDATA. This will increment FMADRL pointing to
the next byte in the page register.
•
Write the address of the next byte to be programmed to FMADRL, if desired. (Not
needed for contiguous bytes since FMADRL is auto-incremented). All bytes to be
programmed must be within the same page.
•
Write the data for the next byte to be programmed to FMDATA.
•
Repeat writing of FMADRL and/or FMDATA until all desired bytes have been loaded
into the page register.
•
Write the page address in user code memory to FMADRH and FMADRL[7:6], if not
previously included when writing the page register address to FMADRL[5:0].
•
Write the erase-program command (68H) to FMCON, starting the erase-program
cycle.
•
Read FMCON to check status. If aborted, repeat starting with the LOAD command.
Table 99.
Flash Memory Control register (FMCON - address E4h) bit allocation
Bit
7
6
5
4
3
2
1
0
Symbol (R)
-
-
-
-
HVA
HVE
SV
OI
Symbol (W) FMCMD.7
FMCMD.6
FMCMD.5
FMCMD.4
FMCMD.3
FMCMD.2
FMCMD.1
FMCMD.0
Reset
0
0
0
0
0
0
0
0
Table 100. Flash Memory Control register (FMCON - address E4h) bit description
Bit Symbol
Access
Description
0
OI
R
Operation interrupted. Set when cycle aborted due to an interrupt or reset.
FMCMD.0
W
Command byte bit 0.
1
SV
R
Security violation. Set when an attempt is made to program, erase, or CRC a secured sector or
page.
FMCMD.1
W
Command byte bit 1
2
HVE
R
High voltage error. Set when an error occurs in the high voltage generator.
FMCMD.2
W
Command byte bit 2.