Skip to content

ESP32 RTC Slow Memory Access Fails

DodaTech Updated 2026-06-26 1 min read

In this tutorial, you'll learn about ESP32 RTC Slow Memory Access Fails. We cover key concepts, practical examples, and best practices.

The Problem

ESP32 RTC slow memory read returns garbled data or crashes.

Quick Fix

Wrong

uint8_t* rtcMem = (uint8_t*)SOC_RTC_DRAM_LOW;
rtcMem[0] = 0xAA;  // Direct pointer access - risky
Data corrupted or system crash due to incorrect memory mapping.
RTC_DATA_ATTR uint8_t rtcBuffer[256];
RTC_DATA_ATTR int rtcCounter = 0;
void setup() {
  rtcCounter++;
  Serial.printf("RTC counter: %d\n", rtcCounter);
  Serial.printf("RTC buffer addr: %p\n", rtcBuffer);
  // Access works reliably and persists across deep sleep
}
RTC counter: 42
RTC buffer addr: 0x50000000
(Data persists across deep sleep)

Prevention

Use RTC_DATA_ATTR attribute for variables in RTC slow memory. Max 8KB available. Access via standard variable operations, not direct addressing. Data survives deep sleep but not power loss. Use for boot counters, calibration, wake stats.

DodaTech engineers apply these same patterns across Doda Browser, DodaZIP, and Durga Antivirus Pro for production IoT reliability.

FAQ

### How big is RTC slow memory?

ESP32 has 8KB of RTC slow memory. Variables must fit within this space. Using more causes linker errors.

Does RTC memory survive deep sleep?

Yes. RTC slow memory is powered during deep sleep if RTC domain is not powered off. Data stays across sleep cycles.

Does RTC memory survive power loss?

No. RTC memory is volatile and loses data when power is removed. For permanent storage, use NVS.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro