Power Failure Tolerance

AsYouWishEngineer
Posts: 5
Joined: Thu Aug 23, 2018 5:42 am

Power Failure Tolerance

Postby AsYouWishEngineer » Fri Aug 24, 2018 5:34 am

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!

ESP_Sprite
Posts: 9727
Joined: Thu Nov 26, 2015 4:08 am

Re: Power Failure Tolerance

Postby ESP_Sprite » Sat Aug 25, 2018 2:31 am

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.

ruffle
Posts: 8
Joined: Tue Jul 31, 2018 6:46 am

Re: Power Failure Tolerance

Postby ruffle » Wed Aug 29, 2018 4:14 pm

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?

ESP_Sprite
Posts: 9727
Joined: Thu Nov 26, 2015 4:08 am

Re: Power Failure Tolerance

Postby ESP_Sprite » Fri Aug 31, 2018 2:39 am

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.

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: Power Failure Tolerance

Postby ESP_igrr » 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).

Mr_Red
Posts: 23
Joined: Mon Sep 11, 2017 12:41 pm

Re: Power Failure Tolerance

Postby Mr_Red » Fri Dec 07, 2018 2:47 pm

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).

Who is online

Users browsing this forum: aygh4266 and 158 guests