Tiny Core Linux
Tiny Core Base => Raspberry Pi => Topic started by: phillip.toone on November 21, 2012, 02:40:29 PM
-
I tried following this (http://lwk.mjhosting.co.uk/?p=343) tutorial for accessing the GPIO on the Raspberry Pi with Python. But ran into problems (lots of error messages) when I tried to install the python code with this command:
sudo python setup.py install
So I tried to access the GPIO pins via bash as instructed here (http://log.liminastudio.com/writing/tutorials/tutorial-how-to-use-your-raspberry-pi-like-an-arduino). But I get an error message on the very first command I type:
echo "4" > /sys/class/gpio/export
I get this error message:
-sh: can't create /sys/class/gpio/export: Permission denied
And yes I tried using sudo and I get the same error message.
Has anyone else tried to access the GPIO on Tiny Core? I am about to try this on Arch but I am really impressed with Tiny Core and would like to use it for my project. Let me know. Thank you so much in advance. =)
-
echo "4" > /sys/class/gpio/export
<snip>
And yes I tried using sudo and I get the same error message.
Just to clarify, did you try:
$ sudo echo "4"> /sys/class/gpio/export
Or did you try:
$ sudo -s
# echo "4" > /sys/class/gpio/export
I would expect the first version to fail, but the second version should work (disclaimer: I don't have a raspberry pi to test on, but you have the same issues piping sudo output on regular x86 machines)
-
Just to clarify, did you try:
$ sudo echo "4"> /sys/class/gpio/export
Or did you try:
$ sudo -s
# echo "4" > /sys/class/gpio/export
I would expect the first version to fail, but the second version should work (disclaimer: I don't have a raspberry pi to test on, but you have the same issues piping sudo output on regular x86 machines)
I tried both
sudo echo "21"> /sys/class/gpio/export
and
sudo su -
echo "21"> /sys/class/gpio/export
and they both failed. But
sudo -s
echo "21" > /sys/class/gpio/export
executes without an error. Thank you! But the voltage on pin 13 is not changing when I type this:
echo "21" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio21/direction
echo "1" > /sys/class/gpio/gpio21/value
echo "0" > /sys/class/gpio/gpio21/value
I think I have this mapped right. I am using this (http://elinux.org/RPi_BCM2835_GPIOs) reference. I also am going to have to get the python thing fixed since that is what I plan to build my project with.
-
sudo -s
echo "21" > /sys/class/gpio/export
executes without an error. Thank you! But the voltage on pin 13 is not changing when I type this:
echo "21" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio21/direction
echo "1" > /sys/class/gpio/gpio21/value
echo "0" > /sys/class/gpio/gpio21/value
I think I have this mapped right. I am using this (http://elinux.org/RPi_BCM2835_GPIOs) reference.
Unfortunately, until I get my hands on a pi, I can't help you with that error message.
I also am going to have to get the python thing fixed since that is what I plan to build my project with.
Post the python errors and I might be able to give you some direction/extra help, if you like. Python is the language most of my not-day-job code is written in.
-
Check you have the latest python extension installed, Nov 9 2012.
Install openssl-1.0.0.tcz, compile-essentials.tcz and python-dev.tcz extensions. In QEMU RPi.GPIO-0.4.1a builds fine. I did not try it on real hw, 5:02 AM here :(
-
I wouldn't know if that's of any relevance for what you try to achieve, but posted output is from ash, not bash.
-
python-RPi.GPIO.tcz added to repository
http://code.google.com/p/raspberry-gpio-python/
-
HI every one.
I test this:
piCore-qemu-20130123.tar.bz2
Download: Qemu-1.3.1-windows.zip , it has :
qemu-system-armw.exe
piCore's start.sh( rename to start.bat) use
qemu-system-arm.exe ,
So must rename: qemu-system-armw.exe --> qemu-system-arm.exe
After tce-load -i python.tcz , I had python works.
tce-load -i python-RPi.GPIO.tcz , OK
but if in python
import RPi.GPIO as GPIO
I get:
ImportError: No module named GPIO
I found dep files (tree files) in URL:
distro.ibiblio.org/tinycorelinux/4.x/armv6/tcz/python-RPi.GPIO.tcz.tree
and I use: tce-load -i python-distribute.tcz,
also I had download and tce-load -i 22 tcz files that python-RPi.GPIO.tcz.tree in list, GPIO module also missing.
What step(s) I had miss?
sorry , I can't use \[code\] \[/code\] without mistake...
-
And I also try to build it in python
I download RPi.GPIO-0.4.2a.tar.gz from pypi.python.org
(and also RPi.GPIO-0.4.1a.tar.gz, the same as 0.4.2a)
After wget and tar it, I run:
(Installed openssl-1.0.0.tcz, compile-essentials.tcz ,python-dev.tcz and gcc.tcz)
cd ./RPi.GPIO-0.4.2a
tce-load -i python-dev.tcz
...
sudo su
python setup.py install
When building "RPi.GPIO" extension, I get :
In file included from /tmp/tcloop/gcc/usr/local/bin/../lib/gcc/armv6l-unknown-linux-gnueabi/4.6.3/include-fixed/syslimits.h:7:0,
from /tmp/tcloop/gcc/usr/local/bin/../lib/gcc/armv6l-unknown-linux-gnueabi/4.6.3/include-fixed/limits.h:34,
from /usr/local/include/python2.7/Python.h:19,
from source/py_gpio.c:23:
/tmp/tcloop/gcc/usr/local/bin/../lib/gcc/armv6l-unknown-linux-gnueabi/4.6.3/include-fixed/limits.h:169:61: fatal error: limits.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
I guess I was missing a "limits.h" file , how can i get it?
miss a *-dev.tcz ?
And I test 0.4.1a.tar.gz , the same.
python.tcz version 2.7.3 (default Dec 26 2012 , 17:02:32)
[GCC 4.6.3] on linux 2
uname -a
Linux box 3.2.27 #2 Sat Sep 15 04:44:32 PDT 2012 armv6l GNU/Linux
-
cattail@
Are you trying GPIO in QUEMU?
-
Hi cattail
I guess I was missing a "limits.h" file , how can i get it?
miss a *-dev.tcz ?
Maybe eglibc_base-dev.tcz
-
I can reproduce the issue on a real RPi with a clean system. Will investigate why module not recognised.
-
bmarkus@
yes, I test (try) RPi.GPIO python module in QEMU 1.3.1(in windows 7)
Rich@
Thank you for the tip, limits.h error not any more.
But maybe my gcc has something wrong, I'll renew a clean piCore to test it.
-
Hi cattail
(Installed openssl-1.0.0.tcz, compile-essentials.tcz ,python-dev.tcz and gcc.tcz)
You should not need to install gcc.tcz or eglibc_base-dev.tcz separately. Compile-essentials.tcz includes the
following as dependencies:
autoconf.tcz
automake.tcz
eglibc_base-dev.tcz
file.tcz
gcc.tcz
libtool.tcz
m4.tcz
make.tcz
patch.tcz
which should be installed automatically.
-
Updated python-RPi.GPIO.tcz installation issue fixed. Please note, it requires root access to run.
-
(Just write here to memory)
After a clean QEMU piCore ,
use: tce , press "s" 4 search, "q" 4 quit info, "i" 4 install these tcz(s)
Xorg-7.6
Xprogs
flwm
wbar
I install XWINDOW on mini CLI mode piCore , and startx can working.
(So I can use Apps select fastest mirror to speed up install tczs.)
install gcc.tcz (tree), python.tcz (tree) , eglibc_base-dev.tcz, openssl-1.0.0.tcz,
(compile-essentials.tcz is not requited?)
I can do this OK
cd RPi.GPIO-0.4.2a
sudo python setup.py install
----------------
Finaly I get RPi.GPIO response , but not know by python setup.py install or new RPi.GPIO(tcz) in repo :
>>>import RPi.GPIO as GPIO
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
RPi.GPIO.SetupException: This module can only be run on a Raspberry Pi!
I guess QEMU not supply GPIO HW simulate .
I have a real Pi board, I'll test on it ( but maybe it have some usb power supply issue...)