-
-
Notifications
You must be signed in to change notification settings - Fork 9
esp32-d0-pico2 fixes #108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
esp32-d0-pico2 fixes #108
Conversation
|
Note
|
| Cohort / File(s) | Summary |
|---|---|
Documentation docs/gettingstarted/installer.md |
Updated ESP32 LED capability wording: now specifies "up to 1024 LEDs at 30 FPS on a single output" or "4096 LEDs over Art-Net/network" instead of a single "up to 4096 LEDs" statement. |
Firmware configuration firmware/esp32-d0.ini |
In env:esp32-d0-pico2, added PSRAM-related settings and build flags: board_build.arduino.memory_type = qio_qspi, board_build.flash_mode = qio, -DBOARD_HAS_PSRAM, and -mfix-esp32-psram-cache-issue; adjusted partitions/comment formatting. Review build behavior for PSRAM and flash mode changes. |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
🐰 I hopped through docs with bright delight,
Counted LEDs by day and night,
Flags for PSRAM set just so,
Builds may change — hop nice and slow,
Cheers to clearer paths aglow ✨
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title 'esp32-d0-pico2 fixes' is directly related to the main changes: adding a new ESP32-PICO-Mini-02 environment definition with PSRAM support and fixing boot crashes. However, 'fixes' is somewhat vague without specifying what is being fixed. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
|
@coderabbitai, I have this new esp32 MCU definition: [env:esp32-d0-pico2] And used it to flash to a ESP32-PICO-Mini-02 : ESP32 based, Dual-Core 240Mhz microcontroller, 8MB Flash, 2MB PSRAM, more info here: https://documentation.espressif.com/esp32-pico-mini-02_datasheet_en.pdf In esp32-d0.ini, imported in platformio.ini I used board = esp32-pico-devkitm-2 which I believe takes the definition from https://github.com/platformio/platform-espressif32/blob/master/boards/esp32-pico-devkitm-2.json (can you check it this is how it works using board =). When flashing I got this: [13:50:02]ELF file SHA256: 7dc328089 Can you investigate what is going on? And propose changes to my [env:esp32-d0-pico2] if needed, to make this definition work for ESP32-PICO-Mini-02 |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 21 🌐 Web query: 💡 Result: I found the official PlatformIO board page and the board manifest on GitHub. Do you want me to paste the full esp32-pico-devkitm-2.json here, or just show how to reference/use it in platformio.ini? [PlatformIO docs] [GitHub manifest]. Sources: Citations: 🏁 Script executed: Length of output: 6410 🌐 Web query: 💡 Result: Likely causes
Quick fixes (try in order)
What to check if problem persists
References
If you want, tell me: board model (ESP32, S2, S3, C3, module name), current IDE/PlatformIO settings, and the exact serial log and I’ll give exact commands/setting values. 🏁 Script executed: Length of output: 1172 🌐 Web query: 💡 Result: Short answer — for an ESP32‑PICO‑MINI‑02 (8 MB flash / 2 MB PSRAM) in PlatformIO (Arduino framework) set PSRAM as SPI (QIO) and enable PSRAM via build flags. Example platformio.ini entries: References: ESP32‑PICO‑MINI‑02 datasheet (shows 2 MB PSRAM). [1] PlatformIO docs on enabling external RAM / Arduino flags. [2] Example PlatformIO configs showing memory_type / psram_type = qio for ESP32 boards. [3] Sources:
Root Causes
Fixed ConfigurationHere's the corrected [env:esp32-d0-pico2]
board = esp32-pico-devkitm-2 ; https://github.com/platformio/platform-espressif32/blob/master/boards/esp32-pico-devkitm-2.json
board_build.partitions = boards/ESP32_8MB.csv ; Fixed: was default_8MB.csv (doesn't exist)
board_build.arduino.memory_type = qio_qspi ; Added: PSRAM memory type
board_build.flash_mode = qio ; Added: Flash mode for PSRAM
build_flags = ${esp32-d0-base.build_flags}
-D HTTPD_STACK_SIZE=6144
-DBOARD_HAS_PSRAM ; Added: Enable PSRAM
-mfix-esp32-psram-cache-issue ; Added: Fix ESP32 PSRAM cache bug
lib_deps = ${esp32-d0-base.lib_deps}Key Changes Explained
Next StepsBefore reflashing with the new configuration, erase the entire flash to clear the corrupted core dump partition: # Using PlatformIO
pio run -t erase
# Or using esptool directly
esptool.py --port <YOUR_PORT> erase_flashThen upload with the corrected configuration. About Board DefinitionYes, you're correct about how Let me know if this resolves the issues! 🧠 Learnings used |
|
@coderabbitai, regarding
When I use board_build.partitions = boards/ESP32_8MB.csv I got: Error: The program size (2349899 bytes) is greater than maximum allowed (2097152 bytes) why is that? as it exists in the boards folder... (check it's contents please) but when I used default_8MB.csv it works fine: RAM: [== ] 18.8% (used 61728 bytes from 327680 bytes) You say it is not defined in boards but isn't this some globally available definition? Furthermore regarding
In https://github.com/platformio/platform-espressif32/blob/master/boards/esp32-pico-devkitm-2.json I can find "extra_flags": [ "flash_mode": "qio", there is only not arduino.memory_type = qio_qspi so we don't need to specify -DBOARD_HAS_PSRAM and oard_build.flash_mode = qio isn't it? and do we need -mfix-esp32-psram-cache-issue for this board? So concluding: the only real change you propose is adding arduino.memory_type = qio_qspi and maybe -mfix-esp32-psram-cache-issue. Is that indeed what was missing bottom line? |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 1736 🏁 Script executed: Length of output: 6203
Partition File ClarificationYou're right: The key difference:
So stick with Board JSON FlagsYou're also right about the redundant flags! The board JSON at
So you don't need to re-specify these in your platformio.ini. What About -mfix-esp32-psram-cache-issue?This flag is still recommended because:
Looking at your Bottom Line: The Actual FixYes, you're exactly right! The minimal changes needed are: [env:esp32-d0-pico2]
board = esp32-pico-devkitm-2
board_build.partitions = default_8MB.csv ; Framework default with 3.3MB app partitions
board_build.arduino.memory_type = qio_qspi ; ← THIS was missing (enables PSRAM)
build_flags = ${esp32-d0-base.build_flags}
-D HTTPD_STACK_SIZE=6144
-mfix-esp32-psram-cache-issue ; ← Safety for ESP32 Rev1 cache bug (optional but recommended)
lib_deps = ${esp32-d0-base.lib_deps}Root Cause of Original CrashThe LoadStoreError happened because:
The core dump error was just a side effect of the crash happening early in boot before that partition was initialized. TL;DR: You nailed it — ✏️ Learnings added
🧠 Learnings used |
|
@coderabbitai, still same crash. I read somewhere else ( MoonModules/WLED-MM#322 ), maybe related?: _Switching to flash_mode = dio: The standard QIO mode was too unstable when the HUB75 driver was active, leading to flash write failures. So should I change qio to dio? Please also explain what it does, maybe @intermittech had the right setting for this after all 🙂 |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 17977
DIO vs QIO ExplainedQIO (Quad I/O): Uses 4 data lines for flash communication, up to 4× faster than standard. DIO (Dual I/O): Uses 2 data lines for flash communication. Performance order: QIO > QOUT > DIO > DOUT The key difference: In QIO mode, two additional GPIOs are used for SPI flash communications (SPIWP and SPIHD pins). If flash mode is set to DIO then these pins are available for other purposes. Pin Conflicts with HUB75 and Other DriversYour codebase does use HUB75 drivers (found When using high-bandwidth drivers (HUB75, parallel LED drivers), QIO mode can cause:
The WLED-MM reference you found is highly relevant — switching to DIO resolved HUB75 driver instability there. But Wait — PICO-D4 Caveat!However, I found a conflicting report: When flashing with QIO mode all is well, when flashing with DIO mode the sketch fails to talk the the built-in flash correctly on PICO-D4 boards. This suggests PICO boards may have unique flash wiring that actually requires QIO. Critical QuestionsBefore recommending DIO, I need to understand the current situation:
The fact that you're still getting the same crash suggests one of two things:
What to TryOption 1: Verify current config and check boot log [env:esp32-d0-pico2]
board = esp32-pico-devkitm-2
board_build.partitions = default_8MB.csv
board_build.arduino.memory_type = qio_qspi ; ← Make sure this is present
build_flags = ${esp32-d0-base.build_flags}
-D HTTPD_STACK_SIZE=6144
-mfix-esp32-psram-cache-issue
lib_deps = ${esp32-d0-base.lib_deps}Check the boot log — does it say Option 2: Try DIO flash mode (if Option 1 confirms PSRAM is initialized but still crashing) [env:esp32-d0-pico2]
board = esp32-pico-devkitm-2
board_build.partitions = default_8MB.csv
board_build.arduino.memory_type = dio_qspi ; ← Changed from qio_qspi
board_build.flash_mode = dio ; ← Override QIO
build_flags = ${esp32-d0-base.build_flags}
-D HTTPD_STACK_SIZE=6144
-mfix-esp32-psram-cache-issue
lib_deps = ${esp32-d0-base.lib_deps}Can you share: The current complete config you're using, and the full boot log (first ~50 lines) so we can see if PSRAM is actually being found? 🧠 Learnings used |
|
@coderabbitai, new attempt, now with more logging, can you analyze Does it crash on device["manufacturer"] = "MoonModules"; ? (src/MoonLight/Modules/ModuleLightsControl.h:200) Logging: Rebooting... rst:0xc (SW_CPU_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT) Core 0 register dump: Backtrace: 0x40145da4:0x3ffe3b40 0x40145f86:0x3ffe3b60 0x400e0331:0x3ffe3b80 0x400e13a9:0x3ffe3ba0 0x40142e0d:0x3ffe3bf0 0x40152b52:0x3ffe3c30 0x400824ca:0x3ffe3c60 0x40079882:0x3ffe3c90 |<-CORRUPTED ELF file SHA256: 7dc328089 E (970) esp_core_dump_flash: Core dump flash config is corrupted! CRC=0x7bd5c66f instead of 0x0 |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 6241
[env:esp32-d0-pico2]
board = esp32-pico-devkitm-2
board_build.partitions = default_8MB.csv
build_flags = ${esp32-d0-base.build_flags}
-D HTTPD_STACK_SIZE=6144
lib_deps = ${esp32-d0-base.lib_deps}
; Core dump flash config is corrupted!No PSRAM configuration at all! Why This Crashes at Line 200The crash happens because:
The FixAdd the missing PSRAM configuration: [env:esp32-d0-pico2]
board = esp32-pico-devkitm-2
board_build.partitions = default_8MB.csv
board_build.arduino.memory_type = qio_qspi ; ← ADD THIS
build_flags = ${esp32-d0-base.build_flags}
-D HTTPD_STACK_SIZE=6144
-mfix-esp32-psram-cache-issue ; ← ADD THIS (recommended)
lib_deps = ${esp32-d0-base.lib_deps}
; Core dump flash config is corrupted!What You Should See After the FixAfter adding this and reflashing, the boot log should show: If you see that message, PSRAM is properly initialized and the crash should be gone. Try again with the memory_type setting actually added this time! 😊 🧠 Learnings used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@firmware/esp32-d0.ini`:
- Line 120: The comment next to the board_build.partitions setting is misleading
by claiming default_8MB.csv “doesn't exist”; update the comment to accurately
reflect that default_8MB.csv is provided by the Arduino ESP32 framework
(partitions directory) and remove or replace the “doesn't exist” note — edit the
line referencing board_build.partitions and default_8MB.csv (and any alternate
reference to boards/ESP32_8MB.csv) so the comment correctly states the file is
framework-provided and avoid implying it is missing.
| board = esp32-pico-devkitm-2 ; https://github.com/platformio/platform-espressif32/blob/master/boards/esp32-pico-devkitm-2.json | ||
| board_build.partitions = default_8MB.csv ; boards/ESP32_8MB.csv | ||
| ; see also https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32/esp32-pico-devkitm-2/index.html | ||
| board_build.partitions = default_8MB.csv ;boards/ESP32_8MB.csv ; Fixed: was default_8MB.csv (doesn't exist) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the misleading partition comment.
The comment says default_8MB.csv “doesn't exist,” but the line currently uses that file (which is framework-provided). Please update the comment to avoid confusion. Based on learnings, this file exists under the Arduino ESP32 framework’s partitions directory.
📝 Suggested comment cleanup
-board_build.partitions = default_8MB.csv ;boards/ESP32_8MB.csv ; Fixed: was default_8MB.csv (doesn't exist)
+board_build.partitions = default_8MB.csv ; boards/ESP32_8MB.csv (smaller app partition)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| board_build.partitions = default_8MB.csv ;boards/ESP32_8MB.csv ; Fixed: was default_8MB.csv (doesn't exist) | |
| board_build.partitions = default_8MB.csv ; boards/ESP32_8MB.csv (smaller app partition) |
🤖 Prompt for AI Agents
In `@firmware/esp32-d0.ini` at line 120, The comment next to the
board_build.partitions setting is misleading by claiming default_8MB.csv
“doesn't exist”; update the comment to accurately reflect that default_8MB.csv
is provided by the Arduino ESP32 framework (partitions directory) and remove or
replace the “doesn't exist” note — edit the line referencing
board_build.partitions and default_8MB.csv (and any alternate reference to
boards/ESP32_8MB.csv) so the comment correctly states the file is
framework-provided and avoid implying it is missing.
|
@coderabbitai. regarding
What do you think 👀, of course I did that, just not committed. Now committed. This still resulted in the submitted log, so please redo your analysis looking at the latest commit |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 2934
The Problem: Settings Aren't Being AppliedYour boot log shows: But you've set Also, there are no PSRAM initialization messages at all in your boot log. A successful PSRAM init should show: Why This HappensPlatformIO/ESP-IDF can cache the bootloader and partition table from previous builds. Your new settings (flash_mode, memory_type) require rebuilding the bootloader, not just the application. Solution: Full Clean + Flash EraseDo these steps in order: 1. Clean the build completelypio run -t clean -e esp32-d0-pico22. Erase the entire flash chippio run -t erase -e esp32-d0-pico2Or using esptool directly: esptool.py --port /dev/ttyUSB0 erase_flash # Replace with your port3. Rebuild and uploadpio run -t upload -e esp32-d0-pico2 --verboseThe 4. Check the new boot logAfter these steps, the boot log should show:
Please share the boot log after doing this full clean/erase/rebuild cycle. If it still shows 🧠 Learnings used |
|
@coderabbitai, while flashing with esp home web installer works fine, I got a flash error when trying with vscode / platformio: App Version: 0.8.0 Uploading stub flasher... Hard resetting via RTS pin... A fatal error occurred: The chip stopped responding. What is going on? |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 1976
Critical Issues
The FixAdd these lines to [env:esp32-d0-pico2]
board = esp32-pico-devkitm-2
board_build.partitions = default_8MB.csv
board_build.arduino.memory_type = qio_qspi
board_build.flash_mode = qio
upload_speed = 460800 ; ← ADD THIS (more stable than 921600)
build_flags = ${esp32-d0-base.build_flags}
-D HTTPD_STACK_SIZE=6144
-DBOARD_HAS_PSRAM
-mfix-esp32-psram-cache-issue
lib_deps = ${esp32-d0-base.lib_deps}Why 460800 Instead of 1500000?
Rebuild BootloaderThe flash mode is still # Step 1: Clean everything
pio run -t clean -e esp32-d0-pico2
rm -rf .pio/build/esp32-d0-pico2
# Step 2: Rebuild (this regenerates bootloader with qio settings)
pio run -e esp32-d0-pico2
# Step 3: Upload with new settings
pio run -t upload -e esp32-d0-pico2After this, the upload log should show If It Still FailsTry disabling the stub flasher (slower but more reliable): upload_speed = 460800
upload_flags =
--no-stubOr try an even lower speed: upload_speed = 115200Bottom line: Add 🧠 Learnings used |
|
@coderabbitai, Guru Meditation Error: Core 0 panic'ed (LoadStoreError). Exception was unhandled. Core 0 register dump: Backtrace: 0x40145d28:0x3ffe3b40 0x40145f0a:0x3ffe3b60 0x400e0329:0x3ffe3b80 0x400e13a1:0x3ffe3ba0 0x40142d91:0x3ffe3bf0 0x40152ad6:0x3ffe3c30 0x400824ca:0x3ffe3c60 0x40079786:0x3ffe3c90 |<-CORRUPTED ELF file SHA256: 447d1cfa8 E (1174) esp_core_dump_flash: Core dump flash config is corrupted! CRC=0x7bd5c66f instead of 0x0 |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 2587
The Root CauseAt line 80 in PsychicHttpServer server; // ← Global objectThis global object's constructor:
Critical Missing InformationYour crash log is incomplete! You only shared the crash portion, but I need the beginning of the boot log to verify:
Please share the complete boot log from power-on, starting from the first line (before the crash). Did You Rebuild the Bootloader?The crash moved from Please verify you did this: pio run -t clean -e esp32-d0-pico2
rm -rf .pio/build/esp32-d0-pico2
pio run -e esp32-d0-pico2
pio run -t upload -e esp32-d0-pico2Two Possible ScenariosScenario 1: PSRAM is NOT initializing (bootloader wasn't rebuilt)
Scenario 2: PSRAM IS initializing, but global constructors run too early
Can you please share the full boot log so we can determine which scenario applies? 🔍 🧠 Learnings used |
|
@coderabbitai, okay, I got it working when I removed my trick to redefine new in main.cpp: // Override global new/delete if (!ptr) { return ptr; Bet then as soon as I define the board preset for QuinLED DIG Next 2 (which assigns pins) I got the following crash: ipc0 low on stack. when checking in safe mode ipc0 has 404 bytes and ipc1 474 bytes of free stack. Can you explain what is going on? Logging: [ 15291][I][EventSocket.cpp:46] onWSOpen(): [🐼] ws[192.168.1.168][51] connect Core 0 register dump: Backtrace: 0x40082042:0x3ffb7210 0x40082273:0x3ffb7230 0x40091711:0x3ffb7260 ELF file SHA256: 8d6ebbfd7 Guru Meditation Error: Core 0 panic'ed (Unhandled debug exception). Backtrace: 0x3ffb6f59:0x3ffb6fc0 |<-CORRUPTED ELF file SHA256: 8d6ebbfd7 Re-entered core dump! Exception happened during core dump! |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 15831 🌐 Web query: 💡 Result: Yes — add a -D define in platformio.ini. Example (sets IPC stack to 2048 bytes): [env:esp32dev] Notes:
Sources:
Citations:
Root Cause AnalysisThe QuinLED DIG Next 2 preset assigns 17 GPIO pins (lines 371-390: 12 LED pins, 2 button pins, 2 I2C pins, 3 exposed pins). This creates deeper call stacks during initialization. The crash sequence:
What Are IPC Tasks?IPC (Inter-Processor Call) tasks are ESP-IDF system tasks that handle communication between Core 0 and Core 1. They're used when one core needs to execute code on the other core (e.g., flash operations must suspend both cores). Default IPC stack size is 1024 bytes. With only 404 bytes free, any moderately deep call stack will overflow — especially during WebSocket connections which trigger network processing + JSON parsing + flash operations. Why Other Boards Don't CrashOther boards likely:
404 bytes free is critically low — you're on the edge of overflow constantly. The SolutionIncrease [env:esp32-d0-pico2]
board = esp32-pico-devkitm-2
board_build.partitions = default_8MB.csv
board_build.arduino.memory_type = qio_qspi
board_build.flash_mode = qio
upload_speed = 460800
build_flags = ${esp32-d0-base.build_flags}
-D HTTPD_STACK_SIZE=6144
-DBOARD_HAS_PSRAM
-mfix-esp32-psram-cache-issue
-D CONFIG_ESP_IPC_TASK_STACK_SIZE=2048 ; ← ADD THIS (double the default)
lib_deps = ${esp32-d0-base.lib_deps}Recommended Values
Memory ImpactIncreasing from 1024 → 2048 costs only 2 KB of RAM (1 KB per core for the two IPC tasks). This is negligible compared to your 327 KB total RAM. Why the Cache Error AppearedWhen the IPC task stack overflowed during a flash operation:
This is a secondary symptom — the root cause is the stack overflow. After Applying the FixAfter adding
This aligns with the learning about task stack sizing for high-load scenarios — adequate headroom prevents watchdog timeouts and stack overflows! 🎯 Try the fix and let me know if the crashes stop! 🧠 Learnings used |
|
@coderabbitai, regarding
That is not true, only 2 LED pins. And currently the 2 I2C pins, and 3 exposed pins are not used yet, so I doubt if this is the problem. Moreover, the software runs on all other boards (ESP32-D0, S3 and P4). and regarding
that did not make a difference If I look at the tasks free idc memory, still around 400 bytes. Is this the right command? so could you dig deeper? |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 6067 🏁 Script executed: Length of output: 1736 🌐 Web query: 💡 Result: Short answer — two options.
This defines the Kconfig macro at compile time so IPC task stack = 2048 bytes. (Many users do this for other CONFIG_* overrides.) [1][2]
Notes:
Sources: 🏁 Script executed: Length of output: 5543 🌐 Web query: 💡 Result: Short summary and fixes — cause: task/IPC stacks placed in PSRAM (qio_qspi on PICO) can overflow or crash because PSRAM is slower/non-cacheable for some contexts and certain IDF components (esp_ipc, interrupts, IRAM-required code) expect internal RAM. Address by configuring IDF and allocations:
References:
If you want, tell me your ESP‑IDF version, exact module (ESP32‑PICO‑D4), and a short crash log/backtrace and I’ll give concrete config/patch lines and suggested stack sizes.
The Real Problem: PSRAM Stack AllocationWhen you added
Your crash log confirms this: Why Other Boards Work
The SolutionAdd these flags to force critical system stacks into internal RAM: [env:esp32-d0-pico2]
board = esp32-pico-devkitm-2
board_build.partitions = default_8MB.csv
board_build.arduino.memory_type = qio_qspi
board_build.flash_mode = qio
upload_speed = 460800 ; ← COMMIT THIS (you added locally)
build_flags = ${esp32-d0-base.build_flags}
-D HTTPD_STACK_SIZE=6144
-DBOARD_HAS_PSRAM
-mfix-esp32-psram-cache-issue
-D LOLIN_WIFI_FIX ; ← ADD (from wrover config)
-D ARDUINO_USB_CDC_ON_BOOT=0 ; ← ADD (from wrover config)
-D CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY=0 ; ← ADD (keep IPC/system stacks in internal RAM)
lib_deps = ${esp32-d0-base.lib_deps}What These Flags Do
Alternative: If Still IssuesIf the flag doesn't work (pre-compiled Arduino libs), try switching to dio_qspi instead: board_build.arduino.memory_type = dio_qspi ; ← Use DIO instead of QIO
board_build.flash_mode = dioThis uses fewer pins and may have more conservative PSRAM allocation. Why My Analysis Was Wrong BeforeI incorrectly assumed:
The actual issue is the memory allocation mode, not the task stack size itself. The IPC tasks have 400 bytes free in PSRAM, but they need to be in internal RAM entirely. Try the fix with 🧠 Learnings used |
|
@coderabbitai, regarding
Didn't help still crashes, it crashes not at initial boot, it crashes when I click on the browser to load the UI. It only crashes if pins are allocated, in safemode it doesn't crash |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 7084 🏁 Script executed: Length of output: 26014
The Pin ConflictESP32-PICO QIO flash pins:
ESP32-PICO DIO flash pins:
Your QuinLED DIG Next 2 preset assigns: pinAssigner.assignPin(2, pin_LED); // LED output 1
pinAssigner.assignPin(4, pin_LED); // LED output 2
pinAssigner.assignPin(5, pin_Relay_LightsOn);
pinAssigner.assignPin(20, pin_Relay_LightsOn);
pinAssigner.assignPin(26, pin_I2C_SDA);
pinAssigner.assignPin(27, pin_I2C_SCL);
// ... plus buttons and exposed pinsIt doesn't directly assign GPIO 9 or 10, but here's what happens:
Why Safe Mode WorksSafe mode doesn't allocate pins, so GPIO 9 & 10 remain in their default flash-interface state → No conflict → No crash. The Solution: Switch to DIO ModeThis is exactly the same fix as the WLED-MM issue you referenced! Change to DIO mode: [env:esp32-d0-pico2]
board = esp32-pico-devkitm-2
board_build.partitions = default_8MB.csv
board_build.arduino.memory_type = dio_qspi ; ← CHANGED from qio_qspi
board_build.flash_mode = dio ; ← CHANGED from qio
upload_speed = 460800
build_flags = ${esp32-d0-base.build_flags}
-D HTTPD_STACK_SIZE=6144
-DBOARD_HAS_PSRAM
-mfix-esp32-psram-cache-issue
-D CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY=0
lib_deps = ${esp32-d0-base.lib_deps}Why DIO Fixes It
Why This Matches WLED-MMThe WLED-MM discussion you found was about HUB75 driver conflicts with QIO mode. Your issue is the same root cause: QIO mode's use of GPIO 9 & 10 conflicts with GPIO initialization code, causing flash operation failures. Try the fix above (switch to 🧠 Learnings used |
Summary by CodeRabbit
Documentation
Chores
✏️ Tip: You can customize this high-level summary in your review settings.