Can a power supply interruption cause EEPROM corruption?

On a super rare occasion I've seen my ATMega644p chip lost some EEPROM settings. Every time it seems that power was interrupted (by not completely inserted DC plug). Is it possible for EEPROM data be changed like that?

Only if you're writing to it at the time when the power goes.

i found both flash and ee can corrupt with bad power even if not writing. the mere presence of spm or eewr code anywhere in the chip is enough. to demonstrate rub vcc wires togther and watch flash and/or ee change even if those routines are never called anywhere in the program. bod fuse and big bypass caps helps but do not prevent.

Ib a Word Yes... From the ATMega328P data sheet:

If the user code contains instructions that write the EEPROM, some precautions
must be taken. In heavily filtered power supplies, VCC is likely to rise or fall slowly on power-up/down. This
causes the device for some period of time to run at a voltage lower than specified as minimum for the clock frequency
used. See ”Preventing EEPROM Corruption” on page 20 for details on how to avoid problems in these
situations.

An explanation, I would think

Doc

Thanks. I should've been clearer, I'm not writing to EEProm when issue occurs.

john1993:
i found both flash and ee can corrupt with bad power even if not writing. the mere presence of spm or eewr code anywhere in the chip is enough. to demonstrate rub vcc wires togther and watch flash and/or ee change even if those routines are never called anywhere in the program. bod fuse and big bypass caps helps but do not prevent.

Thanks for the info! I'll try to enable BOD fuse, maybe it will reduce chances of corruption...

Enable a good power supply and use early sensing of power fail to put the processor to sleep before the main supply fails and you should have no problem. A couple of 470 uF caps close to the processor and an early AC power fail signal to the controller. (an LDR and a neon light, Some opaque shrink tubing and you've a bullet proof opto isolator..) with good line isolation. The high breakdown voltage of the neon light and it's characteristics require about 220 - 330K for 240 VAC and 100K for 120 VAC. Years ago simple neon testers were very common and when I needed an AC operated line sensor that was my go-to part, that and some scotch electrical tape... and the LDR.

Doc