herunterladen

AN499/D
Order this document
as AN499/D
Let the MC68HC705 program itself
By Åke Webjörn,
Freescale AB, Sweden
1 Introduction
There are several popular MCUs (Micro-Computer-Units) from Freescale on the market, which have their program
memory stored in a built-in EPROM (Erasable-Programmable-Read-Only-Memory) or OTP (One-Time-
Programmable) memory instead of the usual ROM (Read-Only-Memory). The difference between the EPROM
and OTP part, is that there is a window in the package on the EPROM version which makes it possible to erase
it under an UV-lamp for re-use. On the plastic OTP part, this window is missing, thus the EPROM array cannot be
erased. OTPs are normally packaged in plastic which ensures a low cost high volume product.
EPROM memory cells require more mask layers in fabrication of the device, and testing of the EPROM cell is time
consuming, which helps drive the cost higher than a normal ROM part. On delivery of the EPROM/OTP product
another cost is the programming of the user program before the product is used. But it also means that the
EPROM/OTP MCU becomes a more flexible product, allowing customer changes and requests to be met easily
and enabling the product to be brought to market in a very short time. Some of the more popular types on the
market are MC68HC711E9, MC68HC711D3, MC68HC705C8, MC68HC705P9 and MC68HC705J2.
The programming of the EPROM inside this kind of MCU is normally achieved with a built-in program that has
been written and supplied by Freescale. This program is stored in a special area of ROM inside the MCU. The MCU
starts to execute this built-in program under special circumstances, e.g., when the voltage on one or several pins
at reset is above a certain level. This special mode of operation is called the bootloader mode. In this mode the
MCU assumes that special programming hardware is connected to it. The bootloader then reads data from an
external EPROM connected to the parallel I/O ports, or data from a serial port. Then it starts the programming by
writing the data into the internal EPROM. It also controls the special programming voltage and keeps track of the
time the cell inside the EPROM is programmed. In that way it provides a simple and efficient way for the customer
to program the MCUs. Once completed, the MCU is inserted into its end application, and the user code in the
EPROM is executed.
Sometimes it would be nice to be able to custom-program part or all of the built-in EPROM of the MCU, and to
do so in the normal user mode rather than in the special bootstrap mode. The reason could be to be able to modify,
add features or even remove parts of the standard program. Examples are adding program routines, storing serial
numbers, calibration values, code keys, information on what external equipment is attached, removing test
programs, etc.
1.1 Three examples of when this technique could be used
A traditional electronic door lock uses an MCU that compares the keys pushed, with a set of switches that
determine the door opening code. If instead, the switches are stored in EPROM inside the MCU, then there is no
way a burglar could open doors by simply breaking the lock cabinet, reading the switches and pushing the keys.
A second example is a small combustion engine. This needs a carefully adjusted air/gas mixture to minimise
pollution. It is possible to write the program so that the MCU finds out the status of the engine and adapts to it.
But this process may take a minute before the engine can give any output power; pollution will be quite large
during this time. So it would be beneficial if the engine controller could memorise the last set-up values.
In a third example, a manufacturer wants to keep set-up/calibration routines for a system secret. With an EPROM-
based MCU, it is simple to have a routine that, after the factory calibration or burn-in phase, simply removes the
code by writing over the original set-up/calibration program with dummy code.
Freescale Semiconductor, I
nc
.
..
Freescale Semiconductor
© Freescale Semiconductor, Inc., 2004. All rights reserved.