12 in-application programming (iap), 13 iap authorization key, 14 flash write enable – NXP Semiconductors P89LPC9321 UM10310 User Manual

Page 122

Advertising
background image

UM10310

All information provided in this document is subject to legal disclaimers.

© NXP B.V. 2010. All rights reserved.

User manual

Rev. 2 — 1 November 2010

122 of 139

NXP Semiconductors

UM10310

P89LPC9321 User manual

18.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

Table 110

.

18.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.

18.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, UCFG2, BOOTVEC, and BOOTSTAT). This protection does not apply to
ICP or parallel programmer modes. If the Activate Write Enable (AWE) bit in BOOTSTAT.7

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: 02000007FFFFF9

08

Reset MCU

: 00xxxx08cc

Where: xxxx = required field but value is a ‘don’t care’; cc = checksum

Example: 00000008F8

Table 108. In-system Programming (ISP) hex record formats

…continued

Record type

Command/data function

Advertising