UM10310_1
© NXP B.V. 2008. All rights reserved.
User manual
Rev. 01 — 1 December 2008
115 of 139
NXP Semiconductors
UM10310
P89LPC9321 User manual
•
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.
An assembly language routine to load the page register and perform an erase/program
operation is shown below.
;**************************************************
;*
pgm user code
*
;**************************************************
;*
*
;* Inputs:
*
;* R3 = number of bytes to program (byte)
*
;* R4 = page address MSB(byte)
*
;* R5 = page address LSB(byte)
*
;* R7 = pointer to data buffer in RAM(byte)
*
;* Outputs:
*
;* R7 = status (byte)
*
Table 105. 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 106. 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.
3
HVA
R
High voltage abort. Set if either an interrupt or BOD FLASH is detected during a program or
erase cycle.
FMCMD.3
W
Command byte bit 3.
4:7
-
R
reserved.
4
FMCMD.4
W
Command byte bit 4.
5
FMCMD.5
W
Command byte bit 5.
6
FMCMD.6
W
Command byte bit 6.
7
FMCMD.7
W
Command byte bit 7.