AN2302 Freescale Semiconductor / Motorola, AN2302 Datasheet - Page 2

no-image

AN2302

Manufacturer Part Number
AN2302
Description
EEPROM Emulation for the MC9S12C32
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
AN2302/D
Implementation
2
EEPROM Emulation software features:
There are two common methods used to store non-volatile data in Flash. One
method is to keep a copy of all non-volatile data variables in a buffer in RAM.
The data is "saved" to Flash as often as is considered necessary by
programming the entire buffer contents to a pre-erased Flash sector. This
method is relatively simple to implement, permits the data variables to be read
at all times and allows control of the number of program/erase cycles. The
major disadvantage is that a large amount of RAM is required, as both the data
buffer and the programming routine must be located in RAM. There is also a
risk of losing data if a reset should occur after updating the RAM buffer but
before the data is re-programmed into Flash.
An alternative method is used by the software described in this paper. This
method eliminates the RAM buffer and instead requires that a minimum of two
512 byte Flash sectors are allocated to non-volatile data storage. In this
method, all the non-volatile data variables are located in one or other of the
Flash sectors. Whenever one non-volatile data variable is to be updated, the
"new" Flash sector is erased and then all the unchanged data variables plus the
new data are programmed into the "new" Flash sector. A complete set of the
most recent data values always exists in Flash. The RAM requirements are
greatly reduced as there is no RAM buffer. The main disadvantage of this
method is that the non-volatile data variables cannot be read whilst they are
being updated.
A further potential disadvantage, namely that updating a data variable causes
the whole Flash block to be written, can be overcome without using excessive
amounts of RAM. In order to minimise the number of Flash program/erase
cycles, copies of the most frequently updated non-volatile data variables
should be permanently located in RAM. The frequently changing copies in
RAM can then be used to update the non-volatile data variable on a less
frequent basis, prior to a power-down cycle for example.
Freescale Semiconductor, Inc.
For More Information On This Product,
User configured emulated EEPROM size
Non-volatile data variables stored in Flash
ReadEeprom and WriteEeprom functions to access variables
Low RAM requirements - 35 bytes minimum (plus stack)
Low Flash requirements - 1024 bytes minimum for emulated EEPROM,
691 bytes minimum for code
User defined callback function during program/erase
Interrupt servicing during program/erase is possible
EEPROM Emulation for the MC9S12C32
Go to: www.freescale.com
MOTOROLA

Related parts for AN2302