ESP32 is there a way to keep RTC-RAM Data over a restart / reboot caused by a crash?

Hi everyone,

I have a pretty big sketch that has intermitand crashes after several hours.
If a crash has occured the ESP32 keeps on rebooting. So storing values into flash will quickly wear-out the flash-memory (I had 33000 reboots over night)
For narrowing down the problem I would like store data into the RTC-RAM

I did some tests but the data in RTC-RAM gets lost over a ESP.restart() or a resetbutton reboot.
So is there a way to avoid erasing the RTC-RAM during a reset?

Of course I can connect some FRAM to my ESP32 which has billions of writecycles
or I can add a second serial interface that sends data whch will be recorded in a logfile
but I would like to avoid this.

best regards Stefan

You are trying to fix the wrong problem.

Your best course of action would be to find the cause of the crash and eliminate it

Are there any clues as to the cause of the problem ?

that’s just what I want to do “find the cause of the crash and eliminate it” by storing different numbers on different places of my code and to look at what number is stored after reboot.
No no clues yet. I don’t use String program runs for hours than suddenly a crash
best regards Stefan

Can you attach an SD card to the project to which you can write literally Gigabytes of debug data for analysis

What is a crash? WDT’s? Guru’s? Screen shots of the error? Code to troubleshoot?

What’s the readout from the Exception Decoder?

Crash is just really vague.

Perhaps you could see Read this before posting a programming question … to better help us help you.

to add information: This is a ESP32-nodeMCU-Board build into a box where it requires to dismount the box to get access to the USB-socket. I’m using elegantOTA for updating the program.
This has worked very good so far. And this is the reason why I haven’t added the serial-output from the ESP32 right at bootstart.

For “normal” debugoutput I use webserial and UDP-messages. But right after booting they aren’t yet available.

So I guess I will indeed dismout everything connecting an USB-wire to be able to see what the serial output is right on boot.

best regards Stefan

Assuming “overnight” means 10 hrs or so

10 hrs * (3600 seconds / hr) = 36 000 seconds

33 000 reboots after 36 000 seconds means yours is rebooting every second or so. I would not consider that “intermittent”

running 12 hours quickly rebooting starts,
next round running 5 hours quickly rebooting starts,
running 12 hours … in how long the time is the program is running normally and then starts hanging in a quick-reboot-loop,
there seems to be no pattern.

best regards Stefan

Honestly, could you provide more info then ‘there seems to be no pattern’?

Code in code tags?

error/debug printouts?

Exception Decoder results?

So far the information provided to troubleshoot your issue is as good as throwing dried chicken bones to figure out why the code does not work.

1 Like