Fix pinMode pulls not driven on ESP-IDF v6 (SOC_GPIO_SUPPORT_RTC_INDEPENDENT removed) - #253
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ESP-IDF v6 removed the
SOC_GPIO_SUPPORT_RTC_INDEPENDENTsoc 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_pullupleft the IO_MUXFUN_PUbit clear and the line never rose. Anything relying onpinModepulls 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_INDEPENDENTmacro: 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 internalGPIO_RTCIO_ARE_INDEPENDENTlogic 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/inputand reading back the input level and the IO_MUX pull bits:input_pullupFUN_PU=1FUN_PU=0FUN_PU=1