'EEPROM' persistence issue

This issue turned out to be very troublesome for me and some customers already using some devices, so I have put some time into reproducing and dumping the contents like you asked.

I can reproduce when using a 2x AA battery power pack. It has an on-off switch, but in the off position it leaks. In the on position it delivers 5.05V and enough current, in the off position, it delivers 2.6V and very little current. The problem almost instantly occurs when powering it in the on position, wait for the application to start running and connect to wifi. After that I switch to the off position. The led slowly fades, and blinks red a few times and then dies. If that doesn’t work the first time, it will happen by playing around with the switch, connecting and disconnecting… it will break eventually.

After that it still boots and runs “normally”, but the eeprom is empty (I can tell by the behaviour of the device).
Also, when this happens, the device will not be recognised by the computer anymore, it does not show in OSX “System Information”. Neither in application mode or dfu mode. Leaving it sit without power for a minute or so fixes the USB in DFU mode, but it will not always be recognised in application mode. Only after re-flashing everything is back to normal.

It seems like it was very easy to reproduce with 0.4.6, and slightly harder with 0.4.7, but that could be coincidence.

@mdma: I have made a few memory dumps, how do I get them to you?

Addition 1: When trying to view what was the remainder of the EEPROM memory, it looks the EEPROM does not get wiped, but rather corrupted. Some values clearly had parts of the original value. e.g an ip address that that should be “192.168.0.254” turned into|“0.68.0.254”.

Addition 2: searching the community for brown-out seems to get some related results. Especially the ones were keys got lost or corrupted… (I don’t use the cloud and/or keys, so cannot tell wether it is related in my case).