下载

© Mo
AN2204//D
Rev. 1, 2/2002
Fast NVM Programming for
the MC9S12DP256
Application Note
by Stuart Robb
Strategic Marketing & Systems (Europe),
Transportation and Standard Products Group
Introduction
In some applications, it may be necessary to program a number of bytes of data
in non-volatile memory (NVM) at short notice and with the programming to be
completed within a minimum time. In an automotive application for example, an
application may be notified of a vehicle crash event and the application may be
required to immediately save diagnostic data. The crash event may cause the
electronic control unit (ECU) power supply to be disrupted either accidentally
by mechanical damage to the wiring harness, or by design, by controlled
switching of the 12V supply. In these cases, the ECU remains powered only by
charge stored in capacitors contained within the ECU. The supply to the
microcontroller (MCU) may remain above a minimum operating value for only
a few milliseconds after the crash event is detected, and this will constitute the
time available to save diagnostic data.
This application note presents two software routines written in the C
programming language which will program a number of bytes of data to non-
volatile memory on the MC9S12DP256 MCU in the minimum time required.
One routine writes data to EEPROM and the other routine writes data to Flash
memory. 32 bytes of data are typically programmed into EEPROM in under
700
µs and into Flash memory in under 400µs.
MC9S12DP265
The MC9S12DP256 microcontroller unit is a high performance 16-bit CISC
device composed of standard on-chip peripherals including a 16-bit central
processing unit (CPU), 256k bytes of Flash memory, 12k bytes of RAM and 4k
bytes of EEPROM. The MC9S12DP256 operates from 5V with an internal bus
frequency of up to 25MHz. All internal memory can be accessed in a single bus
cycle.
Freescale Semiconductor, I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
nc
.
..