OLIMEX© 2015
A10-OLinuXino-LIME user's manual
If the input signal is to high, you will at least destroy the port!
The algorithms for writing a value to a GPIO port and reading such a value are pretty similar. The
usage of GPIO ports follows the algorithm (we would use GPIO #49 for demonstration purposes):
1. Export GPIO 49:
echo 49 > /sys/class/gpio/export
Note that you can export GPIOs in range with:
for i in `seq 1 1 230`; do echo $i > /sys/class/gpio/export; done
2. Set input/output GPIO 49
2.1 Set input:
echo "in" > /sys/class/gpio/gpio49_ph9/direction
2.2 Set output:
echo "out" > /sys/class/gpio/gpio49_ph9/direction
3. Set value or read value GPIO 49
3.1 Set value:
echo 0 > /sys/class/gpio/gpio49_ph9/value
echo 1 > /sys/class/gpio/gpio49_ph9/value
3.2 Read input:
cat /sys/class/gpio/gpio49_ph9/value
4. Unexport GPIO 49 when finished
echo 49 > /sys/class/gpio/unexport
A very good document on GPIO usage might be found here:
http://www.py6zgp.com/download/A20-GPIO.pdf
– the document was created by Dr. Guido Pelz.
2.8 I2C and SPI under Debian
I2C and SPI are both supported in the latest Debian releases. There is respective kernel support for
both. There is a python module called pyA10Lime might be found here:
https://pypi.python.org/pypi/pyA10Lime
At the same web address you would also find a set of examples on how module is used.
Page 14 of 45