@@ -100,7 +100,8 @@ bool PinManager::allocateMultiplePins(const managed_pin_type * mptArray, byte ar
100100 // as this can greatly simplify configuration arrays
101101 continue ;
102102 }
103- if (!isPinOk (gpio, mptArray[i].isOutput )) {
103+ // allow any GPIO for Ethernet (compile time assigned)
104+ if (!(isPinOk (gpio, mptArray[i].isOutput ) || tag==PinOwner::Ethernet)) {
104105 DEBUG_PRINTF_P (PSTR (" PIN ALLOC: FAIL Invalid pin attempted to be allocated: GPIO %d as %s\n ." ), gpio, mptArray[i].isOutput ? PSTR (" output" ): PSTR (" input" ));
105106 shouldFail = true ;
106107 }
@@ -228,19 +229,18 @@ bool PinManager::isPinOk(byte gpio, bool output)
228229 #else
229230
230231 if ((strncmp_P (PSTR (" ESP32-U4WDH" ), ESP.getChipModel (), 11 ) == 0 ) || // this is the correct identifier, but....
231- (strncmp_P (PSTR (" ESP32-PICO-D2 " ), ESP.getChipModel (), 13 ) == 0 )) { // https://github.com/espressif/arduino-esp32/issues/10683
232+ (strncmp_P (PSTR (" ESP32-PICO-D " ), ESP.getChipModel (), 12 ) == 0 )) { // https://github.com/espressif/arduino-esp32/issues/10683
232233 // this chip has 4 MB of internal Flash and different packaging, so available pins are different!
233- if (((gpio > 5 ) && (gpio < 9 )) || (gpio == 11 ))
234- return false ;
234+ if ((gpio > 5 && gpio < 9 ) || gpio == 11 ) return false ; // U4WDH/PICO-D2 & PICO-D4: GPIO 6, 7, 8, 11 are used for SPI flash; 9 & 10 are free
235+ if (gpio == 16 || gpio == 17 ) return false ; // U4WDH/PICO-D?: GPIO 16 and 17 are used for PSRAM
236+ } else if (strncmp_P (PSTR (" ESP32-PICO-V3" ), ESP.getChipModel (), 13 ) == 0 ) {
237+ if (gpio == 6 || gpio == 11 ) return false ; // PICO-V3: uses GPIO 6 and 11 for flash
238+ if (strstr_P (ESP.getChipModel (), PSTR (" V3-02" )) != nullptr && (gpio == 9 || gpio == 10 )) return false ; // PICO-V3-02: uses GPIO 9 and 10 for PSRAM; 7, 8 are free
235239 } else {
236240 // for classic ESP32 (non-mini) modules, these are the SPI flash pins
237241 if (gpio > 5 && gpio < 12 ) return false ; // SPI flash pins
238242 }
239-
240- if (((strncmp_P (PSTR (" ESP32-PICO" ), ESP.getChipModel (), 10 ) == 0 ) ||
241- (strncmp_P (PSTR (" ESP32-U4WDH" ), ESP.getChipModel (), 11 ) == 0 ))
242- && (gpio == 16 || gpio == 17 )) return false ; // PICO-D4/U4WDH: gpio16+17 are in use for onboard SPI FLASH
243- if (gpio == 16 || gpio == 17 ) return !psramFound (); // PSRAM pins on ESP32 (these are IO)
243+ if (gpio == 16 || gpio == 17 ) return !psramFound (); // PSRAM pins on ESP32-D0WDR2-V3 (these are IO)
244244 #endif
245245 if (output) return digitalPinCanOutput (gpio);
246246 else return true ;
0 commit comments