@@ -49,13 +49,16 @@ SoftwareSerial::~SoftwareSerial() {
49
49
bool SoftwareSerial::isValidGPIOpin (int8_t pin) {
50
50
#if defined(ESP8266)
51
51
return (pin >= 0 && pin <= 16 ) && !isFlashInterfacePin (pin);
52
- #elif defined(ESP32)
53
52
53
+ #elif defined(ESP32)
54
+ // Remove the strapping pins as defined in the datasheets, they affect bootup and other critical operations
55
+ // Remmove the flash memory pins on related devices, since using these causes memory access issues.
54
56
#ifdef CONFIG_IDF_TARGET_ESP32
55
57
// Datasheet https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf,
56
- // Pinout https://docs.espressif.com/projects/esp-idf/en/latest/esp32/_images/esp32-devkitC-v4-pinout.jpg
57
- return (pin >= 0 && pin <= 5 ) || (pin >= 12 && pin <= 19 ) ||
58
- (pin >= 21 && pin <= 23 ) || (pin >= 25 && pin <= 27 ) || (pin >= 32 && pin <= 39 );
58
+ // Pinout https://docs.espressif.com/projects/esp-idf/en/latest/esp32/_images/esp32-devkitC-v4-pinout.jpg
59
+ return (pin >= 1 && pin <= 1 ) || (pin >= 3 && pin <= 4 ) || (pin >= 13 && pin <= 14 ) ||
60
+ (pin >= 16 && pin <= 19 ) || (pin >= 21 && pin <= 23 ) || (pin >= 25 && pin <= 27 ) ||
61
+ (pin >= 32 && pin <= 39 );
59
62
60
63
#elif CONFIG_IDF_TARGET_ESP32S2
61
64
// Datasheet https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf,
@@ -88,10 +91,10 @@ bool SoftwareSerial::isValidTxGPIOpin(int8_t pin) {
88
91
return isValidGPIOpin (pin)
89
92
#if defined(ESP32)
90
93
#ifdef CONFIG_IDF_TARGET_ESP32
91
- && (pin < 34 )
94
+ && (pin < 34 ) // GPIO34 and above are input only, so cannot transmit
92
95
93
96
#elif CONFIG_IDF_TARGET_ESP32S2
94
- && (pin < 45 )
97
+ && (pin < 46 ) // GPIO46 is an input only, so cannot transmit
95
98
96
99
#elif CONFIG_IDF_TARGET_ESP32C3
97
100
// Nothing to do
0 commit comments