Any news here? Is it possible to access external PSRAM on Arduino Framework with platform Espressif 1.0.2?
What should be done from our side? How does it work Arduino IDE?
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.
Is this valid for the esp8266 chip as well?
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).
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:
It works on TTGO T-Beam without the build option “BOARD_HAS_PSRAM”.
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
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.
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