Skip to content

Unable to interact with the GPIO of Raspberry Pi 5 #807

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

Open
processing-bot opened this issue Nov 30, 2023 · 8 comments
Open

Unable to interact with the GPIO of Raspberry Pi 5 #807

processing-bot opened this issue Nov 30, 2023 · 8 comments
Labels
has attachment Attachment was not transfered from GitLab help wanted Extra attention is needed raspberry pi

Comments

@processing-bot
Copy link
Collaborator

processing-bot commented Nov 30, 2023

Created by: eMUQI

Description

Unable to interact with the GPIO of Raspberry Pi 5

Expected Behavior

Draw a dot on Processing, which blinks synchronously with the LED.
图片

Current Behavior

error

/sys/class/gpio/export:Invalid argument
GPIO pin 17 does not seem to be available on your platform
RuntimeException: /sys/class/gpio/export: Invalid argument
RuntimeException: /sys/class/gpio/export: Invalid argument

Steps to Reproduce

  1. Install Hardware I/O
    io

  2. Run the code

    import processing.io.*;
    int ledPin = 17;
    boolean state = true;
    
    void setup() {
        size(100, 100);
        frameRate(2); //set frame rate
        GPIO.pinMode(ledPin, GPIO.OUTPUT); //set the ledPin to output mode
    }
    
    void draw() {
        state = !state;
        if (state==true) {
            GPIO.digitalWrite(ledPin, GPIO.LOW); //led on
            fill(255, 0, 0); //set the fill color of led on
        } else {
            GPIO.digitalWrite(ledPin, GPIO.HIGH); //led off
            fill(155); //set the fill color of led off
        }
        ellipse(width/2, height/2, width*0.75, height*0.75);
    }
  3. error

Your Environment

  • Processing version:
    • 4.3
  • Operating System and OS version:
    • OS: Debian GNU/Linux 12 (bookworm) aarch64
    • Kernel: 6.1.0-rpi6-rpi-2712
  • Other information:
    • Raspberry Pi 5 Model B Rev 1.0
    • CPU: BCM2835 (4) @ 2.400GHz

Possible Causes / Solutions

My suspicion is that it might be related to the introduction of the new southbridge chip, RP1, on the Raspberry Pi 5, which now handles the GPIOs and may have altered the access protocol.

Other

Also report at https://discourse.processing.org/t/issue-with-gpio-access-on-raspberry-pi-5-using-processing-4/43337

@processing-bot
Copy link
Collaborator Author

Created by: Khushikela29

Hii !! I think the issue is being resolved because the output after running the program is same as expected output

@processing-bot
Copy link
Collaborator Author

Created by: eMUQI

Hii !! I think the issue is being resolved because the output after running the program is same as expected output

Hello @Khushikela29, may I ask if you have run the aforementioned program on a Raspberry Pi 5? Today I tried again and still encountered the same error.

@processing-bot
Copy link
Collaborator Author

In GitLab by @fabianluescher on Apr 23, 2024, 17:38

I have the same issue (identical error messages) even with a rpi4.

I figure it has something to do with the fact that the rpi3 uses the "Sysfs Interface" for GPIO pins (which is phased out for a long time), and the rpi4 onwards "GPIO Character Device Interface". The Hardware I/O library seems to rely on the "Sysfs Interface"?

The folder /sys/class/gpio on the rpi 4 is almost empty, Output of ls -l /sys/class/gpio is:

xxx@raspberrypi:~ $ ls -l /sys/class/gpio
total 0
--w--w---- 1 root gpio 4096 Apr 23 17:04 export
lrwxrwxrwx 1 root gpio    0 Apr 23 17:04 gpiochip512 -> ../../devices/platform/soc/fe200000.gpio/gpio/gpiochip512
lrwxrwxrwx 1 root gpio    0 Apr 23 17:04 gpiochip570 -> ../../devices/platform/soc/soc:firmware/soc:firmware:gpio/gpio/gpiochip570
--w--w---- 1 root gpio 4096 Apr 23 17:04 unexport

Whereas output of the rpi 3 ls -l /sys/class/gpio is:

xxx@raspberrypi:~ $ ls -l /sys/class/gpio
total 0
--w--w---- 1 root gpio 4096 Apr 23 16:43 export
lrwxrwxrwx 1 root root    0 Apr 23 16:43 gpio10 -> ../../devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio10
lrwxrwxrwx 1 root root    0 Apr 23 16:43 gpio11 -> ../../devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio11
lrwxrwxrwx 1 root root    0 Apr 23 16:43 gpio13 -> ../../devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio13
lrwxrwxrwx 1 root root    0 Apr 23 16:43 gpio17 -> ../../devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio17
lrwxrwxrwx 1 root root    0 Apr 23 16:43 gpio19 -> ../../devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio19
lrwxrwxrwx 1 root root    0 Apr 23 16:43 gpio26 -> ../../devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio26
lrwxrwxrwx 1 root root    0 Apr 23 16:43 gpio27 -> ../../devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio27
lrwxrwxrwx 1 root root    0 Apr 23 16:43 gpio5 -> ../../devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio5
lrwxrwxrwx 1 root root    0 Apr 23 16:43 gpio6 -> ../../devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio6
lrwxrwxrwx 1 root root    0 Apr 23 16:43 gpio9 -> ../../devices/platform/soc/3f200000.gpio/gpiochip0/gpio/gpio9
lrwxrwxrwx 1 root gpio    0 Apr 23 16:43 gpiochip0 -> ../../devices/platform/soc/3f200000.gpio/gpio/gpiochip0
lrwxrwxrwx 1 root gpio    0 Apr 23 16:43 gpiochip100 -> ../../devices/gpiochip1/gpio/gpiochip100
lrwxrwxrwx 1 root gpio    0 Apr 23 16:43 gpiochip504 -> ../../devices/platform/soc/soc:firmware/soc:firmware:expgpio/gpio/gpiochip504
--w--w---- 1 root gpio 4096 Apr 23 16:43 unexport

I might be totally off course.
Not sure how anyone had used Processing 4 with GPIOs on a rpi4 or even rpi5, though. I might be missing something blatantly obvious to someone of course ;)

@processing-bot
Copy link
Collaborator Author

Created by: JinbaoPeng

In the latest systems (bookworm), processing is not available, so try going back to bullseye.

@jSdCool
Copy link

jSdCool commented Dec 31, 2024

I have also encountered this problem on my PI4, after doing some research I found out that in version 6.6 they changed the numbers you have to use to access the GPIO pins more info can be found here: https://stackoverflow.com/questions/78452048/not-able-to-access-gpio-pins-on-my-raspberry-pi-5

@jcelerier
Copy link

jcelerier commented Feb 18, 2025

It actually also does not work either on a RPi 3B with Bookworm ARM64 here, it's more of a "kernel > 6.6" issue I believe:

$ uname -a 
Linux raspberrypi 6.6.51+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.51-1+rpt3 (2024-10-08) aarch64 GNU/Linux

$ ls -l /sys/class/gpio
total 0
--w--w---- 1 root gpio 4096 Feb 17 22:12 export
lrwxrwxrwx 1 root gpio    0 Feb 17 22:12 gpiochip512 -> ../../devices/platform/soc/3f200000.gpio/gpio/gpiochip512
lrwxrwxrwx 1 root gpio    0 Feb 17 22:12 gpiochip566 -> ../../devices/platform/soc/soc:firmware/soc:firmware:virtgpio/gpio/gpiochip566
lrwxrwxrwx 1 root gpio    0 Feb 17 22:12 gpiochip568 -> ../../devices/platform/soc/soc:firmware/soc:firmware:expgpio/gpio/gpiochip568
--w--w---- 1 root gpio 4096 Feb 17 22:12 unexport

@SableRaf
Copy link
Collaborator

The Hardware I/O library lives on this fork of the old Processing repository:

https://github.com/gohai/processing/releases/tag/latest

Hi @gohai and thanks for your work on this! Do you think it would make sense to migrate the Hardware I/O library to a dedicated repository so issues like that one above can be addressed by the community? How was the release generated?

@gohai
Copy link

gohai commented May 21, 2025

Hi @SableRaf

From what I can see, the library is still part of main processing4 repo in java/libraries/io - so anyone could contribute to its development there. Feel free to point the library URL in the contributions manager away from my own repo if you want. (Be great to have my work in this area acknowledged if there is going to be a continuation of this effort [which I'd applaud]. Thanks.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has attachment Attachment was not transfered from GitLab help wanted Extra attention is needed raspberry pi
Projects
Status: To do
Development

No branches or pull requests

5 participants