Page 1 of 1

Why are GPIOs 34 and 35 always LOW ?

Posted: Mon Jul 19, 2021 1:32 pm
by GeorgeFlorian1
I have a WROVER-B and I am trying to use GPIO32,33,34 and 35 as buttons. So when I press the button, it should put the pin to LOW.

The problem is that GPIO 34 and 35 are always LOW.

Code: Select all

#define RST_BUTTON 33
#define Input_1 32
#define Input_2 34
#define Input_3 35

 pinMode(RST_BUTTON, INPUT);
  pinMode(Input_1, INPUT);
  pinMode(Input_2, INPUT);
  pinMode(Input_3, INPUT);
  delay(50);

  digitalWrite(RST_BUTTON, HIGH);
  digitalWrite(Input_1, HIGH);
  digitalWrite(Input_2, HIGH);
  digitalWrite(Input_3, HIGH);
  delay(50);
GPIO 32 and 33 act correctly (go LOW only when being pressed) but GPIO 34 and 35 are always LOW even though they aren't being pressed.

I did connect external Pull-up resistors to 34 and 35. They are still always LOW.

Why ?

Re: Why are GPIOs 34 and 35 always LOW ?

Posted: Mon Jul 19, 2021 2:14 pm
by pipi61
Input only pins
GPIOs 34 to 39 are GPIs – input only pins. These pins don’t have internal pull-ups or pull-down resistors. They can’t be used as outputs, so use these pins only as inputs:
GPIO 34
GPIO 35
GPIO 36
GPIO 39
https://randomnerdtutorials.com/esp32-p ... nce-gpios/
use external pullup resistors

Re: Why are GPIOs 34 and 35 always LOW ?

Posted: Tue Jul 20, 2021 11:14 am
by GeorgeFlorian1
pipi61 wrote:
Mon Jul 19, 2021 2:14 pm
Input only pins
GPIOs 34 to 39 are GPIs – input only pins. These pins don’t have internal pull-ups or pull-down resistors. They can’t be used as outputs, so use these pins only as inputs:
GPIO 34
GPIO 35
GPIO 36
GPIO 39
https://randomnerdtutorials.com/esp32-p ... nce-gpios/
use external pullup resistors
Thanks.
I did connect external PullUp resistors. They are still always LOW.

Re: Why are GPIOs 34 and 35 always LOW ?

Posted: Tue Jul 20, 2021 12:56 pm
by pipi61
pinMode(GPIO, OUTPUT);
digitalWrite(GPIO, STATE);
---
pinMode(GPIO, INPUT); or INPUT_PULLUP INPUT_PULLDOWN
xxx=digitalRead(GPIO);
---
If the pin is configured as an INPUT, digitalWrite() will enable (HIGH) or disable (LOW) the internal pullup on the input pin. It is recommended to set the pinMode() to INPUT_PULLUP to enable the internal pull-up resistor. See the Digital Pins tutorial for more information. https://www.arduino.cc/reference/en/lan ... italwrite/

Re: Why are GPIOs 34 and 35 always LOW ?

Posted: Tue Jul 20, 2021 2:47 pm
by GeorgeFlorian1
pipi61 wrote:
Tue Jul 20, 2021 12:56 pm
pinMode(GPIO, OUTPUT);
digitalWrite(GPIO, STATE);
---
pinMode(GPIO, INPUT); or INPUT_PULLUP INPUT_PULLDOWN
xxx=digitalRead(GPIO);
---
If the pin is configured as an INPUT, digitalWrite() will enable (HIGH) or disable (LOW) the internal pullup on the input pin. It is recommended to set the pinMode() to INPUT_PULLUP to enable the internal pull-up resistor. See the Digital Pins tutorial for more information. https://www.arduino.cc/reference/en/lan ... italwrite/
I am using GPIO 34 and 35 which do not have internal resistors. I have added external pull-up resistors.
I have written GPIO 34 and 35 as such:

Code: Select all

#define Input_2 34
#define Input_3 35

pinMode(Input_2, INPUT);
pinMode(Input_3, INPUT);
delay(50);

digitalWrite(Input_2, HIGH);
digitalWrite(Input_3, HIGH);
delay(50);
Yet, they are always LOW.

Re: Why are GPIOs 34 and 35 always LOW ?

Posted: Wed Jul 21, 2021 6:30 pm
by pipi61
You are in write mode only.
gpio34/35 INPUT only (without pullup)
if you need to check the pin state use the
pinMode(GPIO, INPUT);
xxx=digitalRead(GPIO); if you need to check the pin status, use
-------
digitalWrite(..) can only be used for output pins, then you can set the output voltage level to high or low.

Re: Why are GPIOs 34 and 35 always LOW ?

Posted: Thu Jun 09, 2022 7:11 am
by Chandu
I have an ESP32-WROVER-E and I am trying to use GPIO 34,36 and 39 as buttons. So when I press the button, it should put the pin to LOW and high and vice versa. The problem is that GPIO 34,36 and 39 are always LOW.

we configured the pins as input pins and tried to read the pin status using the ESP IDF read function, gpio_get_level().
we observe the pin reads 0 all the time. We tried connecting pull-up resistors at each pin but didn't help.
if any one of you have any suggestions that might help reading the pins? let us know.

Re: Why are GPIOs 34 and 35 always LOW ?

Posted: Sun Jun 12, 2022 4:24 pm
by sivar2311
I guess your wiring is wrong
GPIOs 34,35,36 and 39 needs external pullup or pulldown resistors.
The code to initialize these pins is

Code: Select all

  pinMode(34, INPUT);
  pinMode(35, INPUT);
  pinMode(36, INPUT);
  pinMode(39, INPUT);
The code to read these pins is

Code: Select all

  bool gpio_34_state = digitalRead(34);
  bool gpio_35_state = digitalRead(35);
  bool gpio_36_state = digitalRead(36);
  bool gpio_39_state = digitalRead(39);
There are no digitalWrite involved.

The state interpretation (pressed or released) depends on the selected wiring.

Pull-Up:
HIGH = released
LOW = pressed

Pull-Down:
HIGH = pressed
LOW = released

Here is the PULL-UP wiring:
PULLUP.png
PULLUP.png (146.28 KiB) Viewed 19062 times
Here is the PULL-DOWN wiring:
Pulldown.png
Pulldown.png (150.52 KiB) Viewed 19062 times

Re: Why are GPIOs 34 and 35 always LOW ?

Posted: Sun Jun 12, 2022 11:15 pm
by savage
Chandu wrote:
Thu Jun 09, 2022 7:11 am
we configured the pins as input pins and tried to read the pin status using the ESP IDF read function, gpio_get_level().
If you are not initializing the pin through gpio_config(), try a call to gpio_reset_pin() before setting the pin direction and reading the pin. Some pins are not connected to the IOMUX at startup and gpio_config() & gpio_reset_pin() are the only IDF functions that will do that for you.