Adafruit_BBIO.PWM doesn't work properly on Debian 11

I’ve been using the

## Fashioned from bb.org-debian-bullseye-iot-v5.10-ti-armhf.conf
##
release="11.4"
image_type="iot"
##
##Debootstrap: https://wiki.debian.org/Debootstrap
##
##debootstrap --arch=${deb_arch} --include=${deb_include} --exclude=${deb_exclude} \
##--components=${deb_components} --foreign ${deb_codename} /tmp/tmp.dir/ http://${deb_mirror}
##
deb_distribution="debian"
deb_codename="bullseye"
deb_arch="armhf"

distribution of the beaglebone firmware up until this point, but have run into some issues with using Adafruit_BBIO.PWM. For any potential pin, i get the following error:

whisperai@BeagleBone:~$ config-pin p8.45 pwm

Current mode for P8_45 is:     pwm

whisperai@BeagleBone:~$ sudo python
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import Adafruit_BBIO.PWM as PWM
>>> PWM.start("P8_45", 50)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: Unknown error

Upon doing some digging, I found related issues here, but it seems those fixes have been merged to Adafruit_BBIO and don’t solve this problem. Looking at the syslog I see that there are some errors with the pwm_dev_path

Nov 14 20:44:01 BeagleBone python[1590]: Adafruit_BBIO: version <unknown> initialized
Nov 14 20:44:05 BeagleBone python[1590]: Adafruit_BBIO: pwm_setup: P9_14 couldn't build pwm_dev_path: 6
Nov 14 20:44:05 BeagleBone python[1590]: Adafruit_BBIO: pwm_start: P9_14 pwm setup failed: 6

but I couldn’t find where pwm_dev_path is set to try to troubleshoot/switch the target to /dev/bone/pwm. I’m trying to revert to Debian 10, but would love a pointer at where to look to tweak this so it works with Debian 11.

1 Like

Please stop using that library, it isn’t maintained anymore…

Once you use config-pin to setup the pwm pins, just work with.

/dev/bone/pwm

Regards,

Oh gotcha, good to know. Is Adafruit_BBIO no longer maintained, or just specifically the PWM (I’ve been able to use the other modules within Adafruit_BBIO successfully)?

Hello,

I found this lib. a while back. I have yet to test it but it handles Linux SBCs like the beaglebone black:

https://github.com/vsergeev/python-periphery

The fellow that produced it has a C instance of the same library. Also, here is another GPIO lib. that seems to be doing well in updates currently:

https://github.com/mvduin/sysfs-gpio

Seth

P.S. I have not been able to keep up w/ the Adafruit_BBIO lib. in some time and I have not used it in a while but it seemed to work when it did work, esp. for PWM, GPIO, UART, and ADC. Also, it may be hard to track down the error in relation to the naming scheme:

https://docs.python.org/3/library/exceptions.html#RuntimeError

I say that b/c who knows what has been done to what in what timeframe in the source, i.e. currently and during its evolution.