RTC RAM size...

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
jedie
Posts: 252
Joined: Fri Jan 29, 2016 12:32 pm
Contact:

RTC RAM size...

Post by jedie » Sat Dec 14, 2019 11:44 pm

I wanted to check the size of the RTC RAM, and hacked this:

Code: Select all

import machine

rtc = machine.RTC()
i = 1
while True:
    try:
        rtc.memory(b'X' * i)
    except Exception as e:
        print('Error:', e)
        print(len(rtc.memory()), 'Bytes')
        print(rtc.memory())
        break
    else:
        i += 1
Output on one of my ESP8266 boards:

Code: Select all

Error: buffer too long
492 Bytes
b'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
Do all ESP8266 boards have the same size?

shaoziyang
Posts: 363
Joined: Sun Apr 17, 2016 1:55 pm

Re: RTC RAM size...

Post by shaoziyang » Mon Dec 16, 2019 1:41 am

In ESP32, rtc.memory() size is 2048.

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: RTC RAM size...

Post by jimmo » Mon Dec 16, 2019 3:44 am

Yes, this is true of the ESP8266, the board doesn't change this.

You can read the MicroPython implementation at ports/esp8266/machine_rtc.c In particular look at the MEM_ constants near the top.

There are 256 bytes of system data (64 blocks), and 512 bytes of user data (128 blocks). The first section of the user data is used by calibration data (delta=2, cal=1, magic=1 blocks) and then the length of the stored Python data (1 block). So that leaves 512-(2+1+1+1)*4 = 492 bytes.

Post Reply