This is a cache of https://discuss.96boards.org/t/how-to-access-gpio-android-linux-or-windows/414. It is a snapshot of the page at 2024-10-31T03:14:33.398+0000.
How to access GPIO? android, linux or windows? - DragonBoard410c - 96Boards Forum

How to access GPIO? android, linux or windows?

Hello guys, I was looking some posts at the forum, but couldnt find a clear answer, the dragonboard comes with android preinstalled, so I was wondering if I can access GPIO in android easily? or either way change the image to ubuntu. So, which could be the paths to turn on a simple led on/off, or should I definately change to windows 10?

Greetings

> Hello guys, I was looking some posts at the forum, but couldnt find a clear answer, the dragonboard comes with android preinstalled, so I was wondering if I can access GPIO in android easily?
There are some sample/reference code here: http://forum.odroid.com/viewtopic.php?f=113&t=9020
You should be able to use it to write (and read too if necessary) to a gpio pin to turn an led on/off.

> or either way change the image to ubuntu
To change to Ubuntu, see the instructions here: https://github.com/96boards/documentation/wiki/Dragonboard-410c-Installation-Guide-for-Linux-and-Android#switching-between-android-and-linaro-linux-releases

> or should I definately change to windows 10?
Windows 10 support questions go to Microsoft: https://www.96boards.org/forums/topic/windows-10-dragonboard-410c-support-help/

Hi @beckmx,

Using GPIO and turning on/off LED from the dragonboard, using Debian is probably is the easiest way.

Follow the instruction of installing Debian.

Then install libsoc and 96BoardsGPIO.
“libsoc”
$ sudo apt-get update
$ sudo apt-get install build-essential autoconf libtool libsoc-dev

“96BoardsGPIO”
$ git clone https://github.com/96Boards/96BoardsGPIO.git
$ cd 96BoardsGPIO
./autogen.sh
$ ./configure
$ make
$ sudo make install

Then connect Grove LED module or something similar to GPIO-A on LS-connector.
$ export GPIO_A=36
$ cd /sys/class/gpio
$ echo $GPIO_A | sudo tee export # GPIO_A is 488 on HiKey, 36 on DragonBoard
$ cd gpio$GPIO_A
$ echo out | sudo tee direction
$ echo 1 | sudo tee value # Turn LED on
$ echo 0 | sudo tee value # Turn LED off

I am not sure the 36 is the right number for GPIO_A, so if the LED does not go on and off, try looking the directry of /sys/class/gpio for appropriate number.

thanx, both answers helped me a lot, now the GPS ghost is the only thing I am still missing to make it work