Skip to content

PSRAM stops working when importing arduino-esp32 into ESP-IDF. Flag CONFIG_SPIRAM becomes undefined when BOARD_HAS_PSRAM is not set. #10500

Closed
@cjdell

Description

@cjdell

Board

Xiao ESP32-S3 Sense

Device Description

Xiao ESP32-S3 Sense connected to PC with USB-C

Hardware Configuration

Just USB-C to PC

Version

latest master (checkout manually)

IDE Name

VSCode

Operating System

NixOS

Flash frequency

40MHz

PSRAM enabled

yes

Upload speed

460800

Description

Unfortunately my PSRAM stopped working as soon as I started using the arduino-esp32 component. This code literally undefines the CONFIG_SPIRAM and CONFIG_SPIRAM_SUPPORT flag out of existence:

https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-psram.h#L29

There is no way to override them back. I even tried defining BOARD_HAS_PSRAM as a build flag but it hasn't worked. I haven't found docs on how to set global builds flags nor is there any information on the BOARD_HAS_PSRAM flag and any explanation as to why it exists when we already have flags in sdkconfig for those.

Manually removing lines 24-31 in esp32-hal-psram.h will get PSRAM working again but this is an uncomfortable workaround.

Thanks

Sketch

#include <Arduino.h>

void setup()
{
  delay(2000);

  // DOES NOT WORK WITHOUT "BOARD_HAS_PSRAM" WHICH IS NOT DEFINED !!!
#if CONFIG_SPIRAM
  ESP_LOGI("main", "CONFIG_SPIRAM DEFINED");
#else
  ESP_LOGI("main", "CONFIG_SPIRAM ** NOT ** DEFINED");
#endif

  ESP_LOGI("main", "PSRAM Size: %i", (int)ESP.getPsramSize());
}

void loop()
{
}

Debug Message

No CONFIG_SPIRAM defined
PSRAM reports 0 bytes (incorrect)

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions