Can i store arbitrary data in RTC_DATA_ATTR for ESP32

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
udmicpy
Posts: 12
Joined: Tue Aug 15, 2017 3:47 pm

Can i store arbitrary data in RTC_DATA_ATTR for ESP32

Post by udmicpy » Sun Dec 23, 2018 7:02 pm

Hi all,

in a video from the guy with the swiss accent, I found an hint that it is possible to save data in the ESP32 which will not get lost when the ESP32 is going into deepsleep.

Is this already possible with micropython? If yes, some lines of code would be great.

Best regards, Uwe

loboris
Posts: 317
Joined: Fri Oct 02, 2015 6:19 pm

Re: Can i store arbitrary data in RTC_DATA_ATTR for ESP32

Post by loboris » Sun Dec 23, 2018 7:34 pm

This is supported in my Micropython port.
Up to 64 32-bit integers can be saved in RTC memory.

One string of up to 2048 characters can be saved in RTC memory.
The string can be, for example, json string containing the parameters which has to be restored after deep sleep wake-up.

Integers and string saved in RTC memory are protected by 16-bit CRC.
Wiki

User avatar
devnull
Posts: 344
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

Re: Can i store arbitrary data in RTC_DATA_ATTR for ESP32

Post by devnull » Mon Dec 24, 2018 9:10 am


udmicpy
Posts: 12
Joined: Tue Aug 15, 2017 3:47 pm

Re: Can i store arbitrary data in RTC_DATA_ATTR for ESP32

Post by udmicpy » Fri Feb 01, 2019 2:38 pm

Thanks for your answers.
I like the JSON solution.

Bye, Uwe

Post Reply