Hi Ben,
I went to a lot of tickets to find a solution for this re-occurring problem but it seems it is here again on latest hard- and software:
import RPi.GPIO as GPIO
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.8/site-packages/RPi/GPIO/init.py", line 23, in <module>
from RPi._GPIO import *
RuntimeError: This module can only be run on a Raspberry Pi!</module></module></stdin>
• RPi4B 4Gbyte • OS: Archlinux ARM aarch64 • Python version 3.8.6 and GCC 10.2.0 • Rpi.GPIO version: 0.7.0
More precisely: installed AUR package python-raspberry-gpio 0.7.0-2 via
git clone https://aur.archlinux.org/python-raspberry-gpio.git and running makepkg -si
In the PKGBUILD file CFLAGS=”-fcommon” is specified by default.
Installation is not the problem.
• cat /proc/cpuinfo
Identical info for processor : 0/1/2/3
BogoMIPS : 108.00
Features : fp asimd evtstrm crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3
• cat: /proc/device-tree/system/linux,revision: No such file or directory
I do not run a container and there is no difference in using it with sudo or not.
In /dev I see /dev/gpiochip0 and /dev/gpiochip1, not /dev/gpiomem
Any clue?
Thanks in advance.
Hi,
I can confirm this problem on Debian.
On the vanilla linux kernel (not the rpi one), there is no /dev/gpiomem. So this library tries to detect PERI_BASE using various heuristics.
I tried forcing the value with this patch, which works fine:
But I don't know to fit in the current detection logic.
Here is the content of /proc/device-tree/soc/ranges:
Apparently, on the RPI 4, you need to look at the 3rd 32-b word, not at the second (I don't understand the format of that file). See https://gist.github.com/jperkin/c37a574379ef71e339361954be96be12 for values on various models.
Having issues in a non-privileged (no /sys from host) docker environment (Homeassistant.io). I just updated my kernel, and was getting:
It seems the logic block regarding /proc/cpuinfo is missing BCM2711. I'm probably over simplifying, but why is BCM2711 missing? I'm patching with this:
Fixed i n 0.7.1a4
Fixed in 0.7.1