AN2302 Freescale Semiconductor / Motorola, AN2302 Datasheet - Page 6

no-image

AN2302

Manufacturer Part Number
AN2302
Description
EEPROM Emulation for the MC9S12C32
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
AN2302/D
Callback Function
Power Failure
Recovery
Memory Map
6
NOTE:
erasure of the Flash. The Flash area which is overlaid by RAM is no longer
available for use.
If the non-maskable interrupt is enabled (X-bit cleared), then it cannot
subsequently be disabled by software. In this case, the RAM must be re-
mapped to the top of the memory map, the vector table must be copied to RAM,
and the non-maskable interrupt service routine must be executed from RAM.
A less RAM intensive alternative to enabling interrupts is to enable a callback
function. The callback function is called repeatedly by the ProgFlash function
while the function is waiting for the program or erase operation to complete.
The callback function must be executed from RAM and can access RAM and
all I/O registers. The callback function is defined by the user to suit the
application, typical uses for the callback function are to poll some inputs or
interrupt flags or to refresh a COP watchdog.
One concern when programming data is the subsequent behaviour if a system
failure, such as power failure, occurs during programming. In the software
implementation accompanying this paper, one word of flash is reserved in each
bank for status information. This status word is the last word to be programmed
in each bank, and is only programmed if the whole of the rest of the bank has
programmed successfully. The value of the status word indicates the most
recently programmed bank. In the event of a power failure, or some other
interruption to programming, a bank may be incompletely programmed and the
status word will not be programmed. When power is restored and InitEeprom
is next called, the last successfully programmed bank will be identified and the
partially programmed bank will be ignored and subsequently erased. In this
way the only data that is lost is the new data value that was to be updated at
the time of the failure; this data variable retains its previous value.
Figure 1 illustrates the default memory map of the MC9S12C32 with a typical
allocation of resources for non-volatile data storage, where interrupts are not
required to be serviced during programming or erasure. Figure 2 illustrates an
alternative memory map for the MC9S12C32 with the RAM remapped to the
top of the memory map, to enable interrupts to be serviced during programming
or erasure.
Freescale Semiconductor, Inc.
For More Information On This Product,
EEPROM Emulation for the MC9S12C32
Go to: www.freescale.com
MOTOROLA

Related parts for AN2302