State of gpio on 960?


#1

does the oe or android images support gpio access atm?


Serial (UART) access from Android AOSP on HiKey 960
#2

Did you find a way to use the GPIO from android ?


#3

nope, just sysfs for now. AOSP as is does not have an API for controlling gpio. Maybe @jstultz can throw some light if i am missing something.


#4

I tried it with gcc inline assembly this works without android on the board. But with android it gives a segmentation fault.


#5

Android doesn’t like to access any hardware directly. What you will need to do is create a hal for the hardware you are trying to control, and have the hal access the gpio.

As an alternative to a hal, you could also create a console service that you can connect to using a Unix domain socket and relay data through the socket.

For the most out of your mind level, you can set the sysfs gpio permissions (not forgetting about selinux!) to something very dangerous, and deal with sysfs directly. Highly NOT recommended.


#6

Hi question i try to talk to the gpio using gcc inline assembly and the NDK. I can excute code because printf is working. But when i try to write to the memery mapped IO i get a seg fault. Do i have to set some permissions somewhere? The assembly code is working tested it before by modifying BL1 without AOSP.


#7

@doitright’s post above describes a number of good ways to talk to GPIO, for very good reasons he did not mention doing memory mapped I/O in assembler.

At the bottom level there is already code to wiggle the pins (it is the code that implements the sysfs interface). Either you should build a HAL on top of that, implement a hack on top of that (the later two suggestions) or, if speed matters, write a new kernel driver and build a HAL on top of that.

None of this needs to involve assembly code.


#8

In the end i used /dev/mem and mmap to talk to the GPIO.