Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pi 5 Support #101

Closed
alessaba opened this issue Oct 31, 2023 · 10 comments
Closed

Pi 5 Support #101

alessaba opened this issue Oct 31, 2023 · 10 comments

Comments

@alessaba
Copy link

alessaba commented Oct 31, 2023

Hi,
I just got a Pi 5 and the first HAT i mounted was a Blinkt i had laying around.
I did a fresh Pi OS install, and ran the installation script

I first got this error
error: externally-managed-environment
and the installation stopped, but i installed the apt package and the module seems to show up in python 3

The problem is that when i call the show() function, there is what seems to be a permissions error to /dev/mem.
Traceback (most recent call last): File "/home/pi/Pimoroni/blinkt/examples/rainbow.py", line 22, in <module> show() File "/usr/lib/python3/dist-packages/blinkt.py", line 76, in show GPIO.setup(DAT, GPIO.OUT) RuntimeError: No access to /dev/mem. Try running as root!

Running as root does nothing. There is no error but nothing lights up

i read that it could be something related to /dev/gpiomem and i saw that at least on the Pi 5 (because of the RP1, perhaps?) , there is no gpiomem but just gpiomem0 through gpiomem4, so maybe this could also be the reason
Update: tried on my Pi Zero 2 and in fact there is just gpiomem on there. Pi5 has 5 different "files"

Am i doing something wrong or is there some compatibility problem?

@Gadgetoid
Copy link
Member

is there some compatibility problem?

Several, in fact, I wont bore you with the details - unless you're in for an otherworldly information dump - but I'm working through our libs and trying to get a functional GPIO environment up and running on the Pi.

Actually Blinkt might be an interesting case. I've dug mine out and will have a look.

@alessaba
Copy link
Author

I am more than curious about the details, if you have the time :)

Otherwise i will have patience and wait while i try other things

@Gadgetoid
Copy link
Member

Okay to save me the typing here's the virtual environment side of things - pimoroni/boilerplate-python#13

And the GPIO side of things - https://lore.kernel.org/linux-gpio/20231025082707.821368-1-phil@gadgetoid.com/

Blinkt has also, as an aside to both of these, suffered from some significant bitrot.

Looks like my Blinkt is now working, though I need to fix clear on exit!

@Gadgetoid
Copy link
Member

Okay this PR has a new working build in - #102

You will, however, need a pre-release version of libgpiod for Python. I'll post my build here momentarily.

@Gadgetoid
Copy link
Member

Gadgetoid commented Oct 31, 2023

Hopefully one of these will work.

First you'll need to create a venv:

python3 -m venv ~/my_virtual_env
source ~/my_virtual_env/bin/activate

Then -

Either sudo apt install python3-dev and pip install gpiod-2.0.1.tar.gz
gpiod-2.0.1.tar.gz

Or unzip this one, and pip install gpiod-2.0.1-cp311-cp311-linux_aarch64.whl
gpiod-2.0.1-cp311-cp311-linux_aarch64.zip

And finally:

git clone https://github.com/pimoroni/blinkt -b repackage
cd blinkt
pip install .

@alessaba
Copy link
Author

The PR works on my end too, thank you for the very quick fix!

@alessaba
Copy link
Author

The clear function seems to only work 80% of the time, but every other thing i tested works

@Gadgetoid
Copy link
Member

Thanks. I'll investigate. I'm a little in uncharted territory here, it's also possible the LEDs are just being uncooperative. The protocol is weird but software can fix that, too.

@Gadgetoid
Copy link
Member

Well, that's odd! I can't seem to get clear to fail. What code were you running?

@alessaba
Copy link
Author

One of the examples it happened with was rainbow.py

maybe it's something weird with my system, but it’s not that big of a problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants