GPIO HIkey 960(Aosp)


#1

I’m new to the Hikey 960 and I wanted to know does the 96boards library works with the hikey 960 and how can I access the GPIOS with aosp version Q?


#2

Which library would you be referring to?

And how do you want to access GPIOs? It really is impossible to guess what you want to accomplish – you need to say it. For example, “I want to use pin X as an interrupt for driver Y that uses hardware Z that connects to I2Cn.”


#3

This is the library that I was refering to about, https://github.com/96Boards/96BoardsGPIO. I have a project that I was using an Asus Tinkerboard on that I want to switch the tinkerboard out for the hikey960. The project uses the gpios for basic high and low signals and some serial along with i2c communication is required.


#4

That library says it isn’t maintained.

I’ll need a lot more details about your project you are trying to convert. A bunch of hardware, obviously, what hardware is it? What drivers does it use? Is there a devicetree overlay for it? Are you aware that 96boards interfacing is at 1.8 volts? If I remember correctly, that Asus board uses 3.3, so you will need level shifters.


#5

The hardware is fine. The project is to add voice control to my car and control a few RGB Lights along with some Relays. I’m using a Movi voice recogniton module over serial that has an ioref pin for the serial communication and a pca9685 to control the lights and then a few pins to drive a uln2008a to control the relays.
So voltage shouldn’t be an issue I just need to figure out how to use the GPIO’s in aosp verison q.
I plan on building an app for in car use like I had for the tinkerboard using Java.


#6

For that movi board, it looks like it will only accept 3.3 or 5.0 volts. You definitely can’t wire it straight into the 96boards SBC. You probably can plug it in THROUGH a “sensors mezzanine” – https://www.96boards.org/product/sensors-mezzanine/ which has a physical interface conforming to arduino patterns, as well as an ATMEGA 328P which can run their library. The ATMEGA 328P hooks to the SBC via UART through a level shifter on the board.

The pca9685 looks like it can technically handle 1.8 volt I/O, HOWEVER, that would be if you supply it with its minimum VDD, which is 2.3 volts. Not exactly a common voltage, so realistically, again, this would require a level shifter. PCA9685 has a driver in the linux kernel, so you will want to enable that in the device tree.

The uln2008a… you sure you don’t mean uln2003? Looks like its meant again for 3.3 or 5.0 volt logic. And this is massive overkill for running relays. You probably can run your accessories directly off the uln, unless they really want a lot of current. If you wire these into the ATMEGA on the sensors mezzanine, then you can use the same uart interface as for the audio hardware to control it, otherwise, you would probably want to write a driver that is appropriate to whatever you are actually controlling with the relays.

So for those last two, again, you will need a level shifter. Fortunately, if you go with the sensors mezzanine (which at the moment appears to be out of stock unless you buy the expensive “kit”), you’ll have both a 3.3v supply, as well as level shifters.

Now as far as AOSP, accessing hardware directly is not going to be an option. That isn’t how Android works. Android requires hardware to be accessed by a hardware abstraction layer, and your custom written software will interface with the hardware abstraction layer.

You’ll probably want to look into the vehicle HAL: https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/master/automotive/vehicle/2.0

And an automotive build of Android;

And I presume that you would like GPS navigation too?
I’ve provided Android patches to GPSd, which are now in their master branch;
https://git.savannah.gnu.org/cgit/gpsd.git