Chapter 4. Software framework
When using ESP32 modules, how to check the size of their PSRAM?
For ESP32 modules, the esp_spiram_get_size() function in ESP-IDF can be used to obtain the size of
a module’s PSRAM. This function returns the total size of the PSRAM in bytes and can be used for
memory allocation and management.
The following is an example for obtaining the size of PSRAM:
size_t psram_size = esp_spiram_get_size();
printf("PSRAM size: %d bytes\n", psram_size);
Note that the esp_spiram_get_size() function should be called before using the PSRAM to ensure the
correct PSRAM size can be obtained. Additionally, PSRAM functionality should be enabled in make
menuconfig, so that PSRAM can be used and congured. Furthermore, the PSRAM size can also
be obtained in the bootloader log.
When ESP32 connected to a PSRAM externally, how to change its clock source?
In menucong: menucong -> Component cong -> ESP32-specic -> SPI RAM cong.
When a 8 MB PSRAM mounted on ESP32, why only 4 MB of it is actually mapped?
• Up to 4 MB (0x3F80_0000 ~ 0x3FBF_FFFF) of external RAM can be mapped into data address space, please
refer to the specications of Section 3.1.4 Memory Map in ESP32 Datasheet.
• For a 8 MB PSRAM, you can access the other 4 MB following example himem.
I’m using an ESP32 development board with the ocial PSRAM chip PSRAM64H embedded. But after
replacing another type of PSRAM chip to PSRAM64H, it failed to recognize when I ran an ESP-IDF example
and enabled the PSRAM conguration. What is the reason?
• If you need to change the PSRAM chip, please update conguration options in “menucong -> Component
cong -> ESP32-specic -> Support for external, SPI-connected RAM -> SPI RAM cong -> Type of SPI
RAM chip in use”.
• If you cannot nd the corresponding type options of the new PSRAM chip you are about to use, please add
the chip driver manually.
• It is recommended to use Espressif’s ocial ESP-PSRAM chip for ESP32 series.
Why is the following error printed when I download the hello-world example into the ESP32-WROOM-32E
module?
E (225) psram: PSRAM ID read error: 0xffffffff
E (225) spiram: SPI RAM enabled but initialization failed. Bailing out.
The reason for the error is that the PSRAM (Component config > ESP32-specific > Sup-
port for external, SPI-connected RAM) setting is enabled in the software, but there is
no PSRAM support in the hardware.
Espressif Systems 112
Submit Document Feedback
Release master