BB-AI64 GPIO basics

Hello,

I am trying to toggle GPIO outputs with my BB-AI64. I have the latest install from ARM64 - Debian 11.x (Bullseye) - Monthly Snapshots - 2023-09-02 and got a wifi module up and running (AX210).

With no mods to the system, apart from the wpa_supplicant for the wifi, I am trying to do a basic GPIO output control. So far, when observing the line on the scope (probe into P8), all I get is 750mV, so High-Z on the line. I tried multiple pins on P8 and P9 and always get the same result.

In the following two attempts , I probe pin 7 of connector P8 and never see any activity, always 750mV.

Method 1: from the documentation at:
https://docs.beagleboard.io/latest/boards/beaglebone/ai-64/ch07.html

debian@BeagleBone-AI64:~$ gpioinfo | grep P8_07
        line  15:      "P8_07"       unused   input  active-high
debian@BeagleBone-AI64:~$ gpiodetect
gpiochip0 [42110000.gpio] (84 lines)
gpiochip1 [600000.gpio] (128 lines)
gpiochip2 [601000.gpio] (36 lines)
debian@BeagleBone-AI64:~$ gpiofind P8_07
gpiochip1 15
debian@BeagleBone-AI64:~$ gpioset 1 15=1
debian@BeagleBone-AI64:~$ gpioset --mode=wait 1 15=1
^C
debian@BeagleBone-AI64:~$

->> scope trace for P8 pin 7 always stays Hi-Z

debian@BeagleBone-AI64:~$ gpioinfo | grep P8_07
        line  15:      "P8_07"       unused  output  active-high
debian@BeagleBone-AI64:~$

Method 2: from the post AI-64 - GPIO sysfs

debian@BeagleBone-AI64:~$ gpiodetect
gpiochip0 [42110000.gpio] (84 lines)
gpiochip1 [600000.gpio] (128 lines)
gpiochip2 [601000.gpio] (36 lines)
debian@BeagleBone-AI64:~$ gpiofind P8_07
gpiochip1 15
debian@BeagleBone-AI64:~$ ls -ltr /sys/class/gpio/gpiochip*
lrwxrwxrwx 1 root root 0 Jan  1  1970 /sys/class/gpio/gpiochip428 -> ../../devices/platform/bus@100000/bus@100000:bus@28380000/42110000.gpio/gpio/gpiochip428
lrwxrwxrwx 1 root root 0 Jan  1  1970 /sys/class/gpio/gpiochip300 -> ../../devices/platform/bus@100000/600000.gpio/gpio/gpiochip300
lrwxrwxrwx 1 root root 0 Jan  1  1970 /sys/class/gpio/gpiochip264 -> ../../devices/platform/bus@100000/601000.gpio/gpio/gpiochip264
debian@BeagleBone-AI64:~$ echo 315 > /sys/class/gpio/export
debian@BeagleBone-AI64:~$ ls /sys/class/gpio/
export  gpio315  gpiochip264  gpiochip300  gpiochip428  unexport
debian@BeagleBone-AI64:~$ echo out > /sys/class/gpio/gpio315/direction
debian@BeagleBone-AI64:~$ echo 1 > /sys/class/gpio/gpio315/value
debian@BeagleBone-AI64:~$

->> scope trace for P8 pin 7 always stays Hi-Z

I’m thinking I am missing a step to enable the outputs? Any suggestion or pointer to the right documentation would be appreciated!

Thank you

Hi Xtof,

I am able to toggle the pin voltage of P8_07.
Can you able to do below steps and check again like installing libgpiod library.
git clone GitHub - brgl/libgpiod: NOTE - this project is now hosted at kernel.org and the development happens on the linux-gpio mailing list.
gpioset 1 15=1 ---->3.3v
gpioset 1 15=0 ---->0.0V

Regards
Manan Jarsania

Thanks, Manan, for trying it out and getting back to me! I thought it should work… strange.

I had libgpiod installed but I still re-built it from the git repo and same thing: the commands execute but the scope trace stays around 600mV to 700mV like it’s a floating input. But as shown in my post above, gpioinfo returns “output” for that pin after gpioset is run.

Here’s a picture of my simple “Hello world” setup:

Any suggestion would be great!

Thanks.

Hi xtof,

Actually I have 2 AI-64 board. In 1 board I have checked and replied.
But when I checked on another board. Same issue I faced.

I don’t know what to do.
At least we can comment on the discord channel as well.
please make a login and comment there. I will also ask same thing.

BeagleBoard.org.

Regards
Manan

1 Like

Well, I somewhat feel better that it’s not just me! I want to try a few things first, maybe someone will have ideas by then, but if not, that’s a good idea, we can take it over to Discord then.
Thanks!

GPIO is not working with the newer firmware. I found that bbai64-emmc-flasher-debian-11.6-minimal-arm64-2023-04-06-4gb.img.xz was the latest to still have working GPIO. You can grab it at Index of /rootfs/bb.org/testing/2023-04-06/bullseye-minimal-arm64.

Burn that image to a microSD using rufus or something. Plug that microSD in, power on your bbai64 while holding down the boot button. Keep holding that button down until the LEDs start going crazy, will take about 10 seconds. Next you’ll have to wait about 5 - 10 minutes. After the LEDs stop going crazy unplug the board, remove the microSD, and then start the board back up.

Somewhere along the line, the GPIO stuff in the devicetree went missing and the GPIOs stopped working.

	/* Dummy driver to request setup for cape header pins */
	cape_header: pinmux_dummy {
		compatible = "gpio-leds";
		pinctrl-names = "default";
		pinctrl-0 = <
			&P8_03_default_pin
			&P8_04_default_pin
			&P8_05_default_pin
			&P8_06_default_pin
			&P8_07_default_pin
			&P8_08_default_pin
			&P8_09_default_pin
			&P8_10_default_pin
			&P8_11_default_pin
			&P8_12_default_pin
			&P8_13_default_pin
			&P8_14_default_pin
			&P8_15_default_pin
			&P8_16_default_pin
			&P8_17_default_pin
			&P8_18_default_pin
			&P8_19_default_pin
			&P8_20_default_pin
			&P8_21_default_pin
			&P8_22_default_pin
			&P8_23_default_pin
			&P8_24_default_pin
			&P8_25_default_pin
			&P8_26_default_pin
			&P8_27_default_pin
			&P8_28_default_pin
			&P8_29_default_pin
			&P8_30_default_pin
			&P8_31_default_pin
			&P8_32_default_pin
			&P8_33_default_pin
			&P8_34_default_pin
			&P8_35_default_pin
			&P8_36_default_pin
			&P8_37_default_pin
			&P8_38_default_pin
			&P8_39_default_pin
			&P8_40_default_pin
			&P8_41_default_pin
			&P8_42_default_pin
			&P8_43_default_pin
			&P8_44_default_pin
			&P8_45_default_pin
			&P8_46_default_pin
			&P9_11_default_pin
			&P9_12_default_pin
			&P9_13_default_pin
			&P9_14_default_pin
			&P9_15_default_pin
			&P9_16_default_pin
			&P9_17_default_pin
			&P9_18_default_pin
			&P9_19_default_pin
			&P9_20_default_pin
			&P9_21_default_pin
			&P9_22_default_pin
			&P9_23_default_pin
			&P9_24_default_pin
			&P9_25_default_pin
			&P9_26_default_pin
			&P9_27_default_pin
			&P9_28_default_pin
			&P9_29_default_pin
			&P9_30_default_pin
			&P9_31_default_pin
			&P9_33_default_pin
			&P9_35_default_pin
			&P9_36_default_pin
			&P9_37_default_pin
			&P9_38_default_pin
			&P9_39_default_pin
			&P9_40_default_pin
			&P9_41_default_pin
			&P9_42_default_pin
		>;
	};

The contents of the k3-j721e-beagleboneai64-bone-buses.dtsi file were different between the previous and current versions.

When I applied the above code to the dtsi and created the dtb file, the GPIOs worked fine.

4 Likes

To document the steps for non-software experts who like myself might have a hard time figuring out where the files that need edited are hiding and how to apply the changes (and if applicable to gather feedback on how to do it better), here is what I ended up doing to get it working on a clean install, based on the great feedback from all who responded to this thread:

  1. Flash recent image: bbai64-emmc-flasher-debian-11.8-xfce-arm64-2024-01-11-10gb.img.xz found at https://rcn-ee.com/rootfs/debian-arm64-11-bullseye-xfce-v5.10-ti/2024-01-11/

  2. Set up network (I use a wifi card so I set up my wifi ssid/password in /etc/wpa_supplicant/wpa_supplicant-wlan0.conf) so you can transfer files to the BBAI64.

  3. Grab k3-j721e-beagleboneai64-bone-buses.dtsi from a pre-March 2023 image that includes the missing section documented above:
    k3-j721e-beagleboneai64-bone-buses.dtsi (44.6 KB)
    And use it to replace the one already in /opt/source/dtb-5.10-ti/src/arm64

  4. In directory /opt/source/dtb-5.10-ti/ run:

sudo make clean
sudo make
sudo make install_arm64

  1. reboot

I guess the existing /opt/source/dtb-5.10-ti/src/arm64/k3-j721e-beagleboneai64-bone-buses.dtsi could be edited to add the missing section but it’s a large file so it was easier to simply replace it.

Thanks again to all who helped!

2 Likes

It turns out GPIO is disabled by default with intent. With all GPIOs enabled by default, overlays were getting stomped on. The current correct thing to do is to make a custom overlay for the GPIO pins you want to enable.

Link to chat with @RobertCNelson on this: Discord #beaglebone-ai-64
Little bit of info on making a custom GPIO overlay: BeagleBone cape interface spec — BeagleBoard Documentation

2 Likes