Open Gadgetoid opened 1 year ago
Totals | |
---|---|
Change from base Build 1820718973: | 21.2% |
Covered Lines: | 79 |
Relevant Lines: | 83 |
Okay looks like on Ubuntu Pi 4 (and probably 5) /dev/gpiochip0
is accessible to the "dialout" group, whereas /dev/gpiochip1
is not. Any attempt to enumerate chips might hit the second one and fail, need to catch permissions errors.
ls -hal /dev/gpiochip*
crw-rw----+ 1 root dialout 254, 0 Oct 13 15:58 /dev/gpiochip0
crw------- 1 root root 254, 1 Oct 13 15:58 /dev/gpiochip1
Hi,
Short question about compatibility of the blinkt
library with Pi5: As far as I've understood from other discussions like this one, the RPi.GPIO
library doesn't have support for the Pi5 yet. And as this packages uses the RPi.GPIO library, this PR alone will not be enough to make the blinkt
library directly usable on the Pi5 right?
There seem to be some intermediate fixes, e.g. dropping in the rpi-lgpio
library. I have to get access to a Pi5 first, but will report whether that worked for us.
Thanks in advance!
this PR alone will not be enough to make the
blinkt
library directly usable on the Pi5 right?
It should work. I even went so far as to test Blinkt! on not-a-Pi devices which have never supported RPi.GPIO.
Some of the finer points of finding the right GPIO interface and lines remain an open question, so I'd be very interested in your feedback if you get a chance to try this library.
this PR alone will not be enough to make the
blinkt
library directly usable on the Pi5 right?It should work. I even went so far as to test Blinkt! on not-a-Pi devices which have never supported RPi.GPIO.
Some of the finer points of finding the right GPIO interface and lines remain an open question, so I'd be very interested in your feedback if you get a chance to try this library.
Hi thank you for your quick reply! And sorry for getting back so late on this.
When I got my hands on the RPi5 I could verify that installing the Blinkt!
package out of the box (with the dependency on RPi.GPIO
) didn't work. Or to be more precise: the install did work, but we got errors regarding GPIO access. This is the part of the error trace in the Blinkt!
package code:
File "/usr/share/python/lib/python3.11/site-packages/blinkt.py", line 76, in show
GPIO.setup(DAT, GPIO.OUT)
RuntimeError: Cannot determine SOC peripheral base address
We didn't investigate this any further, as replacing the RPi.GPIO
install with rpi.lgpio
(https://pypi.org/project/rpi-lgpio/) fixed the issue for us.
Testing
If you're a Bookworm / Pi 5 user running into virtual environment issues, you can try this library like so:
The
./install.sh
script will create apimoroni
virtual environment that's shared between our products. (or use your existing venv if you've already activated one.)For the reasons behind these changes and other information, see:
Troubleshooting
OSError: Device or resource busy
If you see an error like this:
You should install
sudo apt install gpiod
and rungpioinfo
to see what's using your pins. There should be a name in the column of "unused" things. If it's something like "sysfs" then something like RPi.GPIO (on an older Pi 4 OS) has already claimed the pin via/sys/class/gpio
and gpiod will not let you use it.Or, as of recent changes, a more useful error like this:
Then make sure you close whatever process, or disable whatever service is implicated as the claimant :laughing:
PermissionError: Permission denied
If you see an error like this:
You may need to add yourself to the "dialout" group, or whatever group arbitrates GPIO access on your distro. For example on Raspberry Pi Ubuntu -