Hi,
I am trying to have a better understanding of the FLASH and PSRAM settings, and its side effects when correctly configured in PIO.
Of course, to be able to setup an adequate platformio.ini, esp32-s3-devkitc-1.json and default_8MB.csv file (probably changing the name of the last two).
My test board is ESP32-S3-DevKitC-1.1 N8R2 and I am able to compile, monitor and debug, all on the native USB interface, using one USB cable.
I bought this kit for testing purposes only, but in my two coming projects (job), I will use “esp32-s3-wroom-1_1u” NxRy, having not decided yet for “Nx” and “Ry”.
So, for now my FLASH is 8MB and my PSRAM is 2MB. I have numbered all my questions and would very much appreciate if I can get answers/comments on them.
Maybe its rude to make so many questions in one post, but because they are very related, I think it makes sense (for future readers too).
Feel free to change or suggest a title change.
If you look at my compile LOG (red box), I have 320K of RAM used at a 5.9%
- Am I guessing correctly, that this is defined “maximum_ram_size”: 327680 in the JSON file?
- I imagine this chunk is taken from “Internal SRAM 1” bank as it is the only bank that can provide 320K from its 416K? (technical reference manual)
- I imagine not more is taken as the RTOS needs storage memory too?
- Have never seen something indicating the PSRAM size, only DBOARD_HAS_PSRAM, so I imagine it is only to tell the compiler to add/link the code, that enables to allocate under RTOS, memory chunks from it, by using “heap_caps_malloc”?
- Because PSRAM is used dynamically I assume it is the responsibility of the programmer to check for enough space, but is this checking done on the return value of “heap_caps_malloc” and in some way RTOS will know the real size or might it be possible the “heap_caps_malloc” return a chunk that starts in valid PSRAM offset but ends beyond PSRAM’s end boundary (crash)?
- Can PSRAM be used statically when the 320K get consumed completely?
- Where do we have to tell if the PSRAM is Quad or Octal and how?
If you look at my compile LOG (yellow box), I have 3.342.336 bytes of flash (0x330000) that match with these two lines
app0, app, ota_0, 0x10000, 0x330000,
app1, app, ota_1, 0x340000,0x330000,
in the partition file
- Why has the N8 and no PSRAM config (only one available at PIO), of the most basic esp32-s3-devkitc-1, divided the 8MB of FLASH in these two odd sized chunks leaving 1.703.936 bytes unused?
- I just recompiled my last ESP project (where a regular ESP32 from a HELTEC kit was used) that had only 1.310.720 of FLASH and now, due to the library and PIO updates, instead of using 99% of FLASH, it reached 100.5% (used 1316949 bytes from 1310720 bytes). This is not a big deal as I can make it fit, and I do not expect to surpass the 0x330000 size in my next projects, but in a hypothetical case, would the compiler use app0 and app1 or would I be required to resize or join them?
- I imagine, the best way to configure any type of NxRy (FLASH/PSRAM) combination of an S3 processor board, is to create a custom JSON file (referenced in platformio.ini) and on that file reference a custom CSV file, but I am wondering if I need to put something else than DBOARD_HAS_PSRAM in the platformio.ini file?
- For my 8MB of FLASH “flash_mode”: “qio” is correct being it a Quad SPI, what would I need to use if the FLASH Octal SPI?
- In case of 16MB/32MB Octal SPI, the fact that it is a 1,8V SPI is already wired in the board or do we need to set a parameter in the configuration files?
- I recall seeing at some place (not sure if an INI PIO file) where “qio_qio” was set. What does this mean?
Regards,
Thomas
p.s.
This is my compile LOG of a simple blink on the ESP32-S3-DevKitC-1.1 N8R2:
This is my platformio.ini
[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
monitor_speed = 115200
upload_port = COM34
monitor_port = COM34
build_flags =
-DARDUINO_USB_CDC_ON_BOOT=1
-DBOARD_HAS_PSRAM
monitor_dtr = 1
monitor_rts = 1
lib_deps = adafruit/Adafruit [NeoPixel@^1.12.2](mailto:NeoPixel@%5e1.12.2)
Looking at esp32-s3-devkitc-1.json
I find:
"arduino":{
"ldscript": "esp32s3_out.ld",
"partitions": "default_8MB.csv"
},
And looking at default_8MB.csv
I find:
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x330000,
app1, app, ota_1, 0x340000,0x330000,
spiffs, data, spiffs, 0x670000,0x180000,
coredump, data, coredump,0x7F0000,0x10000,