ESP32 WROVER Platform RAM size


#21

Any news here? Is it possible to access external PSRAM on Arduino Framework with platform Espressif 1.0.2?


#22

What should be done from our side? How does it work Arduino IDE?


#23

It’s done already. After last upgrade of arduino-espressif32 core v1.0.3 -> v1.1.0 PSRAM is automatically detected and enabled.by the ESP32 core.


#24

Is this valid for the esp8266 chip as well?


#25

Thanks @cyberman54 for pointing out that it’s done!

I just tried it and it works! But we do need to add a build flag to get it enabled.

build_flags = -DBOARD_HAS_PSRAM
platform = https://github.com/platformio/platform-espressif32.git#feature/stage
framework = arduino
board = esp32dev

This worked, the ESP.getFreeHeap() function reports over 4 MB of free ram which is expected (internal RAM + external RAM).

@ivankravets you might want to define a new board for esp32wrover. In this other thread you told people to use esp32dev but they will not get the RAM automatically.

For your reference, this is the commit that added support for that extra RAM in the esp32 arduino framework:

You can see that they edit the boards.txt file to pass the define flag:

esp32wrover.build.defines=-DBOARD_HAS_PSRAM

#26

@mrred128 this is only for esp32. I do not think the esp8266 supports external RAM.


#27

It works on TTGO T-Beam without the build option “BOARD_HAS_PSRAM”.


#28

But we have it? https://github.com/platformio/platform-espressif32/blob/develop/boards/esp-wrover-kit.json


#29

Right - I had not seen this. So without the build_flag the extra 4MB are not visible. With the build flags they are. I guess you just need to add -DBOARD_HAS_PSRAM in this file.

I just made a PR and confirmed that it works on the WROVER-KIT: https://github.com/platformio/platform-espressif32/pull/110

@cyberman54: Which board are you using in your platformio.ini flag?

For anyone else watching, if you want to use the memory, you need to call ps_malloc(). The default malloc() does not allocate from PSRAM.


#30

I did not use the build flag, but i get the 4MB with ESP.getFreeHeap()).
I am using a std:set container in RAM, and can see with ESP.getFreeHeap()) that the 4MB is shrinking when i fill up the std::set. Did not use any malloc() or ps_malloc(). Seems to work without. Board = esp32dev