|
|
|
|
Preventing Data Corruption During Power Failures |
|
Download
the entire Applications Note in PDF
format.
Introduction
Solution The voltage sensor is used to monitor the unregulated DC in the system and the VLOW output is connected to an interrupt on the microcontroller. A resistor divider is used on the VSENSE input to set the desired level of unregulated DC which will correspond to the 1.25 Volt input level. The block diagram of this system implementation is shown in figure 1. The serial interface to the 4K bit E2PROM is an I2C interface utilizing the standard SCL and SDA interface connections to the microcontroller I/O ports.
Figure 1:
Typical 8051/S4242 Implementation
The S4242s VCC sensor monitors the condition of the VCC supply and will generate a RESET to the microcontroller whenever VCC is below a selected voltage, 4.35 volts for example, which will prevent the microcontroller from getting "confused" during a power down situation and generating write operations to the E2PROM. The voltage sensor on the VCC input is also used to disable write operations to the E2PROM whenever VCC is below the selected voltage. In order to guard against the loss of power during an E2PROM write cycle, the MCU must determine if the unregulated DC is still in spec, which can be sensed by the status of the VLOW signal. The interrupt service routine for this sets a flag to tell the MCU that power is failing in the system. The subroutine which performs a write to the E2PROM will always check the status of this flag prior to the initiation of a write cycle. Care must be taken to design the output stage of the regulator to insure that the fall time of the system VCC from the normal operation range to the trip point of the S4242 VCC sensor is longer than 10 ms after the power failure level of the unregulated DC is reached. This will insure that any write cycles which are initiated while the unregulated DC is within tolerance will be completed before the system enters the reset state. The maximum write cycle time for the Summit E2PROMs is 10 ms, although the typical value is closer to 5 ms. Therefore, the power down routine must add in the write operation interface period and any other routines which will be executed between the querying of the power status flag and the stop bit of the write instruction to the serial E2PROM. Figure 2 shows the timing diagram for this implementation. Another benefit of this implementation is that the VLOW interrupt can actually be used to warn the micro of impending power failure. At this time, the micro can perform important housekeeping functions including the updating of system parameters in the S4242s E2PROM data storage so that when power returns to the system, the system will know the status when the power failure occurred.
Copyright©1999-2003 by Summit Microelectronics, Inc. |