UM10147_2
© NXP B.V. 2008. All rights reserved.
User manual
Rev. 02 — 28 April 2008
117 of 134
NXP Semiconductors
UM10147
P89LPC952/954 User manual
17.12 In-application programming (IAP)
Several In-Application Programming (IAP) calls are available for use by an application
program to permit selective erasing and programming of Flash sectors, pages, security
bits, configuration bytes, and device id. All calls are made through a common interface,
PGM_MTP. The programming functions are selected by setting up the microcontroller’s
registers before making a call to PGM_MTP at FF03H. The IAP calls are shown in
17.13 IAP authorization key
IAP functions which write or erase code memory require an authorization key be set by
the calling routine prior to performing the IAP function call. This authorization key is set by
writing 96H to RAM location FFH. The following example was written using the Keil C
compiler. The methods used to access a specific physical address in memory may vary
with other compilers.
#include <ABSACC.H> /* enable absolute memory access */
#define key DBYTE[0xFF] /* force key to be at address 0xFF */
short (*pgm_mtp) (void) = 0xFF00; /* set pointer to IAP entry point */;
key = 0x96; /* set the authorization key */
pgm_mtp (); /* execute the IAP function call */
After the function call is processed by the IAP routine, the authorization key will be
cleared. Thus it is necessary for the authorization key to be set prior to EACH call to
PGM_MTP that requires a key. If an IAP routine that requires an authorization key is
called without a valid authorization key present, the MCU will perform a reset.
17.14 Flash write enable
This device has hardware write enable protection. This protection applies to both ISP and
IAP modes and applies to both the user code memory space and the user configuration
bytes (UCFG1, BOOTVEC, and BOOTSTAT). This protection does not apply to ICP or
parallel programmer modes. If the Activate Write Enable (AWE) bit in BOOTSTAT.7 is a
logic 0, an internal Write Enable (WE) flag is forced set and writes to the flash memory
and configuration bytes are enabled. If the Active Write Enable (AWE) bit is a logic 1, then
the state of the internal WE flag can be controlled by the user.
06
Read Global CRC: 00xxxx06cc
Where: xxxx = required field but value is a ‘don’t care’; cc= checksum
Example: 00000006FA
07
Direct Load of Baud Rate: 02xxxx07HHLLcc
Where: xxxx = required field but value is a ‘don’t care’; HH= high byte of timer;
LL = low byte of timer; cc = checksum
Example: 02000007FFFFcc
08
Reset MCU: 00xxxx08cc
Where: xxxx = required field but value is a ‘don’t care’; cc = checksum
Example: 00000008F8
Table 102. In-system Programming (ISP) hex record formats
…continued
Record type
Command/data function