This commit is contained in:
liuls2002 2023-08-11 16:55:29 +08:00
parent 2fe3003e20
commit 9708b63629
3 changed files with 273 additions and 365 deletions

638
README.md
View File

@ -1,390 +1,298 @@
## How to download wiringOP
### 说明
```
# apt-get update
# apt-get install -y git
# git clone https://github.com/orangepi-xunlong/wiringOP.git
本仓库是将 wiringOP 移植到 MangoPi(H616) 上。需要使用 Orange Pi Zero2的对应的系统镜像。
### 下载
```bash
apt-get update
apt-get install -y git
git clone https://github.com/liuls2002/wiringOP-for-MangoPi-H616.git
```
## How to build wiringOP
#### 编译安装
```bash
cd wiringOP
./build clean
./build
```
# cd wiringOP
# ./build clean
# ./build
### Python版本
```bash
# 下载 orangepi 提供的代码
git clone --recursive https://github.com/orangepi-xunlong/wiringOP-Python.git
cd wiringOP-Python
# 使用本工程中的代码替换 wiringOP-Python 目录下的 wiringOP
cp -r ./wiringOP ./wiringOP-Python
# 安装tools
sudo apt-get install swig python3-dev python3-setuptools
# Build & install with
python3 generate-bindings.py > bindings.i
sudo python3 setup.py install
```
### Mango Pi的官方网站
[Mango Pi official website | Tiny and Elegant SBC | mqquad](https://mangopi.org/mqquad)
---
## The output of the gpio readall command
## Allwinner H2+
### 相较于 Orange Pi 提供的代码的改动
### Orange Pi Zero/R1
Mango Pi(h616) 与 Orange Pi Zero2 使用相同的soc全志H616所以基于 Orange Pi Zero2 进行移植修改比较方便。
```
+------+-----+----------+------+---+ OPi H2 +---+------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| | | 3.3V | | | 1 || 2 | | | 5V | | |
| 12 | 0 | SDA.0 | ALT2 | 0 | 3 || 4 | | | 5V | | |
| 11 | 1 | SCL.0 | ALT2 | 0 | 5 || 6 | | | GND | | |
| 6 | 2 | PWM.1 | OFF | 0 | 7 || 8 | 0 | ALT2 | TXD.1 | 3 | 198 |
| | | GND | | | 9 || 10 | 0 | ALT2 | RXD.1 | 4 | 199 |
| 1 | 5 | RXD.2 | ALT2 | 0 | 11 || 12 | 0 | OFF | PA07 | 6 | 7 |
| 0 | 7 | TXD.2 | ALT2 | 0 | 13 || 14 | | | GND | | |
| 3 | 8 | CTS.2 | OFF | 0 | 15 || 16 | 0 | ALT3 | SDA.1 | 9 | 19 |
| | | 3.3V | | | 17 || 18 | 0 | ALT3 | SCK.1 | 10 | 18 |
| 15 | 11 | MOSI.1 | ALT2 | 1 | 19 || 20 | | | GND | | |
| 16 | 12 | MISO.1 | ALT2 | 0 | 21 || 22 | 0 | OFF | RTS.2 | 13 | 2 |
| 14 | 14 | SCLK.1 | ALT2 | 0 | 23 || 24 | 0 | ALT2 | CE.1 | 15 | 13 |
| | | GND | | | 25 || 26 | 0 | OFF | PA10 | 16 | 10 |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+ OPi H2 +---+------+----------+-----+------+
Mango Pi(h616) 引脚对应关系如下:
<img src="C:\Users\29216\Desktop\wiringOP-master\wiringOP-MangoPi-H616\imgs\pins.png" alt="pins" style="zoom:50%;" />
总共有3种编号board引脚编号芯片引脚编号逻辑引脚编号。控制gpio时一般采用逻辑引脚编号。
==我们需要修改这3者的映射关系。为了简便我将逻辑引脚编号与board的引脚编号保持一致使用时需要注意。==
#### 1 修改 gpio/OrangPi.c
将`#ifdef CONFIG_ORANGEPI_ZERO2`包含的代码替换为如下代码:
```c
#ifdef CONFIG_ORANGEPI_ZERO2
int pinToGpioOrangePi [64] =
{
-1, // 0
-1 , -1 ,
264 , -1 ,
263 , -1 ,
256 , 224 ,
-1 , 225 ,
226 , 257 ,
227 , -1 ,
269 , 270 ,
-1 , 228 ,
231 , -1 ,
232 , 262 ,
230 , 229 ,
-1 , 233 ,
266 , 265 ,
267 , -1 ,
268 , 261 ,
271 , -1 ,
258 , 234 ,
272 , 260 ,
-1 , 259 , // 40
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1,-1, // 63
};
int physToWpi[64] =
{
-1, // 0
-1, -1, // 1, 2
3, -1, //3, 4
5, -1, //5, 6
7, 8, //7, 8
-1, 10, //9,10
11, 12, //11,12
13, -1, //13,14
15, 16, //15,16
-1, 18, //17,18
19, -1, //19,20
21, 22, //21,22
23, 24, //23, 24
-1, 26, // 25, 26
27, 28, //27, 28
29, -1, //29, 30
31, 32, //31, 32
33, -1, //33, 34
35, 36, //35, 36
37, 38, //37, 38
-1, 40, //39, 40
// Padding:
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // ... 56
-1, -1, -1, -1, -1, -1, -1, // ... 63
};
char *physNames[64] =
{
NULL,
" 3.3V", "5V ",
" TWI1_SDA", "5V ",
" TWI1_SCL", "GND ",
"I2S0_MCLK", "TX0",
" GND", "RX0",
" TX5", "I2S_CLK",
" RX5", "GND ",
" TX4/PWM3", "RX4/PWM4",
" 3.3V", "PH4",
"SPI1_MOSI", "GND ",
"SPI1_MISO", "RX2",
" SPI1_CLK", "SPI1_CS0 ",
" GND", "SPI1_CS1",
" TWI2_SDA", "TWI2_SCL",
" PI11", "GND ",
" PI12", "LEDC/TX2",
" PI15", "GND ",
"I2S0_LRCK", "PH10",
" PI16", "I2S0_DOUT",
" GND", "I2S0_DIN",
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
};
#endif
```
## Allwinner H3
### Orange Pi Zero Plus 2
```
+------+-----+----------+------+---+ZEROPLUS 2+---+------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| | | 3.3V | | | 1 || 2 | | | 5V | | |
| 12 | 0 | SDA.0 | ALT2 | 0 | 3 || 4 | | | 5V | | |
| 11 | 1 | SCL.0 | ALT2 | 0 | 5 || 6 | | | GND | | |
| 6 | 2 | PA6 | OFF | 0 | 7 || 8 | 0 | ALT2 | TXD.2 | 3 | 0 |
| | | GND | | | 9 || 10 | 0 | ALT2 | RXD.2 | 4 | 1 |
| 352 | 5 | S-SCL | ALT2 | 0 | 11 || 12 | 0 | OFF | PD11 | 6 | 107 |
| 353 | 7 | S-SDA | ALT2 | 0 | 13 || 14 | | | GND | | |
| 3 | 8 | CTS.2 | OFF | 0 | 15 || 16 | 0 | ALT3 | SDA.1 | 9 | 19 |
| | | 3.3V | | | 17 || 18 | 0 | ALT3 | SCL.1 | 10 | 18 |
| 15 | 11 | MOSI.1 | ALT2 | 0 | 19 || 20 | | | GND | | |
| 16 | 12 | MISO.1 | ALT2 | 0 | 21 || 22 | 0 | OFF | RTS.2 | 13 | 2 |
| 14 | 14 | SCLK.1 | ALT2 | 0 | 23 || 24 | 0 | ALT2 | CE.1 | 15 | 13 |
| | | GND | | | 25 || 26 | 0 | OFF | PD14 | 16 | 110 |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+ZEROPLUS 2+---+------+----------+-----+------+
替换 `void OrangePiReadAll(void)`函数中的部分代码
```c
// 替换前
#elif CONFIG_ORANGEPI_ZERO2
for (pin = 1 ; pin <= 34; pin += 2) // orangepi zero2 引出34pin
// 替换后
#elif CONFIG_ORANGEPI_ZERO2
for (pin = 1 ; pin <= 40; pin += 2) // mangopi 引出40pin
```
### OrangePi One/Lite/Pc/Plus/PcPlus/Plus2e
```
+------+-----+----------+------+---+OrangePiH3+---+------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| | | 3.3V | | | 1 || 2 | | | 5V | | |
| 12 | 0 | SDA.0 | OUT | 0 | 3 || 4 | | | 5V | | |
| 11 | 1 | SCL.0 | OUT | 0 | 5 || 6 | | | GND | | |
| 6 | 2 | PA6 | OUT | 0 | 7 || 8 | 0 | OUT | TXD.3 | 3 | 13 |
| | | GND | | | 9 || 10 | 0 | OUT | RXD.3 | 4 | 14 |
| 1 | 5 | RXD.2 | OUT | 0 | 11 || 12 | 0 | OUT | PD14 | 6 | 110 |
| 0 | 7 | TXD.2 | OUT | 0 | 13 || 14 | | | GND | | |
| 3 | 8 | CTS.2 | OUT | 0 | 15 || 16 | 0 | OUT | PC04 | 9 | 68 |
| | | 3.3V | | | 17 || 18 | 0 | OUT | PC07 | 10 | 71 |
| 64 | 11 | MOSI.0 | OUT | 0 | 19 || 20 | | | GND | | |
| 65 | 12 | MISO.0 | OUT | 0 | 21 || 22 | 0 | OUT | RTS.2 | 13 | 2 |
| 66 | 14 | SCLK.0 | OUT | 0 | 23 || 24 | 0 | OUT | CE.0 | 15 | 67 |
| | | GND | | | 25 || 26 | 0 | OUT | PA21 | 16 | 21 |
| 19 | 17 | SDA.1 | OUT | 0 | 27 || 28 | 0 | OUT | SCL.1 | 18 | 18 |
| 7 | 19 | PA07 | OUT | 0 | 29 || 30 | | | GND | | |
| 8 | 20 | PA08 | OUT | 0 | 31 || 32 | 0 | OUT | RTS.1 | 21 | 200 |
| 9 | 22 | PA09 | OUT | 0 | 33 || 34 | | | GND | | |
| 10 | 23 | PA10 | OUT | 0 | 35 || 36 | 0 | OUT | CTS.1 | 24 | 201 |
| 20 | 25 | PA20 | OUT | 0 | 37 || 38 | 0 | OUT | TXD.1 | 26 | 198 |
| | | GND | | | 39 || 40 | 0 | OUT | RXD.1 | 27 | 199 |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+OrangePiH3+---+------+----------+-----+------+
#### 2 修改 wiringPi/OrangePi.c
将`#ifdef CONFIG_ORANGEPI_ZERO2`包含的代码替换为如下代码:
```c
#ifdef CONFIG_ORANGEPI_ZERO2
int pinToGpioOrangePi [64] =
{
-1, // 0
-1 , -1 ,
264 , -1 ,
263 , -1 ,
256 , 224 ,
-1 , 225 ,
226 , 257 ,
227 , -1 ,
269 , 270 ,
-1 , 228 ,
231 , -1 ,
232 , 262 ,
230 , 229 ,
-1 , 233 ,
266 , 265 ,
267 , -1 ,
268 , 261 ,
271 , -1 ,
258 , 234 ,
272 , 260 ,
-1 , 259 , // 40
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, // 63
};
int physToGpioOrangePi [64] =
{
-1, // 0
-1 , -1 ,
264 , -1 ,
263 , -1 ,
256 , 224 ,
-1 , 225 ,
226 , 257 ,
227 , -1 ,
269 , 270 ,
-1 , 228 ,
231 , -1 ,
232 , 262 ,
230 , 229 ,
-1 , 233 ,
266 , 265 ,
267 , -1 ,
268 , 261 ,
271 , -1 ,
258 , 234 ,
272 , 260 ,
-1 , 259 , // 40
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, // 63
} ;
int physToPinOrangePi [64] =
{
-1, // 0
-1, -1, // 1, 2
3, -1, //3, 4
5, -1, //5, 6
7, 8, //7, 8
-1, 10, //9,10
11, 12, //11,12
13, -1, //13,14
15, 16, //15,16
-1, 18, //17,18
19, -1, //19,20
21, 22, //21,22
23, 24, //23, 24
-1, 26, // 25, 26
27, 28, //27, 28
29, -1, //29, 30
31, 32, //31, 32
33, -1, //33, 34
35, 36, //35, 36
37, 38, //37, 38
-1, 40, //39, 40
// Padding:
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // ... 56
-1, -1, -1, -1, -1, -1, -1, // ... 63
};
int ORANGEPI_PIN_MASK[12][32] = //[BANK] [INDEX]
{
{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,},//PA
{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,},//PB
{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,},//PC
{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,},//PD
{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,},//PE
{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,},//PF
{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,},//PG
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,},//PH
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12,13,14,15,16,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,},//PI
{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,},//PJ
{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,},//PK
{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,},//PE
};
#endif
```
## Allwinner H5
### Orange Pi Zero Plus
```
+------+-----+----------+------+---+ ZEROPLUS +---+------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| | | 3.3V | | | 1 || 2 | | | 5V | | |
| 12 | 0 | SDA.0 | ALT2 | 0 | 3 || 4 | | | 5V | | |
| 11 | 1 | SCL.0 | ALT2 | 0 | 5 || 6 | | | GND | | |
| 6 | 2 | PA6 | OFF | 0 | 7 || 8 | 0 | ALT2 | TXD.1 | 3 | 198 |
| | | GND | | | 9 || 10 | 0 | ALT2 | RXD.1 | 4 | 199 |
| 1 | 5 | RXD.2 | ALT2 | 0 | 11 || 12 | 0 | OFF | PA07 | 6 | 7 |
| 0 | 7 | TXD.2 | ALT2 | 0 | 13 || 14 | | | GND | | |
| 3 | 8 | CTS.2 | OFF | 0 | 15 || 16 | 0 | ALT3 | SDA.1 | 9 | 19 |
| | | 3.3V | | | 17 || 18 | 0 | ALT3 | SCL.1 | 10 | 18 |
| 15 | 11 | MOSI.1 | ALT2 | 0 | 19 || 20 | | | GND | | |
| 16 | 12 | MISO.1 | ALT2 | 0 | 21 || 22 | 0 | OFF | RTS.2 | 13 | 2 |
| 14 | 14 | SCLK.1 | ALT2 | 0 | 23 || 24 | 0 | ALT2 | CE.1 | 15 | 13 |
| | | GND | | | 25 || 26 | 0 | OFF | PA10 | 16 | 10 |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+ ZEROPLUS +---+------+----------+-----+------+
```
---
### Orange Pi Zero Plus 2
### 结果展示
```
+------+-----+----------+------+---+ZEROPLUS 2+---+------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| | | 3.3V | | | 1 || 2 | | | 5V | | |
| 12 | 0 | SDA.0 | ALT2 | 0 | 3 || 4 | | | 5V | | |
| 11 | 1 | SCL.0 | ALT2 | 0 | 5 || 6 | | | GND | | |
| 6 | 2 | PA6 | OFF | 0 | 7 || 8 | 0 | ALT2 | TXD.2 | 3 | 0 |
| | | GND | | | 9 || 10 | 0 | ALT2 | RXD.2 | 4 | 1 |
| 352 | 5 | S-SCL | ALT2 | 0 | 11 || 12 | 0 | OFF | PD11 | 6 | 107 |
| 353 | 7 | S-SDA | ALT2 | 0 | 13 || 14 | | | GND | | |
| 3 | 8 | CTS.2 | OFF | 0 | 15 || 16 | 0 | ALT3 | SDA.1 | 9 | 19 |
| | | 3.3V | | | 17 || 18 | 0 | ALT3 | SCL.1 | 10 | 18 |
| 15 | 11 | MOSI.1 | ALT2 | 0 | 19 || 20 | | | GND | | |
| 16 | 12 | MISO.1 | ALT2 | 0 | 21 || 22 | 0 | OFF | RTS.2 | 13 | 2 |
| 14 | 14 | SCLK.1 | ALT2 | 0 | 23 || 24 | 0 | ALT2 | CE.1 | 15 | 13 |
| | | GND | | | 25 || 26 | 0 | OFF | PD14 | 16 | 110 |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+ZEROPLUS 2+---+------+----------+-----+------+
```
执行`gpio readall`
### Orange Pi Pc 2
```
+------+-----+----------+------+---+ OPi PC2 +---+------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| | | 3.3V | | | 1 || 2 | | | 5V | | |
| 12 | 0 | SDA.0 | ALT2 | 0 | 3 || 4 | | | 5V | | |
| 11 | 1 | SCL.0 | ALT2 | 0 | 5 || 6 | | | GND | | |
| 6 | 2 | PWM.1 | OFF | 0 | 7 || 8 | 0 | OFF | PC05 | 3 | 69 |
| | | GND | | | 9 || 10 | 0 | OFF | PC06 | 4 | 70 |
| 1 | 5 | RXD.2 | ALT2 | 0 | 11 || 12 | 0 | OFF | PD14 | 6 | 110 |
| 0 | 7 | TXD.2 | ALT2 | 0 | 13 || 14 | | | GND | | |
| 3 | 8 | CTS.2 | ALT2 | 0 | 15 || 16 | 0 | OFF | PC04 | 9 | 68 |
| | | 3.3V | | | 17 || 18 | 0 | OFF | PC07 | 10 | 71 |
| 15 | 11 | MOSI.1 | ALT2 | 0 | 19 || 20 | | | GND | | |
| 16 | 12 | MISO.1 | ALT2 | 0 | 21 || 22 | 0 | ALT2 | RTS.2 | 13 | 2 |
| 14 | 14 | SCLK.1 | ALT2 | 0 | 23 || 24 | 0 | ALT2 | CE.1 | 15 | 13 |
| | | GND | | | 25 || 26 | 0 | OFF | PA21 | 16 | 21 |
| 19 | 17 | SDA.1 | ALT3 | 0 | 27 || 28 | 0 | ALT3 | SCL.1 | 18 | 18 |
| 7 | 19 | PA07 | OFF | 0 | 29 || 30 | | | GND | | |
| 8 | 20 | PA08 | OFF | 0 | 31 || 32 | 0 | ALT2 | RTS.1 | 21 | 200 |
| 9 | 22 | PA09 | OFF | 0 | 33 || 34 | | | GND | | |
| 10 | 23 | PA10 | OFF | 0 | 35 || 36 | 0 | ALT2 | CTS.1 | 24 | 201 |
| 107 | 25 | PD11 | OFF | 0 | 37 || 38 | 0 | ALT2 | TXD.1 | 26 | 198 |
| | | GND | | | 39 || 40 | 0 | ALT2 | RXD.1 | 27 | 199 |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+ OPi PC2 +---+------+----------+-----+------+
```
### Orange Pi Prime
```
+------+-----+----------+------+---+ PRIME +---+------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| | | 3.3V | | | 1 || 2 | | | 5V | | |
| 12 | 0 | SDA.0 | ALT2 | 0 | 3 || 4 | | | 5V | | |
| 11 | 1 | SCL.0 | ALT2 | 0 | 5 || 6 | | | GND | | |
| 6 | 2 | PWM.1 | OFF | 0 | 7 || 8 | 0 | OFF | PC05 | 3 | 69 |
| | | GND | | | 9 || 10 | 0 | OFF | PC06 | 4 | 70 |
| 1 | 5 | RXD.2 | ALT2 | 0 | 11 || 12 | 0 | OFF | PD14 | 6 | 110 |
| 0 | 7 | TXD.2 | ALT2 | 0 | 13 || 14 | | | GND | | |
| 3 | 8 | CTS.2 | ALT2 | 0 | 15 || 16 | 0 | OFF | PC04 | 9 | 68 |
| | | 3.3V | | | 17 || 18 | 0 | OFF | PC07 | 10 | 71 |
| 15 | 11 | MOSI.1 | ALT2 | 0 | 19 || 20 | | | GND | | |
| 16 | 12 | MISO.1 | ALT2 | 0 | 21 || 22 | 0 | ALT2 | RTS.2 | 13 | 2 |
| 14 | 14 | SCLK.1 | ALT2 | 0 | 23 || 24 | 0 | ALT2 | CE.1 | 15 | 13 |
| | | GND | | | 25 || 26 | 0 | OFF | PC08 | 16 | 72 |
| 19 | 17 | SDA.1 | ALT3 | 0 | 27 || 28 | 0 | ALT3 | SCL.1 | 18 | 18 |
| 7 | 19 | PA07 | OFF | 0 | 29 || 30 | | | GND | | |
| 8 | 20 | PA08 | OFF | 0 | 31 || 32 | 0 | OFF | PC09 | 21 | 73 |
| 9 | 22 | PA09 | OFF | 0 | 33 || 34 | | | GND | | |
| 10 | 23 | PA10 | OFF | 0 | 35 || 36 | 0 | OFF | PC10 | 24 | 74 |
| 107 | 25 | PD11 | OFF | 0 | 37 || 38 | 0 | OFF | PC11 | 26 | 75 |
| | | GND | | | 39 || 40 | 0 | OFF | PC12 | 27 | 76 |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+ PRIME +---+------+----------+-----+------+
```
## Allwinner A64
### Orange Pi Win/Winplus
```
+------+-----+----------+------+---+ OPi Win +---+------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| | | 3.3V | | | 1 || 2 | | | 5V | | |
| 227 | 0 | SDA.1 | ALT2 | 0 | 3 || 4 | | | 5V | | |
| 226 | 1 | SCL.1 | ALT2 | 0 | 5 || 6 | | | GND | | |
| 362 | 2 | PL10 | OFF | 0 | 7 || 8 | 0 | ALT2 | PL02 | 3 | 354 |
| | | GND | | | 9 || 10 | 0 | ALT2 | PL03 | 4 | 355 |
| 229 | 5 | RXD.3 | ALT2 | 0 | 11 || 12 | 0 | OFF | PD04 | 6 | 100 |
| 228 | 7 | TXD.3 | ALT2 | 0 | 13 || 14 | | | GND | | |
| 231 | 8 | CTS.3 | OUT | 0 | 15 || 16 | 0 | OFF | PL09 | 9 | 361 |
| | | 3.3V | | | 17 || 18 | 0 | OFF | PC04 | 10 | 68 |
| 98 | 11 | MOSI.1 | ALT4 | 0 | 19 || 20 | | | GND | | |
| 99 | 12 | MISO.1 | ALT4 | 0 | 21 || 22 | 0 | OFF | RTS.3 | 13 | 230 |
| 97 | 14 | SCLK.1 | ALT4 | 0 | 23 || 24 | 0 | ALT4 | CE.1 | 15 | 96 |
| | | GND | | | 25 || 26 | 0 | OFF | PD06 | 16 | 102 |
| 143 | 17 | SDA.2 | ALT3 | 0 | 27 || 28 | 0 | ALT3 | SCL.2 | 18 | 142 |
| 36 | 19 | PB04 | OFF | 0 | 29 || 30 | | | GND | | |
| 37 | 20 | PB05 | OFF | 0 | 31 || 32 | 0 | ALT2 | RTS.2 | 21 | 34 |
| 38 | 22 | PB06 | OFF | 0 | 33 || 34 | | | GND | | |
| 39 | 23 | PB07 | OFF | 0 | 35 || 36 | 0 | ALT2 | CTS.2 | 24 | 35 |
| 101 | 25 | PD05 | OFF | 0 | 37 || 38 | 0 | ALT2 | TXD.2 | 26 | 32 |
| | | GND | | | 39 || 40 | 0 | ALT2 | RXD.2 | 27 | 33 |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+ OPi Win +---+------+----------+-----+------+
```
## Allwinner H6
### Orange Pi 3/3 LTS
```
+------+-----+----------+------+---+ OPi 3 +---+------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| | | 3.3V | | | 1 || 2 | | | 5V | | |
| 122 | 0 | SDA.0 | OFF | 0 | 3 || 4 | | | 5V | | |
| 121 | 1 | SCL.0 | OFF | 0 | 5 || 6 | | | GND | | |
| 118 | 2 | PWM.0 | OFF | 0 | 7 || 8 | 0 | OFF | PL02 | 3 | 354 |
| | | GND | | | 9 || 10 | 0 | OFF | PL03 | 4 | 355 |
| 120 | 5 | RXD.3 | ALT4 | 0 | 11 || 12 | 0 | OFF | PD18 | 6 | 114 |
| 119 | 7 | TXD.3 | ALT4 | 0 | 13 || 14 | | | GND | | |
| 362 | 8 | PL10 | OFF | 0 | 15 || 16 | 0 | OFF | PD15 | 9 | 111 |
| | | 3.3V | | | 17 || 18 | 0 | OFF | PD16 | 10 | 112 |
| 229 | 11 | MOSI.1 | ALT2 | 0 | 19 || 20 | | | GND | | |
| 230 | 12 | MISO.1 | ALT2 | 0 | 21 || 22 | 0 | OFF | PD21 | 13 | 117 |
| 228 | 14 | SCLK.1 | ALT2 | 0 | 23 || 24 | 0 | ALT2 | CE.1 | 15 | 227 |
| | | GND | | | 25 || 26 | 0 | OFF | PL08 | 16 | 360 |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+ OPi 3 +---+------+----------+-----+------+
```
### Orange Pi Lite2/OnePlus
```
+------+-----+----------+------+---+ OPi H6 +---+------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| | | 3.3V | | | 1 || 2 | | | 5V | | |
| 230 | 0 | SDA.1 | OFF | 0 | 3 || 4 | | | 5V | | |
| 229 | 1 | SCL.1 | OFF | 0 | 5 || 6 | | | GND | | |
| 228 | 2 | PWM1 | OFF | 0 | 7 || 8 | 0 | OFF | PD21 | 3 | 117 |
| | | GND | | | 9 || 10 | 0 | OFF | PD22 | 4 | 118 |
| 120 | 5 | RXD.3 | ALT4 | 0 | 11 || 12 | 0 | OFF | PC09 | 6 | 73 |
| 119 | 7 | TXD.3 | ALT4 | 0 | 13 || 14 | | | GND | | |
| 122 | 8 | CTS.3 | OFF | 0 | 15 || 16 | 0 | OFF | PC08 | 9 | 72 |
| | | 3.3V | | | 17 || 18 | 0 | OFF | PC07 | 10 | 71 |
| 66 | 11 | MOSI.0 | ALT4 | 0 | 19 || 20 | | | GND | | |
| 67 | 12 | MISO.0 | ALT4 | 0 | 21 || 22 | 0 | OFF | RTS.3 | 13 | 121 |
| 64 | 14 | SCLK.0 | ALT4 | 0 | 23 || 24 | 0 | ALT4 | CE.0 | 15 | 69 |
| | | GND | | | 25 || 26 | 0 | OFF | PH03 | 16 | 227 |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+ OPi H6 +---+------+----------+-----+------+
```
## Allwinner H616
### Orange Pi Zero2/Zero2 LTS/Zero2 B
```
+------+-----+----------+------+---+ Zero 2 +---+------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| | | 3.3V | | | 1 || 2 | | | 5V | | |
| 229 | 0 | SDA.3 | OFF | 0 | 3 || 4 | | | 5V | | |
| 228 | 1 | SCL.3 | OFF | 0 | 5 || 6 | | | GND | | |
| 73 | 2 | PC9 | OFF | 0 | 7 || 8 | 0 | ALT2 | TXD.5 | 3 | 226 |
| | | GND | | | 9 || 10 | 0 | ALT2 | RXD.5 | 4 | 227 |
| 70 | 5 | PC6 | ALT5 | 0 | 11 || 12 | 0 | OFF | PC11 | 6 | 75 |
| 69 | 7 | PC5 | ALT5 | 0 | 13 || 14 | | | GND | | |
| 72 | 8 | PC8 | OFF | 0 | 15 || 16 | 0 | OFF | PC15 | 9 | 79 |
| | | 3.3V | | | 17 || 18 | 0 | OFF | PC14 | 10 | 78 |
| 231 | 11 | MOSI.1 | ALT4 | 0 | 19 || 20 | | | GND | | |
| 232 | 12 | MISO.1 | ALT4 | 0 | 21 || 22 | 0 | OFF | PC7 | 13 | 71 |
| 230 | 14 | SCLK.1 | ALT4 | 0 | 23 || 24 | 0 | ALT4 | CE.1 | 15 | 233 |
| | | GND | | | 25 || 26 | 0 | OFF | PC10 | 16 | 74 |
| 65 | 17 | PC1 | OFF | 0 | 27 || 28 | | | | | |
| 272 | 18 | PI16 | OFF | 0 | 29 || 30 | | | | | |
| 262 | 19 | PI6 | OFF | 0 | 31 || 32 | | | | | |
| 234 | 20 | PH10 | ALT3 | 0 | 33 || 34 | | | | | |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+ Zero 2 +---+------+----------+-----+------+
```
## RockChip RK3399
### Orange Pi RK3399
```
+------+-----+----------+------+---+OPi RK3399+---+------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| | | 3.3V | | | 1 || 2 | | | 5V | | |
| 43 | 0 | SDA.0 | ALT2 | 1 | 3 || 4 | | | 5V | | |
| 44 | 1 | SCL.0 | ALT2 | 1 | 5 || 6 | | | GND | | |
| 64 | 2 | GPIO4 | ALT3 | 0 | 7 || 8 | 0 | ALT2 | Tx | 3 | 148 |
| | | GND | | | 9 || 10 | 1 | ALT2 | Rx | 4 | 147 |
| 80 | 5 | GPIO17 | ALT2 | 0 | 11 || 12 | 0 | ALT3 | GPIO18 | 6 | 65 |
| 81 | 7 | GPIO27 | ALT2 | 0 | 13 || 14 | | | GND | | |
| 82 | 8 | GPIO22 | ALT2 | 0 | 15 || 16 | 0 | IN | GPIO23 | 9 | 66 |
| | | 3.3V | | | 17 || 18 | 0 | IN | GPIO24 | 10 | 67 |
| 39 | 11 | MOSI | ALT2 | 1 | 19 || 20 | | | GND | | |
| 40 | 12 | MISO | ALT2 | 1 | 21 || 22 | 0 | ALT2 | GPIO25 | 13 | 83 |
| 41 | 14 | SCLK | ALT3 | 1 | 23 || 24 | 1 | ALT3 | CS0 | 15 | 42 |
| | | GND | | | 25 || 26 | 0 | ALT2 | CS1 | 16 | 133 |
| 154 | 17 | DNP1 | IN | 0 | 27 || 28 | 1 | IN | DNP2 | 18 | 50 |
| 68 | 19 | GPIO5 | OUT | 1 | 29 || 30 | | | GND | | |
| 69 | 20 | GPIO6 | OUT | 1 | 31 || 32 | 1 | OUT | GPIO12 | 21 | 76 |
| 70 | 22 | GPIO13 | OUT | 1 | 33 || 34 | | | GND | | |
| 71 | 23 | GPIO19 | OUT | 1 | 35 || 36 | 1 | OUT | GPIO16 | 24 | 73 |
| 72 | 25 | GPIO26 | OUT | 1 | 37 || 38 | 0 | IN | GPIO20 | 26 | 74 |
| | | GND | | | 39 || 40 | 0 | ALT4 | GPIO21 | 27 | 75 |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+OPi RK3399+---+------+----------+-----+------+
```
### Orange Pi 4/4B/4 LTS
```
+------+-----+----------+------+---+OrangePi 4+---+---+--+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| | | 3.3V | | | 1 || 2 | | | 5V | | |
| 64 | 0 | I2C2_SDA | ALT3 | 0 | 3 || 4 | | | 5V | | |
| 65 | 1 | I2C2_SCL | ALT3 | 0 | 5 || 6 | | | GND | | |
| 150 | 2 | PWM1 | IN | 0 | 7 || 8 | 1 | ALT2 | I2C3_SCL | 3 | 145 |
| | | GND | | | 9 || 10 | 1 | ALT2 | I2C3_SDA | 4 | 144 |
| 33 | 5 | GPIO1_A1 | IN | 0 | 11 || 12 | 1 | IN | GPIO1_C2 | 6 | 50 |
| 35 | 7 | GPIO1_A3 | OUT | 0 | 13 || 14 | | | GND | | |
| 92 | 8 | GPIO2_D4 | OUT | 1 | 15 || 16 | 0 | IN | GPIO1_C6 | 9 | 54 |
| | | 3.3V | | | 17 || 18 | 0 | IN | GPIO1_C7 | 10 | 55 |
| 40 | 11 | SPI1_TXD | ALT2 | 1 | 19 || 20 | | | GND | | |
| 39 | 12 | SPI1_RXD | ALT2 | 1 | 21 || 22 | 0 | IN | GPIO1_D0 | 13 | 56 |
| 41 | 14 | SPI1_CLK | ALT3 | 1 | 23 || 24 | 1 | ALT3 | SPI1_CS | 15 | 42 |
| | | GND | | | 25 || 26 | 0 | IN | GPIO4_C5 | 16 | 149 |
| 64 | 17 | I2C2_SDA | ALT3 | 0 | 27 || 28 | 0 | ALT3 | I2C2_SCL | 18 | 65 |
| | | I2S0_RX | | | 29 || 30 | | | GND | | |
| | | I2S0_TX | | | 31 || 32 | | | I2S_CLK | | |
| | | I2S0_SCK | | | 33 || 34 | | | GND | | |
| | | I2S0_SI0 | | | 35 || 36 | | | I2S0_SO0 | | |
| | | I2S0_SI1 | | | 37 || 38 | | | I2S0_SI2 | | |
| | | GND | | | 39 || 40 | | | I2S0_SI3 | | |
+------+-----+----------+------+---+----++----+---+------+----------+-----+------+
| GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |
+------+-----+----------+------+---+OrangePi 4+---+---+--+----------+-----+------+
```
<img src="C:\Users\29216\Desktop\wiringOP-master\wiringOP-MangoPi-H616\imgs\readall.png" alt="readall" style="zoom:50%;" />

BIN
imgs/pins.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

BIN
imgs/readall.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB