Personal tools

Log in

Changes

From IGEP - ISEE Wiki

Jump to: navigation, search

How to use GPIOs

122 bytes added, 16:59, 22 September 2015
no edit summary
* Only for C-program example it also needed:
** Add shortcircuit cable between J990:20 and J990:22 pins. By default, GPIO 156 (J990:20) and GPIO 157 (J990:22) are available on these J990 pins.
** [http://labs.isee.biz/images/6/69/Gpio_examplebeta1.tar.bz2 GPIO example]
Another boards tested:
 
*IGEP COM MODULE
*IGEP COM AQUILA
 
== How to chek an GPIO ==
 
The gpio-int-test.c program shows one way of using the sysfs file /sys/class/gpio/gpioXX/value to block program execution using poll() until the input level on GPIOXX changes.
 
[[File:GPIO_TEST.tar]]
== Bash commandline ==
Basic gpio operations could be done using bash and sysfs :
* Export GPIOs <pre>echo "GPIO number NN" > /sys/class/gpio/export</pre>
** For example: '''echo "156" > /sys/class/gpio/export'''<br><br>
* Unexport GPIOs <pre>echo "GPIO number NN" > /sys/class/gpio/unexport</pre>
* Set GPIO direction <pre>echo "out" > /sys/class/gpio/gpioNN/direction</pre>
** For example: '''echo "out" > /sys/class/gpio/gpio156/direction'''<br><br>
* Set GPIO value <pre>echo "1" > /sys/class/gpio/gpioNN/value</pre>
* Get GPIO value <pre>cat /sys/class/gpio/gpioNN/value</pre>
At first remote terminal you should read a message similar like this:
<pre>poll() GPIO 157 interrupt occurred </pre>
 
=== How to chek an GPIO ===
 
The gpio-int-test.c program shows one way of using the sysfs file /sys/class/gpio/gpioXX/value to block program execution using poll() until the input level on GPIOXX changes.
 
[[File:GPIO_TEST.tar]]