Page 1 of 1

ESP32-C6 how to make data survive reset?

Posted: Thu Oct 17, 2024 7:09 pm
by quintesse
Hi, I'm developing some code where I want to track the number of times the system was booted, both when woken up from deep sleep as well as when the user presses the reset button.

I can get the first part to work (wakeup from deep sleep) if I mark the boot counter was RTC_DATA_ATTR but that won't survive a reset.

So according to the docs (https://docs.espressif.com/projects/esp ... types.html) there is an __NOINIT_ATTR option and there's also the RTC_NOINIT_ATTR option. But they don't seem to do anything.

So my question is: is there a way to do this?

Re: ESP32-C6 how to make data survive reset?

Posted: Fri Oct 18, 2024 2:29 am
by ESP_Sprite
A reset in the sense of a negative pulse on the EN pin (which is usually what a 'reset' button e.g. on a devkit does) is indiscernable from a power-on, so you can't distinguish them. To keep track of the number of resets (either through power on or reset button) you could store them in NVS.