Skip to content

Fix pinMode pulls not driven on ESP-IDF v6 (SOC_GPIO_SUPPORT_RTC_INDEPENDENT removed) - #253

Merged
lovyan03 merged 1 commit into
m5stack:developfrom
ainyan03:rtcio_pull_fix
Aug 15, 2026
Merged

Fix pinMode pulls not driven on ESP-IDF v6 (SOC_GPIO_SUPPORT_RTC_INDEPENDENT removed)#253
lovyan03 merged 1 commit into
m5stack:developfrom
ainyan03:rtcio_pull_fix

Conversation

@ainyan03

Copy link
Copy Markdown
Contributor

ESP-IDF v6 removed the SOC_GPIO_SUPPORT_RTC_INDEPENDENT soc capability macro. pinMode() treated the missing macro as 0, which routes RTC-capable pins through the RTC-domain pull path that is only appropriate for the plain ESP32. On ESP32-S2/S3 (and other chips whose digital pads are independent of the RTC domain) that path does not drive the pad pulls at all: input_pullup left the IO_MUX FUN_PU bit clear and the line never rose. Anything relying on pinMode pulls without an external resistor — e.g. the software I2C probing used by board autodetection — silently loses its pull-ups on ESP-IDF v6.

Fix

Map the capability to an internal LGFX_GPIO_RTC_INDEPENDENT macro: use the SoC-provided value when available (ESP-IDF v5 and earlier), otherwise derive it from the build target — only the plain ESP32 needs the RTC path. This mirrors the internal GPIO_RTCIO_ARE_INDEPENDENT logic ESP-IDF v6 itself uses, and avoids re-defining a macro that ESP-IDF has officially retired.

Verification

Measured on M5StopWatch (ESP32-S3) with a floating RTC-capable pin (GPIO4), applying input_pullup / input_pulldown / input and reading back the input level and the IO_MUX pull bits:

ESP-IDF v5.5.4 v6.0.1 before v6.0.1 after
input_pullup high, FUN_PU=1 low, FUN_PU=0 high, FUN_PU=1
  • No regression on v5.5.4 (macro still provided by the SoC caps → same value as before)
  • No behavior change for the plain ESP32 (derivation yields 0, matching the previous state)
  • Builds: Arduino-ESP32 2.x / 3.x (esp32, esp32s3), ESP-IDF v6.0.1 (esp32, esp32s2, esp32s3), v5.5.4 (esp32s3)
  • CI on the fork: build workflows green

…PENDENT removed)

ESP-IDF v6 removed the SOC_GPIO_SUPPORT_RTC_INDEPENDENT soc capability
macro. pinMode treated the missing macro as 0, which routes RTC-capable
pins through the RTC-domain pull path meant for the plain ESP32. On
ESP32-S2/S3 (and other chips with independent digital pads) that path
does not drive the pad pulls: input_pullup left the IO_MUX FUN_PU bit
clear and the line did not rise.

Map the capability to an internal LGFX_GPIO_RTC_INDEPENDENT macro that
uses the SoC value when available and otherwise derives it from the
build target: only the plain ESP32 needs the RTC path.

Verified on ESP32-S3 (floating RTC-capable pin, ESP-IDF v6.0.1):
input_pullup previously read back low with FUN_PU clear; with this fix
the pull-up is driven and the pin reads high. No regression on v5.5.4
(macro still provided by the SoC caps) and no behavior change for the
plain ESP32.
@lovyan03
lovyan03 merged commit 2c2385b into m5stack:develop Aug 15, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants