← index #18176PR #5419
Off-topic · high · value 2.727
QUERY · ISSUE

docs: machine.RTC.memory examples not working

openby julien123123opened 2025-09-30updated 2026-03-16
docs

Documentation URL

https://docs.micropython.org/en/latest/library/machine.RTC.html#machine.RTC.memory

Description

Here is what the docs say about machine.RTC.memory:

RTC.memory(data) will write data to the RTC memory, where data is any object which supports the buffer protocol (including bytes, bytearray, memoryview and array.array). RTC.memory() reads RTC memory and returns a bytes object.

Having used that function several times on both the esp32-c3 and esp32-s2 (i believe the s3 too, but I'm not sure), I can tell you that following the examples to the letter will raise the following error : TypeError: function missing 1 required positional arguments. The missing argument is self, so the 2 ways I found to call the method is either machine.RTC.memory(machine.RTC(), b'data') or machine.RTC().memory(b'data'). I feel like the documentation should reflect that if the memory method is working as it should.

Code of Conduct

Yes, I agree

CANDIDATE · PULL REQUEST

[ESP8266] [Documentation] Add note that machine.RTC is not fully sup…

closedby oceanitesopened 2019-12-14updated 2019-12-17
docsport-esp8266

For the ESP8266 port, some methods of machine.RTC are not supported.

Add a note in the ESP8266 documentation, that RTC.now(), RTC.init(), RTC.deinit() and RTC.irq() with a handler keyword is currently not supported.

Supported are only RTC.ALARM0, RTC.alarm(), RTC.alarm_left(), RTC.datetime(), RTC.irq() and RTC.memory():

>>> from machine import rtc
>>> rtc = RTC()
>>> dir(rtc)
['__class__', 'ALARM0', 'alarm', 'alarm_left', 'datetime', 'irq', 'memory']

This is mentioned in #3220, #3710 and in #2701.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied