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.
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.
@silver2row, Congrats on getting this working.
Do you know if there was a regression in the i2c driver? Is your version still working? Did you do anything special to get it to work?
Some months ago, I purchased a ServoCape to learn about devicetree overlays and i2c. Just this morning I tried to fire it up but, ran into the same issue that @eileen ran into here.
Thanks for any tips.
Fred
1 Like
Hello,
@FredEckert , for smbus2 (pure python3), there are some guidance instructions here: GitHub - silver2row/ServoCape: Servo Cape for the BeagleBone Black .
I fellow named Ben helped me a lot on this project.
So far, I can control servos…
I also made a small write up on Hackster.io: BeagleBone AI-64, Servo Cape, and Making Motors Move! - Hackster.io
The second link, the one to the hackster.io page online, has a small back and forth on the bottom of the instructional.
It may give some extra clues.
Seth
P.S. If it does not work, just go ahead and give some commands on:
cat /etc/dogtag
and…
uname -a
I will post some more in time.
Seth, Thanks for this info. I will check it all out. I just saw that @lorforlinux is going to test everything on the latest linux image. I will standby for his update.
Fred
1 Like
No issue Fred,
Seth here once more…
@lorforlinux may be in some upper management of handling DTS and kernel DTS configs w/ u-boot. @lorforlinux , are you? Anyway, I hope things go well.
That was a small write up on what I have found so far. W/ the .dts for the automatically found or not found dtbo, it works out of the box.
Seth
Hello,
One year ago and still looking to make things work…
Whatever happened then, used to work. I can retest if people are still having issues with the build and making servos moving.
I see in 5.10.x-ti-unified overlays, there is a small .dts compiled into a .dtbo for use in /boot/firmware/extlinux/extlinux.conf
.
Although I sort of moved on because of the supporting factors, I will reignite the concern around the Servo Cape and we can try to help one another again!
Seth
P.S. One year and stuff has changed a bit! 2024! It is a new year with tons of grass to mow. So, outside of my boring grass cutting abilities, I will make some time for the Servo Cape again. Who knows? We may find out what has changed and what has stayed the same…
Update
- /boot/firmware/overlays/BONE-I2C2.dtbo does not work for i2c-2 in
/dev/i2c-2
after installing python3-smbus2
from Debian Bookworm releases and not with using python3-venv after sourcing it for an install via pip3 for smbus2
.
- I am trying with the overlay now…updates on the way.
Another Update
- the overlays file has
BBORG_SERVO-00A2.dtbo
- That .dbto does not help me at all for whatever reason
- I guess maybe I lost my touch since last year or something has changed that is not known to me…