PlatformIO Community

A question about board configuration files with ESP32

Hello,

I’m still a beginner when it comes to using PlatformIO.

I want to use it with the “WEMOS LOLIN D32 Pro” board, which has 16 MB Flash and 8 MB PSRAM, and the “Espressif IoT Development Framework”.
Changing the flash size in the configuration file is easy, but I still have no idea how to add PSRAM functionality to the configuration file so that it can be accessed.

Could someone please provide me with such a file?

Thanks in advance,
Michael

Docs.

Sorry Max,

I leafed through the chapter for the boards with ESP32 and found no (sufficient) information straight away on how to configure PSRAM. Just a “-D …”.
I cannot and do not want to waste a lot of time again just this time studying the entire documentation. It is complex enough to configure PlatformIO so that it does what it should do. Sometimes it’s very unpredictable, because VS Code is unpredictable also. Neither is it plug-and-play, more like most things else, plug-and-pray.
That’s why I dared to address this question/request to the community.

One thing you should believe me: Simply from my personal, very bad experience with “offers of help” in general, I basically try to solve every problem on my own before I ask someone for help. Especially in the professional environment. In the past that was and now that is the best way to solve problems.

Best Regards,
Michael

Look, let’s keep the discussion on topic. If the documentation hasn’t helped and you’ve already tried that configuration option, just say so.

Please state the full current platformio.ini and code with which you are testing PSRAM availability.

Hello Max,

my “platform.ini”:

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:lolin_d32_pro]
lib_deps = eve
platform = espressif32
board = lolin_d32_pro
framework = espidf
upload_port = /dev/ttyUSB1
upload_speed = 115200
monitor_port = /dev/ttyUSB1
monitor_speed = 115200
debug_port = /dev/ttyUSB0
debug_speed = 115200
board_build.f_cpu = 240000000L
board_build.f_flash = 40000000L
board_build.flash_mode = qio
build_flags =
    -DCONFIG_SPIRAM_CACHE_WORKAROUND
; --- Some more settings from original sdkconfig for try and error
;    -DCONFIG_ESP32_ECO3_CACHE_LOCK_FIX
;    -DCONFIG_ESP32_REV_MIN_0
;    -DCONFIG_ESP32_REV_MIN=0
;    -DCONFIG_ESP32_DPORT_WORKAROUND
;    -DCONFIG_ESP32_DEFAULT_CPU_FREQ_240
;    -DCONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=240
;    -DCONFIG_ESP32_SPIRAM_SUPPORT
;    -DCONFIG_SPIRAM
;    -DCONFIG_SPIRAM_BOOT_INIT
;    -DCONFIG_SPIRAM_TYPE_ESPPSRAM64
;    -DCONFIG_SPIRAM_SPEED_40M
;    -DCONFIG_SPIRAM_SIZE=8388608L
;    -DCONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=16384
;    -DCONFIG_SPIRAM_CACHE_WORKAROUND
;    -DCONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_MEMW
;    -DCONFIG_SPIRAM_USE_MALLOC
;    -DCONFIG_SPIRAM_MEMTEST
;    -DCONFIG_SPIRAM_BANKSWITCH_ENABLE
;    -DCONFIG_SPIRAM_BANKSWITCH_RESERVE=8
;    -DCONFIG_SPIRAM_OCCUPY_VSPI_HOST
;    -DCONFIG_D0WD_PSRAM_CLK_IO=17
;    -DCONFIG_D0WD_PSRAM_CS_IO=16

Without any sarcasm and other negative impressions that you might get from me: Could you please just tell me where this information is in the documentation! Maybe I actually overlooked it while leafing through it. Others say I’m only human too.

I’ve also looked through all of the configuration files for ESP32 base boards. None of them contain any parameters for PSRAM.

Thanks in advance,
Michael

The ESP-IDF documentation for PSRAM is at Support for external RAM - ESP32 - — ESP-IDF Programming Guide latest documentation.

Since you are using ESP-IDF you should be using the pio run -t menuconfig command as documented here, e.g. in a CLI, to access the ESP-IDF configuration. You should not be using direct -DCONFIG_ESP32_ECO3_CACHE_LOCK_FIX etc macros (although that would have the same effect, but is not the intended way and can conflict).

Once you are in the menuconfig you can navigate the menus to

grafik

grafik

grafik

Activate that and save the changes (q to quit), given the standard pin numbers in the “SPI RAM config” submenu are correct, it should find the PSRAM. The initial UART boot log should be logging something about it, at least.

Hi Max,

I’m sorry, I didn’t see the passage in the documentation that says I’ve to use the “old” command “idf.py menuconfig” for PlatformIO too!
In the past I was surprised that PlatformIO basically doesn’t offer a “real” configuration dialog for the plaform ESP32 …

May I ask you another question that has now arisen: Yesterday I updated Ubuntu, suddenly when I called VS-Code for the first time today a window with “PlatformIO IDE has been successfully installed! …” appeared. Here the statement is “installed” and not “updated”! Was it an update?

Kind Regards,
Michael