Forums » Software Development »
Can't read state of output GPIO pins
Added by Tim Troester about 9 hours ago
Hi,
On an AM62x we have a gpio pin (/dev/gpiochip2, line 10) muxed as an output pin. Our application checks the state of this pin to see if it is in the desired state before setting it if needed. Unfortunately the pin state is always reported as off (0) regardless of what it was actually set to. We tried another pin on the same chip and it has the same behavior.
These same API calls works on another platform.
Here is the output of 'uname -a':
Linux mitysom-am62x-ep00119 6.12.43-g-rt-g26975df2e66f-dirty #1 SMP PREEMPT_RT Tue Dec 30 20:22:52 UTC 2025 aarch64 GNU/Linux
The .dts entry we have for this pin is:
AM62X_IOPAD(0x01a0, PIN_OUTPUT_PULLUP, 7) /* (E18) MCASP0_AXR0.GPIO1_10 - ADBSG COMM PCM 3.3V CTRL */
Any ideas what might be the issue?
Our team created a few test scripts to demonstrate the issue in case that helps. The .cpp program uses gpio v2 API and the bash script uses sysfs. Both show the same issue.
Tim
| gpio_read_output_test_cpp20.cpp (2.9 KB) gpio_read_output_test_cpp20.cpp | C++ 20 test program demonstrating the issue | ||
| gpio_read_output_test.sh (733 Bytes) gpio_read_output_test.sh | bash script demonstrating the issue |
Replies (1)
RE: Can't read state of output GPIO pins - Added by Jonathan Cormier about 9 hours ago
At least for the AM62x, Pins that need to be read, must be pinmuxed as PIN_INPUT*. The only difference between the PIN_OUTPUT and PIN_INPUT #define is whether the input buffer is enabled.
#define PIN_OUTPUT (INPUT_DISABLE | PULL_DISABLE) ... #define PIN_INPUT (INPUT_EN | PULL_DISABLE)