Enabling RTC GPIO Pullup resistors
Posted: Sun Mar 10, 2019 7:20 pm
Goal: to enable RTC GPIO pullup resistors in deep sleep (to save a lot of potentially extra resistors).
As best I can tell, in the Espressif IDF one can use rtc_gpio_pullup_enable(pin) to enable the pullup resistor, and keep it enabled in deep sleep. There are similar functions for the pulldown resistor, and also some necessary functions to "disconnect" the pin from the RTC later, but enabling the pullup in deep sleep certainly seems possible.
It also seems possible in the Arduino ESP32 core (rtc_io.h), but that header contains the comment "* This function only works for RTC IOs. In general, call gpio_pullup_en, which will work both for normal GPIOs and RTC IOs," which suggests that simply calling pinMode(WAKEUP_PIN, INPUT_PULLUP) ought to achieve the desired effect. I'm in the process of testing that, but I would be grateful if someone could confidently provide guidance about how to reliably maintain the RTC GPIO pullup (or pulldown) resistors during deep sleep, so that I don't have to rely on (sometimes incorrect) empirical evidence.
Any code examples?
Thanks!
As best I can tell, in the Espressif IDF one can use rtc_gpio_pullup_enable(pin) to enable the pullup resistor, and keep it enabled in deep sleep. There are similar functions for the pulldown resistor, and also some necessary functions to "disconnect" the pin from the RTC later, but enabling the pullup in deep sleep certainly seems possible.
It also seems possible in the Arduino ESP32 core (rtc_io.h), but that header contains the comment "* This function only works for RTC IOs. In general, call gpio_pullup_en, which will work both for normal GPIOs and RTC IOs," which suggests that simply calling pinMode(WAKEUP_PIN, INPUT_PULLUP) ought to achieve the desired effect. I'm in the process of testing that, but I would be grateful if someone could confidently provide guidance about how to reliably maintain the RTC GPIO pullup (or pulldown) resistors during deep sleep, so that I don't have to rely on (sometimes incorrect) empirical evidence.
Any code examples?
Thanks!