ESP32-S2: gpio_pullup_en(GPIO_NUM_xx) does not work correctly (Arduino ESP32 Board manager)

purehunter
Posts: 2
Joined: Sun Jul 13, 2025 5:27 am

ESP32-S2: gpio_pullup_en(GPIO_NUM_xx) does not work correctly (Arduino ESP32 Board manager)

Postby purehunter » Sun Jul 13, 2025 5:55 am

Hi,

it seems to me, the command

Code: Select all

gpio_pullup_en(GPIO_NUM_xx);
does not work for all RTC-GPIOs, or worse: it works only with GPIO 18...

Target is, to wake up the ESP32-S2 with up to 4 different external sources (GPIOs) from deep sleep using

Code: Select all

esp_sleep_enable_ext1_wakeup_io(mask, ESP_EXT1_WAKEUP_ANY_LOW);
For the test I have a bare LOLIN S2-mini board: https://www.wemos.cc/en/latest/s2/s2_mini.html
and I'm probing the GPIO voltage with a multimeter.
There is no additional HW.
I tried this with different HW, as well as different Espressif Board managers for Arduino (3.1.3 and 3.2.0)
According to the -S2 manual it should work with all (RTC-) GPIOs from 0 to 21.

I'running this (stripped) code:

Code: Select all

#include <driver/rtc_io.h>

void setup() {
  esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
  // sample pins
  gpio_pullup_en(GPIO_NUM_16);  // no effect
  gpio_pullup_en(GPIO_NUM_18);  // OK -> GPIO18 = 3V3
  gpio_pullup_en(GPIO_NUM_8);   // no effect
  gpio_pullup_en(GPIO_NUM_10);  // no effect

  delay(10);
  esp_deep_sleep_start();

}

void loop() {
  // put your main code here, to run repeatedly:

}
Very strange. I hope anybody has an idea...

rgds p

boarchuz
Posts: 656
Joined: Tue Aug 21, 2018 5:28 am

Re: ESP32-S2: gpio_pullup_en(GPIO_NUM_xx) does not work correctly (Arduino ESP32 Board manager)

Postby boarchuz » Mon Jul 14, 2025 8:37 am

Try using RTC GPIO functions to configure pullups

purehunter
Posts: 2
Joined: Sun Jul 13, 2025 5:27 am

Re: ESP32-S2: gpio_pullup_en(GPIO_NUM_xx) does not work correctly (Arduino ESP32 Board manager)

Postby purehunter » Mon Jul 14, 2025 10:14 am

@boarchuz
Thanks for your hint!

It took me a while to solve the problem completely, as the defaults of the pin setup parameters are different from pin to pin.
One GPIO is 'usable' w/o any config (18).
Most other pins to be configured as rtc pins and input with pullup is enough.
For GPIO 5 and 21, additionally the pulldown resistor has to be disabled explicitly, or the pullup voltage results in 1.5V. For sure in the end I configured all in the same way.

Coming from Arduino, it was not clear for me that I have to consider this amount of settings. But now I learned something more and it works as expected.

Rgds

Who is online

Users browsing this forum: Barkrowler, Bing [Bot], Semrush [Bot] and 5 guests