How to identify GPIO pins


#1

I’m trying to update R64.GPIO for rock960, but I am having a hard time trying to figure out what the header pins are for GPIO.

I only managed to figure out the following pins so far:
Rock960 Signals - GPIO pin
GPIO0_A2 - 1002
GPIO0_A6 - 1006
GPIO1_B1 - 1041
GPIO1_B2 - 1042
GPIO1_C2 - 1050
GPIO1_C7 - 1055
GPIO3_D1 - 1121
GPIO3_D4 - 1124
GPIO3_D5 - 1125
GPIO4_A0 - 1128
GPIO4_A3 - 1131
GPIO4_A4 - 1132

Is there any documentation that would assist?

edit: ok, I’ve just done some simple calculation and deduction to come up with the pins myself…


Rock960 and 96Boards Sensors Mezzanine
#2

The rock960 <-> 96boards LS matching is available at:

I don’t find any document related to gpio-linux <-> gpio-soc matching, however we can find it relatively easily.

If you look in /sys/class/gpio you will see 5 gpio chips registered.

root@rock960:/sys/class/gpio# ls
export        gpiochip1032  gpiochip1096  unexport
gpiochip1000  gpiochip1064  gpiochip1128

We can assume that the GPIO chips correspond to SoC GPIO controller 0,1, 2, 3, 4.
GPIO0_X is exposed as gpiochip1000, GPIO1 as gpiochip1032, etc… each one seems to register 32 GPIOs.
These 32 gpios seem split in four groups of 8 gpios (A, B, C, D), A0 being at offset 0, B0 at offset 8, etc…
So if I’m not wrong : gpio = (1000 + 32 * controller_idx) + gpio_offset

GPIO0_A6 = 1006
GPIO0_A2 = 1002
GPIO1_B1 = 1041

Would be nice to have this added to the documentation and to libmraa.


#3

Thanks! I figured it the same way, and already tested to be sure.

Also, how is rock960 <-> 96boards LS matching any useful generally?

edit: I’ll upload the modded R64.GPIO python GPIO library (original at https://github.com/Leapo/Rock64-R64.GPIO) in a little while. It’s pretty useful given the amount of resources using RPi.GPIO


#4

I don’t really understand is the reason why GPIO numbers start at offset 1000… nothing in the upstream driver indicates this. Nevermind…

Now you have the full matching: Linux <-> SoC <-> LS.


#5

Here is some explaination about gpio offset starting from 1000: