Despite enabling SPI on my Raspberry Pi Zero W, I get GPIO busy on the latest Raspbian Bookworm.
Traceback (most recent call last):
File "/home/pi/Pimoroni/unicornhatmini/examples/./demo.py", line 16, in <module>
unicornhatmini = UnicornHATMini()
^^^^^^^^^^^^^^^^
File "/home/pi/.virtualenvs/pimoroni/lib/python3.11/site-packages/unicornhatmini/__init__.py", line 58, in __init__
GPIO.setup(pin, GPIO.OUT, initial=GPIO.HIGH)
File "/usr/lib/python3/dist-packages/RPi/GPIO/__init__.py", line 705, in setup
_check(lgpio.gpio_claim_output(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/lgpio.py", line 781, in gpio_claim_output
return _u2i(_lgpio._gpio_claim_output(handle&0xffff, lFlags, gpio, level))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/lgpio.py", line 458, in _u2i
raise error(error_text(v))
lgpio.error: 'GPIO busy'
I managed to fix this by changing device.no_cs = False to device.no_cs = True and commenting out the manual GPIO commands on pins 7 and 8 for SPI0 CE1 and CE0 respectively.
Any reason why this was done manually rather than leaving it to the spidev library?
Despite enabling SPI on my Raspberry Pi Zero W, I get GPIO busy on the latest Raspbian Bookworm.
I managed to fix this by changing
device.no_cs = Falsetodevice.no_cs = Trueand commenting out the manual GPIO commands on pins 7 and 8 for SPI0 CE1 and CE0 respectively.Any reason why this was done manually rather than leaving it to the
spidevlibrary?