How to expand GPIO outputs for Android 9 app

Hi everyone,

I recently bought the VIM3 board because I’d like to develop an Android 9 app where control 6 GPIO outputs for blink some leds. I’ve been searching info through the forum, documentation, etc, and (if I’m not wrong) I’ve seen that VIM3 comes with only 2 GPIO outputs enabled by default on Android. Also I’ve read here (Unexportable GPIO pins on VIM3L) and here (VIM3L GPIO capability) that it’s possible to expand this number of outputs but it seems that it’s only for linux.

Can somebody confirm me if it’s that possible for Android? In that case, could you please explain me or at least guide me on how to do this for investigate on depth?

Thanks in advance.

Hello again!

Since yesterday I’d been investigating and searching information around this community and I found some interesting post that shed some light on the matter.

About this post by @Beir8 (How to access GPIO on Android pie?) I clarified that there is a way to configure more than one pin of the 40-pin GPIO header to make them work as digital input/output on Android Pie. Additionally, @Beir8 's post explains how to modify files in kernel to achieve that GPIO functionality. In there it indicates that it’s necessary to rebuild the Android image to apply that settings. I’ve never done this so I searched on the forum again and I found a related topic where it’s explained how to do it (Building Android Pie for VIM3).

In my application I would like to use the 6 yellow highlighted pins:

Five of them are used for I2S audio, but I think that they can be defined for GPIO as we can see here:

On the other hand, in one of the above mentioned post I found that @quatro explains how it’s posible to disable I2S audio to gain access to pins 29 to 33. The last one (pin 39) I think that is already available by default for GPIO. Therefore, my goal is for the pins to be as follows:

PIN 29 - GPIOA_1
PIN 30 - GPIOA_0
PIN 31 - GPIOA_3
PIN 32 - GPIOA_2
PIN 33 - GPIOA_4
PIN 39 - GPIOZ_15

At this point a question arises for me:

  • How do we calculate the GPIO number list for those pins export?

I would appreciate any suggestion to achieve my objective or any recommendation on that topic. Thanks in advance!

The PIN29 ~ PIN33 is configured as i2s output. You must build your android ROM with source code If you want to use these pins as gpio

Thank you for your reply @Terry !

So is it possible to do it following the steps that you explain here? (Android 7, GPIO)
In that post for Android 7 on VIM1 you say that it’s necessary to modify two files “kvim.dts” and “mesongxl.dtsi”. It is the same for Android 9 on VIM3?

Thank you.

HI, 你好, 也在这贴一起问下,
参考
image
NAME NUM MAX
GPIOA 0-15 16
GPIOAO 0-11 12
GPIOH 0-8 9
GPIOC 0-7 8
GPIOE 0-2 3
GPIOX 0-19 20
GPIOZ 0-15 16

console:/sys/class/gpio # ls
export gpiochip410 gpiochip496 unexport
这些引脚GPIO的地址是如何分配的?

起点410? 最大496, 那每组GPIO的顺序是怎么样的? 就是每组的每个GPIO是如何计算地址值的,

统计了下GPIO只有84个, 496-410有86个, 比84多出了2个.

谢谢, 待复!

你可以进/sys/kernel/debug/pinctrl看下这些管脚。