Beaglebone AI-64 documentation for GPIO/PWM and Analog pins

I worked extensively with the BeagleBone Black about 5-6 years ago. Due to life happening and other commitments I was not able to do much with it since. I am now at a point that I can get back into working with the Beaglebone and decided to pick up the AI-64.

With the Beaglebone Black I was able to write to the gpio id to the /sys/class/gpio/export file to initialize (not sure if that is the right word to use) the GPIO and then write either ‘in’ or ‘out’ to the direction file. When I started trying to do this with the AI-64 it did not work but I found this post which pointed me to the ‘gpiofind’ utility: AI-64 - GPIO sysfs

I wrote a quick shell script that would run the ‘gpiofind’ for the header pins but I was wondering if there is any documentation on this. I have looked through the beableboard site but haven’t really found much on the AI-64. Looking for something like header diagrams that can be found on this page: BeagleBoard.org - bone101 and something that would list the gpio number. Eventually I will need to get the analog and PWM pins working as well. Can someone point me to this type of documentation specifically for the AI-64?

I want to work towards getting Swift installed on the AI-64 and the redo the SwiftBones framework that I did for the beaglebone black so it will work with the AI-64: GitHub - hoffmanjon/SwiftyBones3: SwiftyBones for Swift 3. Any help and information would be greatly appreciated. As I am just getting back into the Beagleboard, I am trying to dust the cobwebs off in my brain, so please excuse me if I am missing something.

Thank you.

Hello,

I know too little. I am not discrediting your view but…

  1. BeagleBoard.org / BeagleBone AI-64 · GitLab is what I have found recently.
  2. Also, there was a fellow that posted the entire pin muxing for the BBAI-64 somewhere on this forum. For some reason, I cannot find it right away.
  3. I cloned it somewhere. I will see if I can find the actual post.
  4. /dev/bone/
  5. Try some udev rules from the mvduin fellow on github.
  6. Also…
    a. libgpiod is sort of taking over for gpio input/output (sort of). sysfs is still useful but it is hidden in something that is hard to describe to me (.dts files).
    b. Oh and if you go to beagleboard.org and click the icon w/ the BBAI-64 in the header, anywhere on the photo, a few useful links will be available.

Seth

P.S. I goof around at most, i.e. as I do not have a full team of individuals working in tandem. But! I think there will be some good posts about this idea in future months, i.e. as the BBAI-64 is new to me.

About libgpiod and calling it in C/C++ files, I think the preprocessor directive is <gpiod.h>.

And…there is a new way to handle, I think, some calls to peripheral use on the BBAI-64.

So, instead of uboot_overlays in /boot/uEnv.txt, the file is called extlinux.conf.

Here: BeagleBone AI-64: Distro Boot Overview

Also, dually noted here, there is a or was a GSoC participation from an individual and some mentors that came up w/ a rounded way of handling muxing for some of the beagleboard.org boards: Beagleboard:BeagleBone cape interface spec - eLinux.org .

1 Like

Thank you for the reply and I do not think you are discrediting my view at all.

I have looked through the GitLab and beagleboard sites but really didn’t have what I was looking for. I was thinking it may be a little bit before the AI-64 gets more documentation and posts.

The libgpiod, may be exactly what I am looking for. I should be able to use it with the interoperability between C and Swift. That may be the right I start off with. Thank you so much for pointing that out, it is greatly appreciated.

I looked through each of your points but the one I am unsure about is #4 /dev/bone. Are you talking about the directory on the AI-64 itself? Mine just has a part directory in it.

Hello @hoffman.jon ,

Seth here. Also, look here: bbai64-pinmux - Google Sheets . I cloned this pin muxing from a link on this site (this forum).

The /dev/bone/ files usually have some, since GSoC 2022, files for usage in case you wanted to use file descriptors.

Seth

P.S. I will be right back, i.e. I need to give credit to the exact person that made that pin muxing for the BBAI-64. @benedict.hewson was/is his name. He took time out to make this spreadsheet known to users like me.

Thank you for sharing the pin muxing sheet. I really appreciate your help.

1 Like

Hey sir,

Also…if you are looking for a starter script for gpiod.h and libgpiod, look to this fellow for GPIO access to the new method of using GPIOs.

https://github.com/tranter/blogs/tree/master/gpio

It is for another SBC but it is easily ported to the BBB am335x or other boards if people are using libgpiod and gpiod.h in the directives.

Seth

P.S. One of those files are for libgpiod. I forget which one. Also, I made a short on GPIO w/ help from this forum and the IRC persons which can be found here: BBBW_RELAYCAPE/MySecond.c at main · silver2row/BBBW_RELAYCAPE · GitHub .

That file handles the RelayCape and am335x BBB but may be able to be ported to swift in your source along w/ the BBAI-64. It is basically gpiod.h and handling GPIO, though!

ALSO…

I have some source on one of the am335x boards I use.
It handles the "simple" gpiod.h file and an LED.
I can get it and post it if it is of any help.
1 Like

Awesome, thank you for the examples. In Tranter’s GitHub it is Part9/example.c (putting it here for my reference later). It is funny that you should point out Tranter’s GitHub because I was reading the post that goes along with it: GPIO Programming: Exploring the libgpiod Library | ICS

Thank you again for all of your help, this should be exactly what I need. Now I just need the time to put it all together :slight_smile:

1 Like

Hello @hoffman.jon ,

Nice. I found that source a while back and use it to this day for random things, i.e. GPIO in sysfs and libgpiod.

Seth

P.S. look here: Debian 11.x (Bullseye) - Monthly Snapshots (ARM64) - General Discussion - BeagleBoard .

This shows the current overlays on the BBAI-64. # current-built-in-overlays-9 .

Hey @silver2row
Thank you again for all of your help. I was able to build a module for libgpiod in Swift and import it into a test project. Using the following code and it looks like my initial tests are successful:

import gpiod

@main
public struct gpiodtest {
    public private(set) var text = "Hello, World!"

    public static func main() {
        var chipToUse = "gpiochip0"
        if let chip = gpiod_chip_open_by_name(chipToUse) {
            var lineRed = gpiod_chip_get_line(chip, 24);
            gpiod_line_request_input(lineRed, "example1");
            let val = gpiod_line_get_value(lineRed);
            print(val)
        }
        print(gpiodtest().text)
    }
}

Will have to play with it some more to call it a success but for now it looks very promising. I will probably be writing several blog post on my mastering-swift.com blog about getting everything setup. Do you mind if I give you a shout out for all the help?
Thanks again,

1 Like

Hello,

I do not care about credit right now but if you would like, I do not mind one bit. Complements seem to irk me from some reason. I am not quite sure why as of today. Anyway, it is probably b/c I never tried that hard to get success!

Seth

P.S. sure, go for it!