free GPIO17 on "ESP32-D0WDR2-V3" (WLED-MM way)

this is a new "package" with on-chip PSRAM. Only gpio16 is reserved for PSRAM on this chip.
This commit is contained in:
Frank
2026-02-11 11:48:09 +01:00
parent 2bd821789b
commit fef8de000e
3 changed files with 19 additions and 6 deletions

View File

@@ -144,7 +144,8 @@ String PinManagerClass::getPinSpecialText(int gpio) { // special purpose PIN in
//if (gpio == 15) return (F("(strapping pin - MTDO)"));
//if (gpio > 11 && gpio < 16) return (F("(optional) JTAG debug probe"));
#if defined(BOARD_HAS_PSRAM)
if (gpio == 16 || gpio == 17) return (F("(reserved) PSRAM"));
if (gpio == 16) return (F("(reserved) PSRAM"));
if ((gpio == 17) && (strncmp_P(PSTR("ESP32-D0WDR2-V3"), ESP.getChipModel(), 15) != 0) ) return (F("(reserved) PSRAM"));
#endif
#if defined(ARDUINO_TTGO_T7_V14_Mini32) || defined(ARDUINO_LOLIN_D32_PRO) || defined(ARDUINO_ADAFRUIT_FEATHER_ESP32_V2)
if (gpio == 35) return (F("(reserved) _VBAT voltage monitoring")); // WLEDMM experimental
@@ -766,7 +767,8 @@ bool PinManagerClass::isPinOk(byte gpio, bool output) const
// for classic ESP32 (non-mini) modules, these are the SPI flash pins
if (gpio > 5 && gpio < 12) return false; //SPI flash pins
}
//WLEDMM gpio 16/17 (PSRAM or SPI FLASH) are handled differently
// WLEDMM gpio 16/17 (PSRAM or SPI FLASH) are handled differently !
//
// if (((strncmp_P(PSTR("ESP32-PICO"), ESP.getChipModel(), 10) == 0) ||
// (strncmp_P(PSTR("ESP32-U4WDH"), ESP.getChipModel(), 11) == 0))
// && (gpio == 16 || gpio == 17)) return false; // PICO-D4/U4WDH: gpio16+17 are in use for onboard SPI FLASH

View File

@@ -668,8 +668,15 @@ void WLED::setup()
//pinManager.allocateMultiplePins(pins, sizeof(pins)/sizeof(managed_pin_type), PinOwner::SPI_RAM);
#else
// 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);
if (strncmp_P(PSTR("ESP32-D0WDR2-V3"), ESP.getChipModel(), 15) == 0) {
// ESP32-D0WDR2-V3 keeps gpio17 available
managed_pin_type pins[] = { {16, true} };
pinManager.allocateMultiplePins(pins, sizeof(pins)/sizeof(managed_pin_type), PinOwner::SPI_RAM);
} else {
managed_pin_type pins[] = { {16, true}, {17, true} };
pinManager.allocateMultiplePins(pins, sizeof(pins)/sizeof(managed_pin_type), PinOwner::SPI_RAM);
}
#endif
#if defined(BOARD_HAS_PSRAM) && (defined(WLED_USE_PSRAM) || defined(WLED_USE_PSRAM_JSON)) // WLEDMM
if (psramFound()) {

View File

@@ -232,8 +232,12 @@ void appendGPIOinfo() {
//Note: Using pin 3 (RX) disables Adalight / Serial JSON
#if defined(ARDUINO_ARCH_ESP32) && defined(BOARD_HAS_PSRAM)
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32S3) && !defined(CONFIG_IDF_TARGET_ESP32C3)
if (psramFound()) oappend(SET_F(",16,17")); // GPIO16 & GPIO17 reserved for SPI RAM on ESP32 (not on S2, S3 or C3)
#if defined(CONFIG_IDF_TARGET_ESP32) // classic esp32
if (strncmp_P(PSTR("ESP32-D0WDR2-V3"), ESP.getChipModel(), 15) == 0) {
if (psramFound()) oappend(SET_F(",16")); // GPIO16 reserved for SPI RAM on ESP32-D0WDR2-V3
} else {
if (psramFound()) oappend(SET_F(",16,17")); // GPIO16 & GPIO17 reserved for SPI RAM on ESP32 (not on S2, S3 or C3)
}
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
if (psramFound()) oappend(SET_F(",33,34,35,36,37")); // in use for "octal" PSRAM or "octal" FLASH -seems that octal PSRAM is very common on S3.
#endif