ESP32: GPIO1 and GPIO3 pulldown doesn't work?

Hey there!

I’m trying to use GPIO1 and GPIO3 (labelled RXD and TXD) on my board as digital inputs, but I can’t get the pull-down resistors to work. I know these pins are used by the default logger. I’ve tried moving the logger to a different interface (UART1) or disabling (commenting it) entirely, but I still can’t get the pull downs to work.

From reading the data-sheet, I don’t see any reason why it shouldn’t be possible

Controller: ESP32-WROOM-32, Board: ESP DEVKITV1

My Home Assistant dashboard shows 8 binary sensors (I can’t show a screenshot as a user, I’m limited to a single attachment).

  • The first 6 binary sensors work as expected: default off, and turn on when I short them to 3.3v.
  • The last two pins show up as on by default, and only turn off when I short them to ground (which I probably shouldn’t be doing haha).

Is there something I’m missing here?

YAML:

esphome:
  name: garage-door

esp32:
  board: esp32dev
  framework:
    type: esp-idf
    version: recommended

# Enable logging
logger:
  # Use UART1 instead of default (UART1), which uses GPIO9 (Tx) GPIO10 (Rx), neither of which are exposed on the dev board pins.
  hardware_uart: UART1
  level: VERY_VERBOSE

api: # <redacted>
ota: # <redacted>
wifi: # <redacted>

binary_sensor:
  - platform: gpio
    id: dev_level_shifter_b8
    name: (dev) Level shifter B8 (D4)
    pin: 
      number: GPIO04 # D4
      mode: { input: true, pulldown: true }

  - platform: gpio
    id: dev_level_shifter_b7
    name: (dev) Level shifter B7 (RX2)
    pin:
      number: GPIO16 # RX2
      mode: { input: true, pulldown: true }

  # Skipping GPIO5, it's a boot-strapping pin

  - platform: gpio
    id: dev_level_shifter_b6
    name: (dev) Level shifter B6 (TX2)
    pin:
      number: GPIO17 # TX2
      mode: { input: true, pulldown: true }

  - platform: gpio
    id: dev_level_shifter_b5
    name: (dev) Level shifter B5 (D18)
    pin:
      number: GPIO18 # D18
      mode: { input: true, pulldown: true }

  - platform: gpio
    id: dev_level_shifter_b4
    name: (dev) Level shifter B4 (D19)
    pin:
      number: GPIO19 # D19
      mode: { input: true, pulldown: true }

  - platform: gpio
    id: dev_level_shifter_b3
    name: (dev) Level shifter B3 (D21)
    pin:
      number: GPIO21 # D21
      mode: { input: true, pulldown: true }

  - platform: gpio
    id: dev_level_shifter_b2
    name: (dev) Level shifter B2 (RX0)
    pin:
      number: GPIO3 # RX0
      inverted: false
      mode: { input: true, pulldown: true }

  - platform: gpio
    id: dev_level_shifter_b1
    name: (dev) Level shifter B1 (TX0)
    pin:
      number: GPIO1 # TX0
      inverted: false
      mode: { input: true, pulldown: true }

Those two GPIOs won’t prevent the ESP from booting if pulled low but they’re not great choices. See the table on this page: ESP32 Pinout Reference: Which GPIO pins should you use? | Random Nerd Tutorials

If you have other GPIOs available you should use them.

Indeed, and from what I can tell, they have internal pullups that can’t be disabled. I ended up using other pins instead.