Back to Discussions
31
HardwareSolved

Raspberry Pi 5 GPIO error (gpiochip4 not found / RPi.GPIO crash) with PiEEG-8 Python scripts

Lucas Vandenberg (Embedded)Contributor· Posted 11h ago
420 views1 reply

I moved my PiEEG-8 shield from a Raspberry Pi 4 to a new Raspberry Pi 5 (Bookworm OS).

When I try to run the older Python scripts, RPi.GPIO fails because of the new RP1 southbridge chip on Pi 5, and gpiod complains about gpiochip4 or version mismatches (pip install gpiod==1.6.3 isn't on PyPI). What is the clean setup for Raspberry Pi 5?

1 Reply

Accepted Solution
35
youssefCo-Founder & Software Architect
· 11h ago

On Raspberry Pi 5, GPIO is routed through the RP1 controller (pinctrl-rp1), and newer kernels changed its chip number from gpiochip4 to gpiochip0 (or another index depending on firmware).

Here is the exact fix:

Option A: Use pieeg-server (Recommended)

Run self-diagnostics first:

bash
pieeg-server doctor

If needed, inspect your chip name with gpiodetect (look for pinctrl-rp1) and pass it explicitly:

bash
pieeg-server --device pieeg8 --gpio-chip /dev/gpiochip0

Option B: Standalone Python Scripts on Pi 5

  1. Make sure SPI is enabled (sudo raspi-config → Interface Options → SPI) and your user is in the groups:
    bash
    sudo usermod -aG spi,gpio $USER
  2. For RPi.GPIO drop-in compatibility on Pi 5 inside a virtualenv:
    bash
    pip install rpi-lgpio
  3. For gpiod, either install system sudo apt install python3-libgpiod (use 1.8_ch_Pi5.py) OR inside a venv run pip install gpiod==1.5.4 with 1.8_ch_Pi5_gpiod_1_5_4.py.

Your Reply

You'll verify with a quick 6-digit email code when posting.
Raspberry Pi 5 GPIO error (gpiochip4 not found / RPi.GPIO crash) with PiEEG-8 Python scripts — PiEEG Community Discussions