jfath / rpi.gpio-odroid Goto Github PK
View Code? Open in Web Editor NEWRPi.GPIO for Odroid c1, c2, xu4
License: MIT License
RPi.GPIO for Odroid c1, c2, xu4
License: MIT License
Just wanted to inform you of an error as I ran this on a Odroid C2.
#!/usr/bin/python3
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
for i in range(0,28):
GPIO.setup(i, GPIO.OUT)
GPIO.output(i, GPIO.LOW)
dev@odroid:~$ sudo ./a.py Segmentation fault
Given the ff. test code
$ cat test-gpio.py
import RPi.GPIO as GPIO
PIN = 11
GPIO.setmode(GPIO.BOARD)
GPIO.setup(PIN, GPIO.IN)
def test(channel):
pass
GPIO.add_event_detect(11, GPIO.BOTH, test)
Results in
Traceback (most recent call last):
File "test-gpio.py", line 8, in <module>
GPIO.add_event_detect(11, GPIO.BOTH, test)
RuntimeError: Failed to add edge detection
strace shows driver access
openat(AT_FDCWD, "/sys/class/aml_gpio/export", O_WRONLY) = -1 ENOENT (No such file or directory)
but actual is
# ll /sys/class/ | grep gpio
drwxr-xr-x 2 root root 0 Jan 1 1970 gpio/
drwxr-xr-x 2 root root 0 Jan 10 12:56 meson-gpiomem/
Current workaround for me was to override odroid_found to 0
https://github.com/jfath/RPi.GPIO-Odroid/blob/master/source/cpuinfo.c#L54
reference docs
https://wiki.odroid.com/troubleshooting/gpiomem#rootless_gpio_sys-filesystemsysclassgpio
Additional Info
$ pip list | grep GPIO
RPi.GPIO 0.6.3.post1
https://odroid.in/ubuntu_20.04lts/c0_c1/ubuntu-20.04-3.10-minimal-odroid-c1-20200519.img.xz
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.4 LTS
Release: 20.04
Codename: focal
$ cat /proc/cpuinfo
Processor : ARMv7 Processor rev 1 (v7l)
processor : 0
BogoMIPS : 4.62
processor : 1
BogoMIPS : 4.62
processor : 2
BogoMIPS : 4.62
processor : 3
BogoMIPS : 4.62
Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc05
CPU revision : 1
Hardware : ODROIDC
Revision : 000a
Serial : 1b00000000000000
$ uname -ar
Linux odroid 3.10.107-25 #2 SMP PREEMPT Wed Feb 3 13:41:38 -02 2021 armv7l armv7l armv7l GNU/Linux
$ dmesg | grep gpio
[ 0.705546] amlogic_gpio gpio: Probed amlogic GPIO driver
$ lsmod | grep gpio
w1_gpio 3465 0
wire 20495 1 w1_gpio
meson_gpiomem 3455 0
Joshua,
I left this message in the forum but will copy it here with hopes that you may see it in one place or the other: https://forum.odroid.com/viewtopic.php?f=97&t=30577&p=287227#p287227
Pleas see the the terminal output below: (Note that I deleted most of the 'error' lines because they were repetitive)
root@odroid64:# git clone https://github.com/joshua-yang/RPi.GPIO-Odroid# cd RPi.GPIO-Odroid
Cloning into 'RPi.GPIO-Odroid'...
remote: Enumerating objects: 192, done.
remote: Total 192 (delta 0), reused 0 (delta 0), pack-reused 192
Receiving objects: 100% (192/192), 76.71 KiB | 0 bytes/s, done.
Resolving deltas: 100% (129/129), done.
Checking connectivity... done.
root@odroid64:
root@odroid64:~/RPi.GPIO-Odroid# sudo python setup.py build install
running build
running build_py
creating build
creating build/lib.linux-aarch64-2.7
creating build/lib.linux-aarch64-2.7/RPi
copying RPi/init.py -> build/lib.linux-aarch64-2.7/RPi
creating build/lib.linux-aarch64-2.7/RPi/GPIO
copying RPi/GPIO/init.py -> build/lib.linux-aarch64-2.7/RPi/GPIO
running build_ext
building 'RPi._GPIO' extension
creating build/temp.linux-aarch64-2.7
creating build/temp.linux-aarch64-2.7/source
aarch64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c source/py_gpio.c -o build/temp.linux-aarch64-2.7/source/py_gpio.o
In file included from /usr/include/aarch64-linux-gnu/bits/local_lim.h:39:0,
from /usr/include/aarch64-linux-gnu/bits/posix1_lim.h:160,
from /usr/include/limits.h:143,
from /usr/lib/gcc/aarch64-linux-gnu/5/include-fixed/limits.h:168,
from /usr/lib/gcc/aarch64-linux-gnu/5/include-fixed/syslimits.h:7,
from /usr/lib/gcc/aarch64-linux-gnu/5/include-fixed/limits.h:3,
from /usr/include/python2.7/Python.h:19,
from source/py_gpio.c:23:
/usr/include/linux/limits.h:1:1: error: stray ‘\272’ in program
? 7? ? ? 8?
^
/usr/include/linux/limits.h:1:1: error: stray ‘\1’ in program
/usr/include/linux/limits.h:1:1: error: stray ‘\2’ in program
/usr/include/linux/limits.h:1:5: error: expected identifier or ‘(’ before numeric constant
? 7? ? ? 8?
^
/usr/include/linux/limits.h:1:5: error: stray ‘\17’ in program
/usr/include/linux/limits.h:1:5: error: stray ‘\10’ in program
/usr/include/linux/limits.h:1:5: error: stray ‘\17’ in program
/usr/include/linux/limits.h:1:5: error: stray ‘\10’ in program
/usr/include/linux/limits.h:1:5: error: stray ‘\317’ in program
/usr/include/linux/limits.h:1:5: error: stray ‘\1’ in program
/usr/include/linux/limits.h:1:5: error: stray ‘\307’ in program
/usr/include/linux/limits.h:1:5: error: stray ‘\272’ in program
/usr/include/linux/limits.h:1:5: error: stray ‘\1’ in program
/usr/include/linux/limits.h:4:111: error: stray ‘\241’ in program
/usr/include/linux/limits.h:4:111: error: stray ‘\252’ in program
/usr/include/linux/limits.h:4:111: error: stray ‘\247’ in program
/usr/include/linux/limits.h:4:111: error: stray ‘\3’ in program
/usr/include/linux/limits.h:4:111: error: stray ‘\252’ in program
/usr/include/linux/limits.h:4:111: error: stray ‘\247’ in program
/usr/include/linux/limits.h:4:111: error: stray ‘\3’ in program
/usr/include/linux/limits.h:4:111: error: stray ‘\374’ in program
In file included from /usr/include/aarch64-linux-gnu/bits/local_lim.h:39:0,
from /usr/include/aarch64-linux-gnu/bits/posix1_lim.h:160,
from /usr/include/limits.h:143,
from /usr/lib/gcc/aarch64-linux-gnu/5/include-fixed/limits.h:168,
from /usr/lib/gcc/aarch64-linux-gnu/5/include-fixed/syslimits.h:7,
from /usr/lib/gcc/aarch64-linux-gnu/5/include-fixed/limits.h:3,
from /usr/include/python2.7/Python.h:19,
from source/py_gpio.c:23:
/usr/include/linux/limits.h:4:171: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘|’ token
~ q ? U? ? ? V? ?{ ? W? '~ ?
^
/usr/include/linux/limits.h:4:171: error: stray ‘\276’ in program
/usr/include/linux/limits.h:4:171: error: stray ‘\1’ in program
/usr/include/linux/limits.h:4:171: error: stray ‘\2’ in program
/usr/include/linux/limits.h:4:171: error: stray ‘\17’ in program
/usr/include/linux/limits.h:4:171: error: stray ‘\10’ in program
/usr/include/linux/limits.h:4:171: error: stray ‘\317’ in program
/usr/include/linux/limits.h:4:171: error: stray ‘\1’ in program
/usr/include/linux/limits.h:4:171: error: stray ‘\272’ in program
/usr/include/linux/limits.h:4:171: error: stray ‘\241’ in program
/usr/include/linux/limits.h:4:171: error: stray ‘\253’ in program
/usr/include/linux/limits.h:4:171: error: stray ‘\247’ in program
/usr/include/linux/limits.h:4:171: error: stray ‘\3’ in program
/usr/include/linux/limits.h:4:171: error: stray ‘\253’ in program
/usr/include/linux/limits.h:4:171: error: stray ‘\247’ in program
/usr/include/linux/limits.h:4:171: error: stray ‘\3’ in program
/usr/include/linux/limits.h:4:171: error: stray ‘\374’ in program
/usr/include/linux/limits.h:4:171: error: stray ‘\376’ in program
/usr/include/linux/limits.h:4:171: error: stray ‘\375’ in program
/usr/include/linux/limits.h:4:171: error: stray ‘\335’ in program
/usr/include/linux/limits.h:4:171: error: stray ‘\244’ in program
/usr/include/linux/limits.h:4:171: error: stray ‘\277’ in program
/usr/include/linux/limits.h:4:171: error: stray ‘\1’ in program
/usr/include/linux/limits.h:4:171: error: stray ‘\2’ in program
/usr/include/linux/limits.h:4:171: error: stray ‘\321’ in program
/usr/include/linux/limits.h:4:219: error: expected identifier or ‘(’ before ‘%’ token
V? ?{ ? W? '~ ? X? ? ? Y? {? ?? ?? *?
/usr/include/linux/limits.h:4:219: error: stray ‘\7’ in program
In file included from /usr/include/linux/errno.h:1:0,
from /usr/include/aarch64-linux-gnu/bits/errno.h:24,
from /usr/include/errno.h:35,
from /usr/include/python2.7/Python.h:40,
from source/py_gpio.c:23:
/usr/include/aarch64-linux-gnu/asm/errno.h:1:31: fatal error: /usr/include/asm-generic/errno.h: Input/output error
compilation terminated.
error: command 'aarch64-linux-gnu-gcc' failed with exit status 1
root@odroid64:~/RPi.GPIO-Odroid#
Thank you for your consideration, please let me know if I can provide other information that may be useful.
Dan
Hello as mentioned, I get following error:
dietpi@DietPi:~/RPi.GPIO-Odroid$ sudo python3 setup.py clean --all
running clean
'build/lib.linux-aarch64-cpython-39' does not exist -- can't clean it
'build/bdist.linux-aarch64' does not exist -- can't clean it
'build/scripts-3.9' does not exist -- can't clean it
Hello, I'm trying to use RPi.GPIO on odroid xu4.
I tried to set pin 5 (in BCM) as interrupt request pin, with a code
GPIO.add_event_detect(5, GPIO.RISING, callback=self.handleInterrupt)
but occured an Error
RuntimeError: Failed to add edge detection
I read the README.txt,
Note that the current release does not support SPI, I2C, hardware PWM or serial functionality on the RPi yet.
Did the Error occur because RPi.GPIO-odroid don't have this feature?
Hi,
Root cause is that /proc/cpuinfo does not contain any Hardkernel specific info, I tried to hack it but I get a segmentation fault.
This is what /proc/cpuinfo looks like:
`processor : 0
BogoMIPS : 48.00
Features : fp asimd evtstrm crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4
processor : 1
BogoMIPS : 48.00
Features : fp asimd evtstrm crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4
processor : 2
BogoMIPS : 48.00
Features : fp asimd evtstrm crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd03
`
The library is not working with N2. Is there a way?
Traceback (most recent call last):
File "simplerw.py", line 4, in
import RPi.GPIO as GPIO
File "/usr/local/lib/python2.7/dist-packages/RPi/GPIO/init.py", line 23, in
from RPi._GPIO import *
RuntimeError: This module can only be run on a Raspberry Pi!
Hello, on C2 I received an error as below:
root@DietPi:~/RPi.GPIO-Odroid/test# sudo python test.py
Traceback (most recent call last):
File "test.py", line 38, in
import RPi.GPIO as GPIO
ImportError: No module named RPi.GPIO
I screwed up something?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.