The 26-pin expansion port of the Orange Pi Zero is placed on the opposite side of the board compared to Raspberry Pi while the pinout is exactly the same:
OSH Lab created a nice illustration of the Orange Pi Zero expansion port.
Orange Pi Zero GPIO Pins
It took me a while to discover that the General Purpose Input/Output (GPIO) numbering on the Orange Pi Zero with Armbian Legacy 3.4.113 is different from the Raspberry Pi and Raspbian. Here is how Allwinner SoC port names (such as PB12) are mapped to their GPIO pin numbers in the Linux kernel:
(Position of letter in alphabet - 1) * 32 + Pin number
For example, port
PB12 would map to
(2 - 1) * 32 + 12 = 44
Here is an online tool that does the GPIO mapping which I used when creating this illustration of the Orange Pi Zero GPIO pins:
Using the GPIOs
Knowing the GPIO pin numbers is important for building all the Raspberry Pi based projects since their GPIOs are numbered differently (not sure how they do it, probably map to the datasheet?). In the follow-up post I show how to add an LCD monitor to the Orange Pi Zero via the SPI bus.
Very nice, thank you for sharing
I had a hard time using my gpio’s on my orange pi zero.
I use the functionality to control a little fan
Thanks for sharing that!
For which OS it can obtain maximum GPIO speed
I don’t know. Let me know if you figure this out.
With a C program (header wiringPi.h) I have tested the pin cross reference. I found out a different association. In particular:
I could not find the cross reference of physical 19 and 21.
Have you find it?
Did you try running
gpio readall? That should print out the full list of pin association.
I just did a fresh clone and build of the original the wiringPi source which reports the following on an Orange Pi Zero:
I also did a fresh build of the WiringPi clone for Orange Pi Zero and it reports the following:
Note that in both cases pins 19 and 21 are mapped to MOSI and MISO.
yes I used the cmd “gpio readall”. The output is like yours. But based on C program the two pins configured as input (pulled down) do not react to
digitalWrite (j, HIGH)
I'm wondering what could be the reason.