Skip to content

Implement interface to: system_rtc_mem_write #133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
linagee opened this issue Apr 27, 2015 · 7 comments
Closed

Implement interface to: system_rtc_mem_write #133

linagee opened this issue Apr 27, 2015 · 7 comments

Comments

@linagee
Copy link
Contributor

linagee commented Apr 27, 2015

I propose making a "ESP.rtcMemWrite" that would pass things to "system_rtc_mem_write". Unless your program can start at any point and continue there (a routine like: wake, get temp, send to internet, deepsleep, repeat), you need to write data to the RTC before deep sleep or else you have no way of knowing what you were doing when the processor resets (wakes) after deep sleep.

Write data into RTC, see if the data exists when you boot back up (will also need: ESP.rtcMemRead/system_rtc_mem_read), then continue from there.

The first parameter, des_addr, needs to be between 64 and 128. (Block index, blocks are 4 bytes long, only bytes 256 to 512 are usable by the user.) I propose encapsulating all of this into something easy to use. (Maybe just pass in a byte/number from 0 to 256 and translate that into a "RTC storage slot" or something.)

Maybe... even have just 256 bytes passed into ESP.deepSleep (as a third parameter pointer?), and provide some other function to access them after the restart. Maybe that's messy though, not sure.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@linagee
Copy link
Contributor Author

linagee commented Apr 29, 2015

I had a few long thoughts about this. Maybe you could just use EEPROM to store your state instead.... Just about the only difference would be - one state lasts past a power outage, the other would not.

@Imroy
Copy link
Contributor

Imroy commented May 18, 2015

Has anyone done anything on this yet?

@linagee
Copy link
Contributor Author

linagee commented May 18, 2015

Imroy: Is there a specific application where using the EEPROM would not work? (I guess using RTC would use fewer EEPROM cycles, but that's about the most convincing argument I can think of to spend time on that.)

@Imroy
Copy link
Contributor

Imroy commented May 20, 2015

I figure if it's available it should be supported. Let programmers decide which one they want to use.

@hairyhenderson
Copy link

👍 - I'd like to use the RTC memory for short-term storage of data while the system is in deep sleep. In my application I'm using EEPROM for storing other stuff long-term and I'd rather not use it.

@ardyesp
Copy link

ardyesp commented Jul 16, 2015

Another upvote for RTC RAM read write feature.

@MacroYau
Copy link
Contributor

MacroYau commented Apr 1, 2016

I have attempted to add RTC user memory access in PR #1836. Please feel free to comment on the API implementation.

@igrr igrr modified the milestones: 2.2.0, 2.3.0 Apr 18, 2016
@igrr igrr closed this as completed Jun 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants