Event on Reset. Write to EEPROM

Hello everyone,

I am doing a test at the moment, where I simulate Bit-Flips in EEPROM and create a LogFile where I have several Events. One of these Events should inform and write to EEPROM, when a Reset/Power loss happens. So is it possible to write to EEPROM when the system detects Reset/Shut down?

Thank you,
Noob

The problem you have is that unless you initiate the reset in software, and therefore know it's going to happen, then the very fact that it's a reset, means that your code isn't running at that point. You can easily detect a restart as that's when your code will start running again.

The same problem exists for a shutdown. If you initiate the shutdown, then you know it's going to happen, and can log it.

If you wanted to log when power is lost, for example, then you would need a way to maintain power locally when the external power is lost. Just long enough to log the event. I think the IT server world calls this an orderly shutdown.

One way to solve this is via pseudo non-volatile storage. Just write the data as often as you want and if there is an unexpected shutdown, it will contain the last tidbit of information you saved.

I'm a fan of these EERAM devices. It only requires a single capacitor, and only writes to the real EEPROM when it detects a shutdown. There are no limits to how many write cycles as long as there is power to the device. It would take close to 100K shutdowns before it will degrade the underlying non-volatile storage. And they are cheap

https://www.mouser.com/datasheet/2/268/47L64_Data_Sheet_DS20006168B-1901722.pdf

You could also use a Real Time Clock (RTC) with built-in power fail timestamp functionality such as the Microchip MCP79510. It can automatically log the time that power was lost (hour, minute, day of month & month) as well as logging when power was restored (same 4 parameters).

As an aside, if you are trying to flag a reset or shutdown, then can you not look at it from the point of view that you've just powered up, either from a reset or power being applied?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.