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

Error : "suitable gpiochip not found" and a workaround. #23

Open
g7uvw opened this issue Nov 29, 2023 · 1 comment
Open

Error : "suitable gpiochip not found" and a workaround. #23

g7uvw opened this issue Nov 29, 2023 · 1 comment

Comments

@g7uvw
Copy link

g7uvw commented Nov 29, 2023

I had an Enviro+ running for a year on a Pi ZeroW before I decided to upgrade the OS to latest, and completely broke the operation of the Enviro+.

I did a fresh install of the previous OS version and have almost everything running again except the PMS5003. Pulling down the latest driver from here an running examples/all.py give the following error

Woah there, suitable gpiochip not found!
PIN15: not found - /dev/gpiochip0 (pinctrl-bcm2835)

Re-running install.sh did some magic, got rid of the gpiochip error but then lead to the following error:

  File "/usr/local/lib/python3.9/dist-packages/gpiodevice/__init__.py", line 138, in get_pin
    chip = find_chip_by_pins(pin)
  File "/usr/local/lib/python3.9/dist-packages/gpiodevice/errors.py", line 45, in wrapper
    errors.append(next(i))
  File "/usr/local/lib/python3.9/dist-packages/gpiodevice/__init__.py", line 108, in find_chip_by_pins
    for pin_id in pins:
TypeError: 'int' object is not iterable

The solution seems to be

pip install RPi.GPIO

replace
/usr/local/lib/python3.9/dist-packages/pms5003/__init__.py
with the one from this commit
https://raw.githubusercontent.com/pimoroni/pms5003-python/406801133aaa7489dd4b967890c1cab7a656a4aa/library/pms5003/__init__.py

After that the examples work perfectly.

@Gadgetoid
Copy link
Member

You can install a specific version of the library with:

pip install pms5003==0.0.5

Which will retrieve the version before the migration to gpiod/gpiodevice.

An error like PIN15 not found means your Pi probably names it GPIO22 since PIN15 is the name of GPIO22 on a Pi 5-

"Raspberry Pi 5": {"enable": ("PIN15", OUTH), "reset": ("PIN13", OUTL)},
"Raspberry Pi 4": {"enable": ("GPIO22", OUTH), "reset": ("GPIO27", OUTL)}

Yup. Pin names as provided by gpiod/gpiochip devices are not consistent across Raspberry Pi devices. 😭

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