How to access or enable ESP32 WROVER PSRAM in Arduino IDE

Rainbow
Posts: 26
Joined: Fri May 21, 2021 3:21 am

How to access or enable ESP32 WROVER PSRAM in Arduino IDE

Postby Rainbow » Fri Apr 29, 2022 10:53 am

Hi Espressif,

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

lbernstone
Posts: 826
Joined: Mon Jul 22, 2019 3:20 pm

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

Postby lbernstone » Fri Apr 29, 2022 6:06 pm

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/

Who is online

Users browsing this forum: No registered users and 79 guests