Personal tools

Log in

Changes

From IGEP - ISEE Wiki

Jump to: navigation, search

How to use GPIOs

676 bytes added, 11:10, 5 November 2013
no edit summary
__TOC__
== Overview ==
This How-To is meant to be a starting point for people to learn use GPIOs for IGEP devices as quickly and easily as possible. For this How-To I used [http://labs.isee.biz/index.php/IGEP_firmware_Yocto IGEP firmware Yocto]
There are more ways to use GPIOs, but this one is very . This article show two simpleways to use gpios: bash commandline and C-code.
== Feedback and Contributing ==For this How-To I used [http://labs.isee.biz/index.php/IGEP_firmware_Yocto IGEP firmware Yocto]
=== Feedback and Contributing ===At any point, if you see a mistake you can contribute to this How-To.Edit yourself !
== Requirements ==
For this How-to, I used:
* IGEPv2 Board
* 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]
For this How-to, I used:
* IGEPv2 Board
* [http://labs.isee.biz/images/6/69/Gpio_examplebeta1.tar.bz2 GPIO example]
== Configure IGEPv2Bash commandline ==By default, Basic gpio operations could be done using bash and sysfs :* Export GPIOs <pre>echo "GPIO number NN" > /sys/class/gpio/export</pre>* Unexport GPIOs <pre>echo "GPIO number NN" > /sys/class/gpio/unexport</pre> * Set GPIO direction <pre>echo "out" > /sys/class/gpio/gpioNN/direction</pre>* Set GPIO 156 (J990:20) and value <pre>echo "1" > /sys/class/gpio/gpioNN/value</pre>* Get GPIO 157 (J990:22) are available, connect J990:20 and J990:22 with a cable.value <pre>cat /sys/class/gpio/gpioNN/value</pre>* Configure hardware interrupts <pre>echo "rising" > /sys/class/gpio/gpioNN/edge</pre> 
== C-program Example program ==
C-program Example program contains some libraries C-functions to control GPIOs, libraries . These also can do:
* Export and unexport GPIOs
* Set GPIO direction