Page 1 of 1

How to access or enable ESP32 WROVER PSRAM in Arduino IDE

Posted: Fri Apr 29, 2022 10:53 am
by Rainbow
Hi Espressif,

Could you please explain how to access or enable ESP32 WROVER PSRAM in Arduino IDE?

Re: How to access or enable ESP32 WROVER PSRAM in Arduino IDE

Posted: Fri Apr 29, 2022 6:06 pm
by lbernstone
I assume you are using arduino-esp32 v2.0.2. If you choose the "ESP32 Wrover module" board, PSRAM will be automatically enabled. If you choose the "ESP32 Wrover Kit (all versions)", there is an option in the board menu to enable PSRAM. The memory will be initialized automatically as part of the initArduino() function.
PSRAM is used automatically for allocations greater than 16K bytes. If you want to ensure a smaller allocation uses psram, use the ps_malloc function (which behaves like a normal malloc).
I have posted an example that shows how to use a custom allocator to assign a std:: object (eg std::vector) into the psram. https://github.com/lbernstone/psram_custom_allocator/