Read from a pin set as input/output is high

PhilipK
Posts: 1
Joined: Fri Nov 15, 2024 7:19 am

Read from a pin set as input/output is high

Postby PhilipK » Fri Nov 15, 2024 7:55 am

Hello, I stumbled upon a problem when reading a pin that is set as input/output with pulldown resistor enabled. When the pin is set to logical 0 then read works as expected. But when the pin is set to logical 1 then read is always one. Is this a normal behavior or is it a bug? I use ESP32-S3-WROOM1 MCU with ESP-IDF 5.2.1.

I found a workaround for this problem:
1. Set the output to logical 0.
2. Read the pin level.
3. Set the output to previous value.

I would expect that this should be done in ESP IDF itself because correct read value is valid only if output of input/output pin is set to logical 0.

I hope I address this correctly because I'm not sure if this is a hardware or software issue or it's just a normal behavior.

MicroController
Posts: 1725
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Read from a pin set as input/output is high

Postby MicroController » Fri Nov 15, 2024 8:48 am

Yes, this is normal behavior.
Pull-up and pull-down resistors only have an effect when a pin in either input-only or open drain outputting a logical 1.
Only in open drain output mode (with pull-up resistor) can you expect to read an input value different from the value you output.

Who is online

Users browsing this forum: No registered users and 194 guests