Page 1 of 1

Power Failure Tolerance

Posted: Fri Aug 24, 2018 5:34 am
by AsYouWishEngineer
Hello,

Will power failures cause any issues in the ESP32? I will be using it for an application where occasional total power failure may be an issue. I know that it is brownout tolerant with the BOD, but will occasional total power failures cause immediate or long-term problems? I could create a battery backup to do a graceful shutdown, but that is undesirable for my uses - I'd rather have the unit simply lose power and restart when power is restored.

Loss of working data is not a concern, as the firmware will be designed to mitigate this issue by writing critical info to flash when it changes (rare event, roughly once every two weeks over lifetime of device).

Thanks!

Re: Power Failure Tolerance

Posted: Sat Aug 25, 2018 2:31 am
by ESP_Sprite
Power failure problems normally happen because something that writes to flash is not designed with power fails in mind, so if your ESP32 is resistant to this depends on what you use to read from and write to flash. From the technologies ESP-IDF uses, I'm sure that NVS, OTA and SPIFFS can handle sudden shutdowns just fine. FAT may be able to do it as well, but I'm not entirely sure about that. So if you keep to these techniques, you should be fine.

Re: Power Failure Tolerance

Posted: Wed Aug 29, 2018 4:14 pm
by ruffle
From my, very limited, ESP32 experience; a FAT filesystem is not at all happy about sudden shutdowns and gets corrupted.

Anyone got a journaling filesystem handy?

Re: Power Failure Tolerance

Posted: Fri Aug 31, 2018 2:39 am
by ESP_Sprite
SPIFFS is (partially) journalling I think, and should be resistant to unexpected powerdowns. NVS is more-or-less implemented as a journalling filesystem as well.

Re: Power Failure Tolerance

Posted: Fri Aug 31, 2018 2:59 am
by ESP_igrr
Link to SPIFFS wiki which discusses handling of power loss: https://github.com/pellepl/spiffs/wiki/ ... owerlosses (TL;DR: you need to run SPIFFS_check after power loss, SPIFFS will not detect it automatically).

Re: Power Failure Tolerance

Posted: Fri Dec 07, 2018 2:47 pm
by Mr_Red
ESP_igrr wrote:
Fri Aug 31, 2018 2:59 am
Link to SPIFFS wiki which discusses handling of power loss: https://github.com/pellepl/spiffs/wiki/ ... owerlosses (TL;DR: you need to run SPIFFS_check after power loss, SPIFFS will not detect it automatically).
I'm using SPIFFS through the VFS, and there does not seem to have an easy way to call SPIFFS_check() since the spiffs object is private and there is no wrapper to expose it. Feel free to correct me if I'm wrong.

It would be nice if esp_spiffs_init() could handle it (maybe using an option like format_if_mount_failed).