Skip to content

ESP32 PSRAM Not Detected or Not Usable

DodaTech Updated 2026-06-26 1 min read

In this tutorial, you'll learn about ESP32 PSRAM Not Detected or Not Usable. We cover key concepts, practical examples, and best practices.

The Problem

ESP32 external PSRAM (SPIRAM) is not detected or crashes when accessed.

Quick Fix

Wrong

// PSRAM not configured in menuconfig
// Or wrong PSRAM type selected
heap_caps_malloc(size, MALLOC_CAP_SPIRAM) returns NULL.
// Enable in menuconfig:
// CONFIG_SPIRAM=y, CONFIG_SPIRAM_USE_CAPS_ALLOC=y
if (psramFound()) {
  size_t psramSize = ESP.getPsramSize();
  size_t freePsram = ESP.getFreePsram();
  Serial.printf("PSRAM: %d KB total, %d KB free\n",
    psramSize/1024, freePsram/1024);
  // Allocate from PSRAM
  void* buf = heap_caps_malloc(32768, MALLOC_CAP_SPIRAM);
  if (buf) Serial.println("PSRAM allocation OK");
} else {
  Serial.println("PSRAM not found");
}
PSRAM: 4096 KB total, 3896 KB free
PSRAM allocation OK

Prevention

Enable PSRAM support in menuconfig (SPIRAM). Set correct PSRAM type (quad/ octal). Use heap_caps_malloc() with MALLOC_CAP_SPIRAM for PSRAM. Check psramFound() before using PSRAM. Test with psram test sketch.

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

FAQ

### How do I enable PSRAM in Arduino IDE?

Tools -> PSRAM -> Enabled. Also select the correct board variant with PSRAM support (ESP32 WROVER).

What PSRAM sizes are supported?

ESP32 supports 2MB, 4MB, and 8MB PSRAM modules. Check your module datasheet for exact size and type.

Why does my ESP32 crash when accessing PSRAM?

Wrong PSRAM configuration, incorrect voltage (1.8V vs 3.3V), or PSRAM chip not properly soldered.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro