Skip to content

Fix for bookworm#17

Open
kancelott wants to merge 2 commits intopimoroni:masterfrom
kancelott:bookworm-cs-fix
Open

Fix for bookworm#17
kancelott wants to merge 2 commits intopimoroni:masterfrom
kancelott:bookworm-cs-fix

Conversation

@kancelott
Copy link

Rely on spidev's chip select rather than manually triggering GPIO pins.

This fixes #16, where Bookworm has stricter checks on using GPIO pins.

Unsure if this change would impact older versions of Raspbian, or why the decision to manually assert/deassert GPIO 7 and GPIO 8 SPI chip select in the first place.

@Gadgetoid
Copy link
Member

I am also, now, unsure. The reasoning behind this is steeped in about a decade of legacy and I have since forgotten exactly why. I suspect if it works at all, it should work everywhere.

Of course all the tests have succumb to bitrot 😭 I have a whole new boilerplate to migrate libraries to.

@myx360
Copy link

myx360 commented Nov 14, 2025

I can vouch for this, it definitely worked for me. I'm afraid I'm ignorant on understanding why it works, but I've used it in my own (very much WIP) project linked at the bottom, on an RPi Zero2W running Raspberry Pi OS bookworm, running within a python 3.11 venv.

Thank you very much Kancelott!

I followed these steps to get it working, though I am no python expert (I'm a java/bash guy)

  1. Copy unicornhatmini's init.py code from this PR into your src/ folder as unicornhatmini.py (the exact name is important)
  2. Run pip3 uninstall unicornhatmini RPi.GPIO
  3. Run pip3 install rpi-lgpio spidev

Below is my pip3 list output in case it gives anyone clues for their own project.

` $ pip3 list
Package Version


colorzero 2.0
gpiozero 2.0.1
iniconfig 2.1.0
lgpio 0.2.2.0
packaging 25.0
pillow 12.0.0
pip 25.3
pluggy 1.6.0
Pygments 2.19.2
pytest 8.4.2
rpi-lgpio 0.6
setuptools 80.9.0
spidev 3.8
toolz 1.1.0`

https://github.com/myx360/addressable_unicorn_mini/blob/504f4e37425f0f3bd50d68dee7727968ce2e0acf/src/unicornhatmini.py

@bradypdrew
Copy link

Updating the init.py file worked for me too. Haven't noticed any other issues introduced by this fix.

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

Successfully merging this pull request may close these issues.

lgpio.error: 'GPIO busy' on Raspbian Bookworm

4 participants