Android 4.4 gpio help

(ricky long) #1

Help me with programming the gpio please, I don’t know where to start on this I’ve figured everything else out for my project I just need to get the gpio working please please help

(Manish) #2

Start here:

(Martin) #3

Hi, thats ok for Linux base, but for Android? How to use GPIO under android? Regards Martin

(Manish) #4

Sorry, I assumed it was that straightforward and I was wrong. I am trying to get the same working (SPI and GPIO actually) on Android actually, and here’s what I have understood from multiple forum posts so far (and I could be wrong):

  1. As of now, none of the Android images released for M2 support GPIO (or SPI or I2C). Based on this forum post and contrary to this other forum post
  2. To get it working, we need to flash the correct “fex” file to the correct location in the SD card. Based on the same forum post
  3. But then, there is this official post that says you have to recompile the kernel and flash a few fex files. I tried that and it’s not working for Android images. And, no response from SinoVoip yet.

Once, that’s done, I’ll have to use Android NDK to compile WiringPi for M2. Well, that’s for another day.


Since you as M2 customers do not poke the manufacturer to release updates for the broken OS images they deliver:

It’s still the same: The old combination of u-boot-2011-something and kernel 3.3.0 needs Pin mappings defined in fex files and you can’t use script.bin here but have to recompile u-boot since this fex stuff is merged into the bootloader. And with mainline kernel the GPIOs have to be defined in a device tree file.

But Android will use the aging Allwinner 3.3.0 kernel so unless you either recompile the stuff yourself and exchange a few sectors on your SD-cards or you force the vendor to fix his broken OS images with a small updater you’re simply lost regarding GPIO. Unless these GPIO pins are defined in the fex file you will not be able to use them. You need an updated bootloader since otherwise the GPIO pins do not exist from the software’s point of view.

(Manish) #6

Thanks a lot for the response!! I guess I’ll take some time to actually get it working based on that post (since I am new to M2 in general)

I have actually poked Banana Pi team by asking a question on this forum (last week), raising an issue on Github (last week), and sending a message to ‘BPI Justin’ (today). And, since I only recently started working on M2 and visiting the forums, I went through multiple forum posts to make sure I wasn’t asking something that’s already a FAQ.

But, based on responses from Banana Pi team to multiple issues raised by people like you, memyselfandi (assuming that’s a different person) etc. I kind of realised what kind of information to expect (or not) from the official team. I see that some people from the official team do want to help, but are either very late or choose to ignore some issues randomly.

I was happy to see that they recently posted steps to get SPI working, and they have even mentioned the steps required to recompile the kernel (3.3.0) and the sectors to overwrite in the SD card. But it didn’t work…at least, with the Android images.

Anyway, for now, I am stuck with the hardware and don’t really have a choice of shifting to another one. Really appreciate you helping out in the forums and github (including the issues you’ve opened, fixing them and what not) :smile:


The Android images seem to need a different flashing procedure (PhoenixSuite). But that’s all I know. The vendor should help and provide upgrades or at least one working Android image for the M2 with full hardware support (and defining GPIO pins is a minimum requirement).

(Manish) #8

I flashed the image using Phoenix Card, and overwrote re-compiled parts using dd as per their instructions on github. I assumed the bootloader part would be same on Android as other Linux-based OS.

(ricky long) #9

I’ve been following this issue quite awhile and haven’t been able to figure it out yet if anyone figures gpio under android out PLZ share with me (preferably send me a link to download a copy) thank you and good luck