Hi experts,
I am currently implementing Linux on BeagleBone-AI and evaluating the GPIO. The GPIO output works fine, but the input is fixed at 0.
Q1: Does BeagleBone-AI have any hardware limitation such as GPIO input is not available?
I have checked on both Ubuntu (18.04.4) and Debian (Image 2019-08-03), and the input value is fixed at 0 even though the input pin is measuring 3.3V.I checked the GPIO register values using devmem2, and the target bit for DATAIN is fixed at 0, even though the target bit for EOI is set correctly.I tested with multiple pins of header 8 and 9 using the following document as a reference, but the result is the same. https://github.com/beagleboard/beaglebone-ai/wiki/System-Reference-Manual#expansion-connectors
The simplest way to check is from the device tree and using Python.
1: Change from device tree
I used P10 and 11 in header 8 and ran the following command.
echo 75 >/sys/class/gpio/export //P8.11 = gpio3_11 echo 74 >/sys/class/gpio/export //P8.12 = gpio3_10 echo "in" >/sys/class/gpio/gpio75/direction echo "out" >/sys/class/gpio/gpio74/direction echo 1 >/sys/class/gpio/gpio74/value cat /sys/class/gpio/gpio75/value 0
In this case, cat /sys/class/gpio/gpio75/direction results in "in".
2: Using Python
We used P8_19 to run the following code.
It's a bit complicated, but the Adafruit-BBIO list seems to be off from the actual pins, so by setting P8_13, I was able to set P8_19 as the actual pin. https://github.com/adafruit/adafruit-beaglebone-io-python/issues/295
>>> import Adafruit_BBIO.GPIO as GPIO
>>> GPIO.setup("P8_13", GPIO.OUT) //現実世界ではP8_19
>>> GPIO.gpio_function("P8_13")
1
>>> GPIO.setup("P8_13", GPIO.IN)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Set gpio mode failed, missing file or invalid permissions.
>>> GPIO.gpio_function("P8_13")
0
>>> GPIO.input("P8_13")
0
As shown above, you can see that the input is set from >>> GPIO.gpio_function("P8_13").
Adafruit-BBIO manual: https://adafruit-beaglebone-io-python.readthedocs.io/en/latest/GPIO.html
If you are using python, some people have seen a similar error code when running GPIO.setup("Px_xx", GPIO.IN), but I have not been able to get to the root of the problem here.
I'm sure I'm just missing something, but I'd appreciate it if you could share any information on how to solve this problem.
On the BeagleBoneBlack, by changing the device tree, I was able to confirm that the input was 1 with a single check...
Best regards,
O.H