Suddenly PSRAM ID read errors... did a configuration file get corrupted?

Does it stilll work in the Arduino IDE? If yes, with which settings and versions?

Hi Max,
I have not used the Arduino IDE in years… The code was working fine on Platformio. I did a pio --update dev at one point and wonder if that might have something to do with this. I am going to do some file comparisons this morning from projects that were working against the ones that are not to see if any of the files in the .pio\build directory changed.

You can roll back the used Arduino-ESP32 version by specifying an older platform version.

Do you still get a PSRAM initialization error when you try replacing that with one of these?

; 2.0.4
platform = espressif32@5.1.1

; 2.0.3
platform = espressif32@5.0.0 

; 2.0.3 (first appearence of esp32-s3-devkitc-1 board)
platform = espressif32@4.3.0

Hi Max. Thank you. Unfortunately none of those helped.

This is so odd since it was working earlier for many code examples. I am just trying an “hello world” program now. I am wondering if perhaps the .json is not correct. (I am using the N8R8 chip).

{
  "build": {
    "arduino":{
      "ldscript": "esp32s3_out.ld",
      "partitions": "default_8MB.csv"
    },
    "core": "esp32",
    "extra_flags": [
      "-DARDUINO_ESP32S3_DEV",
      "-DARDUINO_USB_MODE=1",
      "-DARDUINO_RUNNING_CORE=1",
      "-DARDUINO_EVENT_RUNNING_CORE=1"
    ],
    "f_cpu": "240000000L",
    "f_flash": "80000000L",
    "flash_mode": "dio",
    "hwids": [
      [
        "0X303A",
        "0x1001"
      ]
    ],
    "mcu": "esp32s3",
    "variant": "esp32s3"
  },
  "connectivity": [
    "wifi"
  ],
  "debug": {
    "default_tool": "esp-builtin",
    "onboard_tools": [
      "esp-builtin"
    ],
    "openocd_target": "esp32s3.cfg"
  },
  "frameworks": [
    "arduino",
    "espidf"
  ],
  "name": "Espressif ESP32-S3-DevKitC-1-N8 (8 MB QD, No PSRAM)",
  "upload": {
    "flash_size": "8MB",
    "maximum_ram_size": 327680,
    "maximum_size": 8388608,
    "require_upload_port": true,
    "speed": 460800
  },
  "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitc-1.html",
  "vendor": "Espressif"
}

Using 5.1.1 notice the “Expected” SHA-256 value… This makes me think it is not using PSRAM in the setup.

SHA-256 comparison failed:
Calculated: dcde8d8a4817d9bf5d5d69a7247667264e4e10ac7493514868b61f5aa6146539
Expected: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
Attempting to boot anyway...
entry 0x403c98d8
E (98) psram: PSRAM ID read error: 0x00ffffff
[    97][W][esp32-hal-psram.c:71] psramInit(): PSRAM init failed!

BUT, with 5.0.0

SHA-256 comparison failed:
Calculated: 9127e332554622857d5c753c9ffbb9862bfb72e81ded80db80617d5974000cec
Expected: 867c0d6cb8d08f5a22bebcb1e4a5d457c2700a1c6b76abeb4d778eadcc3446e2
Attempting to boot anyway...
entry 0x403b61c0
E (101) psram: PSRAM ID read error: 0x00ffffff
[   101][W][esp32-hal-psram.c:71] psramInit(): PSRAM init failed!

Did you overwrite the contents of esp32-s3-devkitc-1.json in C:\Users\<user>\.platformio\platforms\espressif32\boards? with the JSON content you showed? Or where is that file you’re showing the contents of?

Max, again thank you.for your help here.

That .json is what I find in: C:\Users\peted.platformio\platforms\espressif32\boards\esp32-s3-devkitc-1.json

If it is over-written, it was not consciously done.

Okay, it’s still the same file.

board = adafruit_feather_esp32s3.json

does not work either, with platform = espressif32?

Max,
I have tried…

  1. updating espressif32 and that brought in 5.2.0. Then with Adafruit board. This platformio.ini returned PSRAM ID read error also.
[env:adafruit_feather_esp32s3]
platform = espressif32
board = adafruit_feather_esp32s3
framework = arduino

monitor_speed = 115200
lib_ldf_mode = deep
lib_extra_dirs = ~/Documents/Arduino/libraries
;board_build.partitions = default_partitions.csv
build_flags =
    -I./src/
	  -DCORE_DEBUG_LEVEL=5
	  -DBOARD_HAS_PSRAM
	  -mfix-esp32-psram-cache-issue
      -fmax-errors=5
  1. rolling back to 5.1.1 with Adafruit board

[env:adafruit_feather_esp32s3]
platform = espressif32@5.1.1
board = adafruit_feather_esp32s3
framework = arduino

monitor_speed = 115200
lib_ldf_mode = deep
lib_extra_dirs = ~/Documents/Arduino/libraries
;board_build.partitions = default_partitions.csv
build_flags =
    -I./src/
	  -DCORE_DEBUG_LEVEL=5
	  -DBOARD_HAS_PSRAM
	  -mfix-esp32-psram-cache-issue
      -fmax-errors=5

Can you still cross-check against the Arduino IDE with latest Arduino-ESP32 2.0.5? That way we can find out whether it’s a PlatformIO issue or a Arduino-ESP core (or ESP-IDF) issue.

Install per 1.8.X per https://www.arduino.cc/en/software and Installing - - — Arduino ESP32 latest documentation

Hi Max,
I am certainly willing to follow your sage advice and try this on Arduino IDE. I will probably have to do some work to figure out how to tell it turn on the right amount of PSRAM… still waiting for esp install to complete.

What really bothers me is that MANY programs using this devkit board and PSRAM were working just great on the platformio IDE and then suddenly, not working. One thing I was doping was switching back and forth with the UM FeatherS3 by changing the platformio.ini file, cleaning, and re-compiling/uploading. The UMFeatherS3 has its PSRAM external to the processor. Could something have “cross-contaminated” my settings? Would a complete clean install of VS Code and PlatformIO perhaps be an option here?

OK Max… I have done some testing with the (dreaded) Arduino IDE.

I did some testing to make absolutely sure that PSRAM was being used. It all works fine there. I won’t bother you with that code unless you want to see it.

This might have given me a clue… while setting up the PSRAM in the Tools menu of the Arduino IDE, I have to select QSPI or OPI PSRAM. The FeatherS3 uses QSPI but the Devkit uses OPI. Perhap somehow in switching back and forth between the two processor boards I managed to select QSPI in a way that it is not switching back to OPI when I go to the DEVKIT board. My next step is to look into making sure OPI is selected in my configurations on Platformio.

For ESP32S3, the builder scripts respects the build.arduino.memory_type field (source) to select one of the folders here for the first part (the second part after the _ is fixed to qspi.

So let’s try the opi_qspi configuration. Add

board_build.arduino.memory_type = opi

to the platformio.ini and reupload the firmware.

My bad, I misread the python code (weirdly nested), you should give the full folder name. The folder is named after

esp32s3.build.memory_type={build.boot}_{build.psram_type}

so since the board file says the flash is DIO, and you say OPI PSRAM works, let’s try

board_build.arduino.memory_type = dio_opi

no joy… sigh

I keep asking myself “what has changed?” Always the best first and last trouble-shooting question. One thing that has changed lately is that I added file synchronization to my GoogleDrive. This has had the unwanted side-effect of constantly changing the timestamp on all my files when I reboot. I am wondering if this might be wreaking havoc on the file rev management within Platformio. Thoughts?

You can always delete C:\Users\<user>\.platformio\ for a clean reinstall. It will be reinstalled when VSCode is restarted (by the PIO extension).

This may also not be directly changable in the platformio.ini, in which case you have to change it in the board’s JSON file directly:

{
  "build": {
    "arduino":{
      "ldscript": "esp32s3_out.ld",
      "partitions": "default_8MB.csv",
      "memory_type": "dio_opi"
    },
    "core": "esp32",
    "extra_flags": [
      "-DARDUINO_ESP32S3_DEV",
      "-DARDUINO_USB_MODE=1",
      "-DARDUINO_RUNNING_CORE=1",
      "-DARDUINO_EVENT_RUNNING_CORE=1"
    ],
    "f_cpu": "240000000L",
    "f_flash": "80000000L",
    "flash_mode": "dio",
    "hwids": [
      [
        "0X303A",
        "0x1001"
      ]
    ],
    "mcu": "esp32s3",
    "variant": "esp32s3"
  },
  "connectivity": [
    "wifi"
  ],
  "debug": {
    "default_tool": "esp-builtin",
    "onboard_tools": [
      "esp-builtin"
    ],
    "openocd_target": "esp32s3.cfg"
  },
  "frameworks": [
    "arduino",
    "espidf"
  ],
  "name": "Espressif ESP32-S3-DevKitC-1-N8 (8 MB QD, No PSRAM)",
  "upload": {
    "flash_size": "8MB",
    "maximum_ram_size": 327680,
    "maximum_size": 8388608,
    "require_upload_port": true,
    "speed": 460800
  },
  "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitc-1.html",
  "vendor": "Espressif"
}

I have heard only of problems when using cloud file solutions with PlatformIO project files.

Well… I completely rebuilt my Visual Studio Code and platformio environment after completely deleting all the files. Created a new project using board = esp32-s3-devkitc-1 Copies and pasted known good main.cpp. Used the following platformio, also known good from prior usage.

[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino

monitor_speed = 115200
monitor_port = COM9
upload_port = COM9

build_flags = -DCORE_DEBUG_LEVEL=5
			-DBOARD_HAS_PSRAM
            -mfix-esp32-psram-cache-issue

lib_ldf_mode = deep+

AND… am still getting PSRAM ID read error message.

And that is with the modified json file? If

fails, please iterate through all x_y iterations in https://github.com/espressif/arduino-esp32/tree/master/tools/sdk/esp32s3.

Thanks to your help, my undefeated record remains intact. :grin:

After the clean install I went back through all the things we tried again. The key is just one line in the platformio.ini which you had suggested (the json file is correct and did not need change),

platform = espressif32
board = esp32-s3-devkitc-1
board_build.arduino.memory_type = dio_opi ; NEEDED FOR PSRAM
framework = arduino
monitor_speed = 115200
monitor_port = COM13
upload_port = COM13
build_flags = -DCORE_DEBUG_LEVEL=5
	-DBOARD_HAS_PSRAM
	-mfix-esp32-psram-cache-issue
lib_ldf_mode = deep+
lib_extra_dirs = ~/Documents/Arduino/libraries

All I can figure as to how things went off the rails was a tug of war with GoogleDrive. I have now taken that of system. I can’t explain for certain whit worked previously without that line, but I am happy to have a known working configuration now which should be stable going forward.

Thanks again for your help and patience.
Pete

1 Like

Doesn’t the N8R8 has 512K SRAM? I’m curious why you haven’t edited the json file.
I’m running into a

dangerous relocation: windowed longcall crosses 1GB boundary; return may fail: *UND*

error that I was hoping your PSRAM solution would work.