Python RPi and GPIO on M5

Hello,

It looks like that the repository for RPGPIO doesn’t support bananapi m5

After installing, it gives: $ python3 import RPi.GPIO as GPIO BPI: gpioLayout(-1) Traceback (most recent call last): File “”, line 1, in File “/usr/local/lib/python3.8/dist-packages/RPi/GPIO/init.py”, line 23, in from RPi._GPIO import * RuntimeError: This module can only be run on a Raspberry Pi!

I see that there is support for other boards including M3:

Can you add support for M5 too ?

Thank you, Roberto

there is also no support for the m2-pro. T_T

please see here : https://wiki.banana-pi.org/Getting_Started_with_BPI-M5#RPi.GPIO

GPIO in python did’t work… How do I fix?

import RPi.GPIO as GPIO Traceback (most recent call last): File “”, line 1, in File “/usr/local/lib/python3.9/dist-packages/RPi.GPIO-0.7.1-py3.9-linux-aarch64.egg/RPi/GPIO/init.py”, line 23, in from RPi._GPIO import * ImportError: /usr/local/lib/python3.9/dist-packages/RPi.GPIO-0.7.1-py3.9-linux-aarch64.egg/RPi/_GPIO.cpython-39-aarch64-linux-gnu.so: undefined symbol: gpio_direction

Compiling RPi.GPIO as suggested here : https://wiki.banana-pi.org/Getting_Started_with_BPI-M5#RPi.GPIO just fails with a zillion ERRORS

RPi.GPIO-Amlogic/source/common.h:35: multiple definition of `pin_to_gpio_rev1’; build/temp.linux-aarch64-2.7/source/py_gpio.o:/home/*/RPi.GPIO-Amlogic/source/common.h:35: first defined here …

Hi,

I guess nobody is interested anymore in this, but in case anyone is passing by :

With Bookworm armbian it is possible to make gpios works with RPi.GPIO and WiringPi-Python, I can help, I followed some guidelines from this webpage.

BUT, if you need to use this without sudo/root user, then you’re kinda stuck like me, it’s been a week and I still can’t find any solution right now.

This is what you can read on RPi.GPIO git page : Apps require root (eg ‘sudo python testapp.py’) :

When using BCM mode, RPi BCM numbers are passed to GPIO.xxx and translated internally to Bananapi GPIO numbers
Compare RPi connector pinout / BCM chart and Bananapi pinout to match RPi BCM with Bananapi pins

No mentions about root/sudo on WiringPi-Python.

And no mater what I do I have :

./venv/bin/python3 main.py 
pygame-ce 2.5.6 (SDL 2.32.10, Python 3.11.2)
wiringPiSetupAml: Must be root. (Did you forget sudo?)

I really need my python app to be run as normal user, or else I won’t be able to use different stuff within my project. Is there anyone who would know what I could do ?

Some people says stuff about WiringPi but I don’t get it : You could switch to a library that can use the kernel gpio interface, such as WiringPi with Python wrappers. Then you can set the permissions within /sys/class/gpio so that non-root users can access the files.

Other thread here but again, I don’t understand all the ins & outs (litterally ahah).

Last but not least, I made an issue about this here too.

Thanks a lot to anyone reading or involved in any way in BPI and helping, I hope I won’t be needing to buy another hardware :crossed_fingers:

Cheers,