ESP32-C6 how to make data survive reset?

quintesse
Posts: 1
Joined: Thu Oct 17, 2024 6:57 pm

ESP32-C6 how to make data survive reset?

Postby quintesse » Thu Oct 17, 2024 7:09 pm

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?

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

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

Postby ESP_Sprite » Fri Oct 18, 2024 2:29 am

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.

Who is online

Users browsing this forum: Google [Bot] and 79 guests