ESP32-D0WD-V3 (revision 3): how to properly configure platformio.ini?

Good time, dear ones.

How to properly configure platformio.ini when working with ESP32-D0WD-V3. She has 16 Mb Flash on board, and, as far as I understand, 520 RAM instead of 320.
I look here: Boards — PlatformIO latest documentation, I can’t find a suitable type… I’m confused

Chip is ESP32-D0WD-V3 (revision 3)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 34:86:5d:17:df:20
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Auto-detected Flash size: 16MB
Flash will be erased from 0x00001000 to 0x00006fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x00009000 to 0x0000afff...
Flash will be erased from 0x00100000 to 0x001e9fff...
Flash params set to 0x0240

I don’t think internal chip revision updates make much of a difference when compiling code. You can just pick a board that has 16MB of flash declared (esp32thing_plus), or use the bogstandard esp32dev with a parittion table suitable for 16MB (default_16MB.csv)

Big thanks.

I probably expressed myself incorrectly.

I just couldn’t find a board in the list yesterday that declared 16MB of memory. Where I did not look - only 4 came across everywhere. But today I figured out how to do it myself using JSON.

But there was a problem with RAM. Despite the fact that I declared 520 memory in JSON, after compilation, the project still sees only 320. Although when compiled, it appears that the board has 520

": {
    "arduino":{
      "ldscript": "esp32_out.ld"
    },
    "core": "esp32",
    "extra_flags": "-DARDUINO_ESP32_DEV",
    "f_cpu": "240000000L",
    "f_flash": "40000000L",
    "flash_mode": "dio",
    "mcu": "esp32",
    "variant": "esp32"
  },
  "connectivity": [
    "wifi",
    "bluetooth",
    "ethernet",
    "can"
  ],
  "debug": {
    "openocd_board": "esp32-wrover.cfg"
  },
  "frameworks": [
    "arduino",
    "espidf"
  ],
  "name": "Espressif ESP32-WROVER-IE 16MB (ESP32-D0WD-V3)",
  "upload": {
    "flash_size": "16MB",
    "maximum_ram_size": 532480,
    "maximum_size": 16777216,
    "require_upload_port": true,
    "speed": 460800
  },
  "url": "https://en.wikipedia.org/wiki/ESP32",
  "vendor": "Espressif"
}

If the RAM changed, which I myself am unsure of without digging through datasheets, it needs to be be declared in the linkerscript used by the framework. The linker script at Arduino-ESP32

dictates all the different IRAM / DRAM sizes.

However, reading ESP32 Programmers’ Memory Model. Internal memory of the MCU is probably… | by Amey Inamdar | The ESP Journal from 2020, they already say an ESP32 can be configured to have 192KB IRAM + 328KB DRAM which would be 520kByte.

Better ask the people at Arduino-ESP32 about this.

And why then is it in the board settings: “maximum_ram_size”: 532480?

There really is memory there, judging by the datasheets. It’s for this model.

PlatformIO has this redudant information for convenience to display the percentage of RAM used, sometimes it also gets forwarded in linker scripts where the memory size is dynamic. Not for ESP32 though.

It’s clear. Thank you very much for the clarifications

I think it does. See on this page:

If the application uses PSRAM and is based on ESP32 rev. 3 (ECO3), setting CONFIG_ESP32_REV_MIN to 3 disables PSRAM bug workarounds, reducing the code size and improving overall performance.

When compiling with framework = arduino, espidf there’s indeed a performance gain when setting CONFIG_ESP32_REV_MIN_3=y in sdkconfig.defaults. However, I cannot find a way to do the same with framework = arduino as it seems there’s no corresponding key in platformio.ini/board_build). Is that a known limitation?

Thanks.

Isn’t that the reason why build_flags = -mfix-esp32-psram-cache-issue had to be used in combination with -DBOARD_HAS_PSRAM for older ESP32 revisions?

This is no longer required for newer revisions such as ESP32-C or ESP32-S series. There a simple build_flags = -DBOARD_HAS_PSRAM is sufficient.