BBAI64: GPIO numbers

Hello @lorforlinux ,

I know it is late for now. I was up late tonight testing some Capes for the BBAI-64. I found this a while back and remembered it.

First off, how are you doing? Secondly, is there a way figure out the GPIO that works w/ the enable part of the source in this file?

set_pin = Path("/sys/class/gpio/gpiochip496/direction") # Here
set_pin.write_text("out")

Or…would I just search things in the TRM to look for GPIO registers to offset?

Seth

P.S. No rush if you are busy. If you have time, this would be neat to make work.

@lorforlinux ,

Seth here again…

  1. Is there a way to configure the GPIO on the BBAI-64 to have an enable pin GPIO for starting and stopping the PCA9685 onboard the Servo Cape?
  2. If not, and if I have to export the GPIO from some directory/file, what exact GPIO should I use and in which file is this GPIO located.

I will keep searching.

Seth

Okay,

I need my enable pin. What I did was use the older source to find the GPIO_68 or P8_10 on the am335x/BBB board(s). Then, I acted like using the same thought process would work. I went to P8_10 on the BBAI-64 and looked up the correct GPIO location.

How would I export pins on the BBAI-64 board for GPIO use?

Would I just say 1 * 32 + 14 = GPIO_46 or would I use another formula to handle this instance of muxing?

Seth

Hey @silver2row, for exact GPIO numbers checkout the documentation below,

https://docs.beagleboard.io/latest/boards/beaglebone/ai-64/ch07.html

It also contains a little guide section to control the GPIO pins, pasting it below for reference but you should read it on docs and try it out for some pins to understand better.

# to set the GPIO pin state to HIGH
debian@BeagleBone:~$ gpioset X Y=1

# to set the GPIO pin state to LOW
debian@BeagleBone:~$ gpioset X Y=0

For Example:

+---------+----------+
| Pin     | P8.03    |
+=========+==========+
| GPIO    | 1 20     |
+---------+----------+

Use the commands below for controlling this pin (P8.03) where X = 1 and Y = 20

# to set the GPIO pin state to HIGH
debian@BeagleBone:~$ gpioset 1 20=1

# to set the GPIO pin state to LOW
debian@BeagleBone:~$ gpioset 1 20=0

If you want a simple enable disable function via sysfs I would recommend you to go with BONE_LED bus and use the overlay below.

If you are new to overlays on AI-64 you can checkout the link below,

Let me know if that resolves your queries.

1 Like

Hello @lorforlinux ,

Seth here. I think this is the issue. I use the gpiod (Python) or libgpiod-dev (C), either/or really, and the source in Python puts me on an error on output as:

Device or resource busy

Now, I will look at the overlays. Thank you. I will try to update the machine too. Thank you.

Seth

P.S. I am using Python mostly handling import gpiod and this error of sorts keeps popping up.

I thought it was due to the gpiochip or gpio not being listed or available for use to on/off the PCA9685 onboard the Servo Cape. I still think it is b/c of me not being able to establish a connection to the gpiochip via gpiod in Python. I will keep trying. Thank you again for supporting this instance.

I will try that overlay and sysfs and see how far I get!

@lorforlinux ,

Okay. Back to reality. Sorry.

  • I have /sys/class/leds/BONE-LEDS_P8_03.dts now!
  • I built it …
  • I changed it …
  • I am still changing things …

I am installing it and adding it in.

Seth

P.S. I put in a bunch of ideas already. I think permissions are the main issue w/ my system right now. I think, and I know it is probably too late to get into it tonight, something is wrong w/ the Python on the install. I have Python3 in its respectful place, i.e. /usr/bin/. The issue is when I use chmod a+x MyFile.py . Even just +x comes back w/ output stating that:

-bash: ./pwmsOne.py: /usr/bin/python3^M: bad interpreter: No such file or directory

I will look this error up tomorrow. Sorry for all the trouble.

I got it…the overlay BBORG_SERVO-00A2.dtbo works and w/out the enable/disable pin.

I have not quite figured out how to manage the servo(s) well enough yet but one works until it dies (cheap servo).

Probably too much current or power or just a cheap servo motor. Thank you…

Update

The overlay fooled me along w/ the GPIO in question. I thought it was P8_16 but it is not.

Oh and chmod +x and running ./My_File.py creates the above issue in case anyone knows what is going on w/ that idea.

@lorforlinux ,

Sir, check this out…

I have a video of the AI-64 w/ the Servo Cape and it is going from degree 0, to degree 90, and then to the maximum. Which in my case w/ this servo is about 180 degrees. The flask app is running and the source, this html page that is rendered, allows for communication back to the servo via the Servo Cape and source running on the BBAI-64.

Also…changing some permissions proved valuable (I think). A lot of the files so far are only accessed via root. So, instead of running sudo python3 My_File.py, I just used chown to alter the groups and permissions.

Also, the chmod command does nothing so far, i.e. chmod +x My_File.py does not allow for my usage of ./My_File.py for whatever reason. I get that error code from above: The Video!

Seth

P.S. Enjoy and thank you.

@silver2row
Hey Seth,

Your setup looks great, are you using the overlay for the servo cape?
Please let me know if the instructions in the post below works well for you.

Regards,
Deepak Khatri

Hello @lorforlinux ,

Seth here. Yes sir. I am using the overlay under v5.10.x-ti-unified after making the install_arm64.

I will test the post soon. The only issue I found so far is that the GPIO which enables the PCA9685 onboard the Servo Cape stay high no matter if I try to turn it off or on.

I will figure out what I did and reply then…

Seth

P.S. I can show you the files if necessary. So, this way people can find the info easily. I will retire for tonight. I will reread the post.