Skip to content
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

add env for esp32 pico d4 with valid ledpin to prevent bootloops #3573

Closed
wants to merge 1 commit into from

Conversation

driemekasten
Copy link

In recent versions of WLED GPIO 16 is used as the default LEDPIN. This causes bootloops on ESP32 Pico D4 because GPIO 16 is connected to the embedded flash (see notes in ESP32 Pico D4 Datasheet Section 2.2: "Pins IO16, IO17, CMD, CLK, SD0 and SD1 are used to connect the embedded flash, and can not be used for other purposes. For details, please see Section 6 Schematics.").
Added a new environment for Pico D4 (esp32picod4) to platformio.ini with LEDPIN 4 defined as the default (gpio 4 matches my own hardware project, GPIO 2 will also cause no problems). Also changed upload Speed to max. for this env.

…use gpio 16 is connected to flash on pico d4
@blazoncek
Copy link
Collaborator

See considerations in #3569

@softhack007
Copy link
Collaborator

softhack007 commented Dec 6, 2023

Hi,
Similar to @blazoncek, I don't think that adding another buildenv - that only differs in the default ledpin - is the right way to address this problem.

From looking at the pico-D4 datasheet, it seems that gpio 16+17 are not availeable for use, similar to esp32 wrover with PSRAM.

My proposal would be

  • use a custom buildenv (platformio_override.ini), with board = pico32
  • in WLED, we can then check for pico board with #ifdef ARDUINO_ESP32_PICO - and change default pins, as well as block gpio16/17.

https://github.com/platformio/platform-espressif32/blob/develop/boards/pico32.json#L7

It means that only the source code parts shown below would need adjustment. Everything else will come due to board = pico32 in your platformio_override.ini.

WLED/wled00/const.h

Lines 461 to 465 in 1dab26b

#if defined(ESP8266) || (defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_PSRAM)) || defined(CONFIG_IDF_TARGET_ESP32C3)
#define LEDPIN 2 // GPIO2 (D4) on Wemod D1 mini compatible boards
#else
#define LEDPIN 16 // aligns with GPIO2 (D4) on Wemos D1 mini32 compatible boards
#endif

#if defined(ARDUINO_ARCH_ESP32) && defined(BOARD_HAS_PSRAM)

WLED/wled00/wled.cpp

Lines 365 to 368 in 1dab26b

// GPIO16/GPIO17 reserved for SPI RAM
managed_pin_type pins[] = { {16, true}, {17, true} };
pinManager.allocateMultiplePins(pins, sizeof(pins)/sizeof(managed_pin_type), PinOwner::SPI_RAM);
#endif


Edit: if we take care of default pins in the source code, then a custom buildenv for the pico-D4 would be as simple is this

[env:esp32_pico]
extends = env:esp32dev_qio80
board = pico32

@softhack007 softhack007 mentioned this pull request Dec 14, 2023
softhack007 added a commit that referenced this pull request Dec 14, 2023
According to the technical manual, GPIO 16 + 17 are used for onboard flash, so cannot be used by WLED.

example buildenv:

[env:esp32_pico]
extends = env:esp32dev_qio80
board = pico32
@softhack007 softhack007 added fixed in source This issue is unsolved in the latest release but fixed in master workaround The issue contains a workaround labels Dec 14, 2023
softhack007 added a commit to MoonModules/WLED that referenced this pull request Dec 14, 2023
According to the technical manual, GPIO 16 + 17 are used for onboard flash, so cannot be used by WLED.

example buildenv:

[env:esp32_pico]
extends = env:esp32dev_qio80
board = pico32
zanhecht pushed a commit to zanhecht/WLED that referenced this pull request Dec 27, 2023
According to the technical manual, GPIO 16 + 17 are used for onboard flash, so cannot be used by WLED.

example buildenv:

[env:esp32_pico]
extends = env:esp32dev_qio80
board = pico32
@softhack007 softhack007 added the board request PR adding support for a specific board. label Jan 3, 2024
Djelibeybi pushed a commit to Djelibeybi/WLED-MM that referenced this pull request Jan 15, 2024
According to the technical manual, GPIO 16 + 17 are used for onboard flash, so cannot be used by WLED.

example buildenv:

[env:esp32_pico]
extends = env:esp32dev_qio80
board = pico32
JPZV pushed a commit to JPZV/WLED that referenced this pull request Jan 18, 2024
According to the technical manual, GPIO 16 + 17 are used for onboard flash, so cannot be used by WLED.

example buildenv:

[env:esp32_pico]
extends = env:esp32dev_qio80
board = pico32
DedeHai pushed a commit to DedeHai/WLED that referenced this pull request Jan 27, 2024
According to the technical manual, GPIO 16 + 17 are used for onboard flash, so cannot be used by WLED.

example buildenv:

[env:esp32_pico]
extends = env:esp32dev_qio80
board = pico32
@blazoncek
Copy link
Collaborator

This should be no longer necessary as I removed (offending) GPIO16 from default values for ESP32 (it also clashed with C3).
the new default value is GPIO2 or GPIO1 for DMX, If GPIO1 is also occupied by debug build, GPIO3 is used instead..

@blazoncek blazoncek closed this Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
board request PR adding support for a specific board. discussion fixed in source This issue is unsolved in the latest release but fixed in master workaround The issue contains a workaround
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants