[Solved] A13-OLinuXino-WIFI GPIO access?

Started by DarkAngel, December 26, 2012, 01:22:37 AM

Previous topic - Next topic

DarkAngel

Hello @all,

I'm new here and I bought me a A13-OLinuXino WIFI.

My question is how can I access the GPIOs in Android?

The only thing I was found was this: https://olimex.wordpress.com/2012/10/24/a13-olinuxino-project-control-relays-and-read-adcs-and-ios-with-android/

But that does not help me to get access to the GPIOs on the board.

Has anybody a idea?

Thank you for your help.  :)

DarkAngel

olimex

the way to have access to the GPIO should be same as in the above example for the I2C access, you have to enable GPIOs in Linux kernel, then with the NDK to write C code which to access the GPIOs and to export them to Java so you can use them in Android.

DarkAngel

Thanks for your answer  :D

I will see if I can make it.

DarkAngel

DarkAngel

So, I'm back and I have it not succeeded  :(

In the A13-SDK source there is no included driver for GPIO which I can activate.

Unlike as in the source for "Building bootable SD-card with Debian Linux".

There are all the files to compile the "sun4i-gpio.ko"

But this help me not because the files from source for "Building bootable SD-card with Debian Linux" are not compatible with the A13-SDK source.

I've tried to compile the "sun4i-gpio.ko" with the source for "Building a bootable SD card" and load it with insmod. But there was an error: "failed (Exec format error)".

How can I add the sun4i-gpio to the A13-SDK to enable GPIOs in Linux kernel?


Thanks for your help  ;)

DarkAngel

bernard

hello, have you found a way to control the GPIOs?  I would be happy to try to use the NDK, but I do not know where to find a piece of C source code that plays with the GPIO and implements that through NDK. 

I think I found the source for accessing those GPIOs:  https://github.com/linux-sunxi/linux-sunxi/blob/sunxi-3.0/drivers/misc/sun4i-gpio.c   ...which appears to essentially use:

gpio_write_one_pin_value() and
gpio_read_one_pin_value()

..dunno where this is defined nor how it works. But someone posted an interesting post on the subject: https://www.olimex.com/forum/index.php?topic=436.0

DarkAngel

So, I have built a new sun4i-gpio.ko and tried insmod but I get these errors:

insmod: ini_module 'sun4i-gpio.ko failed (Interrupted system call)

dmesg: sun4i gpio driver init
       sun4i_gpio_init script_parser_fetch "gpio_para" "gpio_used" error

Any idea how I can fix it?


Thanks for your help  ;)

DarkAngel


DarkAngel

Does nobody has an idea how can fix it?


Thanks for your help  ;)

DarkAngel

JohnS

Generally the answer is to build your own kernel and the module for it as well.

DarkAngel

I have build my own kernel with enabled GPIO.

But dmesg shows me an error:

dmesg: sun4i gpio driver init
       sun4i_gpio_init script_parser_fetch "gpio_para" "gpio_used" error


And when I try to load the module with insmod I get the same error:

insmod: ini_module 'sun4i-gpio.ko failed (Interrupted system call)

dmesg: sun4i gpio driver init
       sun4i_gpio_init script_parser_fetch "gpio_para" "gpio_used" error


Must I modify the sun4i_gpio.c so it works under Android?


DarkAngel

JohnS

I'm not using Android.

Someone posted an app for using it there.

Bernd

I have played around with the GPIO configuration for the Linux boot, but that is the same as for Android.

In my boot configuration there is a script.bin which defines the board configuration where is defined which pin is used for what and so on. The human readable version of this file would be script.fex. The sunxi-tools contain programs bin2fex and fex2bin for conversion.

In my fex file there are the following entries:

[gpio_para]
gpio_used = 1
gpio_num = 5
gpio_pin_1 = port:PB02<1><0><default><default>
gpio_pin_2 = port:PB03<1><0><default><default>
gpio_pin_3 = port:PB04<1><0><default><default>
gpio_pin_4 = port:PB05<1><0><default><default>
gpio_pin_5 = port:PG09<1><1><default><default>


The GPIO driver looks for there and if there are no entries for GPIO, it just quits. I think this is what you are seeing.

I don't know what the parameter in the GPIO configuration mean, but I suspect it is for direction, tristate and so on.

DarkAngel

Hurray ;D
Bernd you are the best. ;D
That was the missing puzzle part.  :D

Thanks for the help  :)

markome

DarkAngel, could you be so kind and compose a short HOWTO how to access GPIO pins on Olinuxino A13 WIFI? Thank you in advance!

andnitro


BJFreeman

Fulltimer since 89