pin function notes

This commit is contained in:
Owen 2024-05-06 23:00:43 +00:00
parent e751f7b40c
commit 0e57ed326c
7 changed files with 72 additions and 72 deletions

View File

@ -56,7 +56,7 @@ The **D1** SOC runs at 3v3, and you must not exceed this on any of the GPIO pins
Pins are organised into 7 'banks' (*PA*, *PB*, etc to *PG*) of up to 32 pins, but most banks have fewer pins.
There is a big table in the D1 datasheet that shows all possible functions each pin ccan assume.
There is a big table in the D1 datasheet that shows all possible functions each pin can assume.
## GPIO Pin Muxing
The **D1** SOC itself has 88 GPIO pins.
@ -67,7 +67,7 @@ The board has a 'standard' Raspberry Pi compatible 40 pin GPIO connector; 12 are
Internally, the **D1** has a number of internal hardware interfaces for different signal types; 6xUART for serial, 2xSPI, 4xI2C(TWI), 3xI2Si/PCM (audio), 8xPWM, and some additional units for USB, HDMI, Audio, and more (see the Data sheet)
The chip has an internal 'pin muxer' to connect pins to signals. Each pin can connect to a (predefined) set of signals, which allows you to map each pin on the GPIO header to multiple possible functions.
The **D1** chip has an internal 'pin muxer' to connect pins to signals. Each pin can connect to a (predefined) set of signals, which allows you to map each pin on the GPIO header to multiple possible functions.
You can browse the full range of mappings in the Allwinner D1 datasheet, Table 4-3.
- A copy of this table is available here: [reference/d1-pins.pdf](reference/d1-pins.pdf)).

View File

@ -1,10 +1,6 @@
# Precompiled device trees:
Each folder contains a `.dtb` file, which is the compiled device tree itself, plus a `.dts` with the original source and a `.gpio` file showing the GPIO pin mappings.
The tool/data used to assemble the `.gpio` map files identifies which interface a pin is attached to, but not it's specific function for the interface.
* eg it can say 'pinX and pinY are mapped to a UART', but cannot identify which pin is the TX and which is the RX for it; a limitation of the data, my apologies..
* You therefore need to reference the D1 pin mapping table to get the exact functions for pins.
* A copy of this table is available here: [reference/d1-pins.pdf](../reference/d1-pins.pdf)).
## Generic
[The generic device tree I will use in my project, suitable for many occasions](./generic)
@ -46,6 +42,10 @@ In the [tools](../tools) folder there is a python script called `list-pins.py`.
To run it you need to be in that directory, then run:
`python3 list-pins.py MangoPi-MQ-Pro`
* This produces the same map I use in the documentation and `.gpio` files in the folders above.
* The data used to assemble the `.gpio` map files identifies which interface a pin is attached to, but not it's specific function for the interface.
* eg it can say 'pinX and pinY are mapped to a UART', but cannot identify which pin is the TX and which is the RX for it; a limitation of the data, my apologies..
* You therefore need to reference the [D1 pin mapping table](../reference/d1-pins.pdf) to get the exact functions for pins when running this for yourself.
* The `.gpio` files uploaded here *have* been manually edited to note full pin function for convenience.
# Install the Device Tree
Installing is, in principle, simple.

View File

@ -6,16 +6,16 @@ Gpio Header:
3v3 1 --o o-- 2 5v
free (205) PG13 3 --o o-- 4 5v
gpio (2000000.pinctrl:204) PG12 5 --o o-- 6 gnd
free (39) PB7 7 --o o-- 8 PB8 uart0 (2500000.serial:40)
gnd 9 --o o-- 10 PB9 uart0 (2500000.serial:41)
free (39) PB7 7 --o o-- 8 PB8 uart0.tx (2500000.serial:40)
gnd 9 --o o-- 10 PB9 uart0.rx (2500000.serial:41)
gpio (2000000.pinctrl:117) PD21 11 --o o-- 12 PB5 free (37)
free (118) PD22 13 --o o-- 14 gnd
i2c2 (2502800.i2c:32) PB0 15 --o o-- 16 PB1 i2c2 (2502800.i2c:33)
3v3 17 --o o-- 18 PD14 spi1 (4026000.spi:110)
spi1 (4026000.spi:108) PD12 19 --o o-- 20 gnd
spi1 (4026000.spi:109) PD13 21 --o o-- 22 PC1 free (65)
spi1 (4026000.spi:107) PD11 23 --o o-- 24 PD10 spi1 (4026000.spi:106)
gnd 25 --o o-- 26 PD15 spi1 (4026000.spi:111)
i2c2.sck (2502800.i2c:32) PB0 15 --o o-- 16 PB1 i2c2.sda (2502800.i2c:33)
3v3 17 --o o-- 18 PD14 spi1.hold (4026000.spi:110)
spi1.mosi (4026000.spi:108) PD12 19 --o o-- 20 gnd
spi1.miso (4026000.spi:109) PD13 21 --o o-- 22 PC1 free (65)
spi1.clk (4026000.spi:107) PD11 23 --o o-- 24 PD10 spi1.cs (4026000.spi:106)
gnd 25 --o o-- 26 PD15 spi1.wp (4026000.spi:111)
free (145) PE17 27 --o o-- 28 PE16 free (144)
free (42) PB10 29 --o o-- 30 gnd
free (43) PB11 31 --o o-- 32 PC0 ledc (2008000.led-controller:64)

View File

@ -4,24 +4,24 @@
Gpio Header:
func des pin pin des func
3v3 1 --o o-- 2 5v
i2c0 (2502000.i2c:205) PG13 3 --o o-- 4 5v
i2c0 (2502000.i2c:204) PG12 5 --o o-- 6 gnd
free (39) PB7 7 --o o-- 8 PB8 uart0 (2500000.serial:40)
gnd 9 --o o-- 10 PB9 uart0 (2500000.serial:41)
i2c0.sda (2502000.i2c:205) PG13 3 --o o-- 4 5v
i2c0.sck (2502000.i2c:204) PG12 5 --o o-- 6 gnd
free (39) PB7 7 --o o-- 8 PB8 uart0.tx (2500000.serial:40)
gnd 9 --o o-- 10 PB9 uart0.rx (2500000.serial:41)
free (117) PD21 11 --o o-- 12 PB5 free (37)
free (118) PD22 13 --o o-- 14 gnd
free (32) PB0 15 --o o-- 16 PB1 free (33)
3v3 17 --o o-- 18 PD14 spi1 (4026000.spi:110)
spi1 (4026000.spi:108) PD12 19 --o o-- 20 gnd
spi1 (4026000.spi:109) PD13 21 --o o-- 22 PC1 uart2 (2500800.serial:65)
spi1 (4026000.spi:107) PD11 23 --o o-- 24 PD10 spi1 (4026000.spi:106)
gnd 25 --o o-- 26 PD15 spi1 (4026000.spi:111)
i2c3 (2502c00.i2c:145) PE17 27 --o o-- 28 PE16 i2c3 (2502c00.i2c:144)
3v3 17 --o o-- 18 PD14 spi1.hold (4026000.spi:110)
spi1.mosi (4026000.spi:108) PD12 19 --o o-- 20 gnd
spi1.miso (4026000.spi:109) PD13 21 --o o-- 22 PC1 uart2.rx (2500800.serial:65)
spi1.clk (4026000.spi:107) PD11 23 --o o-- 24 PD10 spi1.cs (4026000.spi:106)
gnd 25 --o o-- 26 PD15 spi1.wp (4026000.spi:111)
i2c3.sda (2502c00.i2c:145) PE17 27 --o o-- 28 PE16 i2c3.sck (2502c00.i2c:144)
free (42) PB10 29 --o o-- 30 gnd
free (43) PB11 31 --o o-- 32 PC0 uart2 (2500800.serial:64)
free (43) PB11 31 --o o-- 32 PC0 uart2.tx (2500800.serial:64)
free (44) PB12 33 --o o-- 34 gnd
free (38) PB6 35 --o o-- 36 PB2 uart4 (2501000.serial:34)
free (113) PD17 37 --o o-- 38 PB3 uart4 (2501000.serial:35)
free (38) PB6 35 --o o-- 36 PB2 uart4.tx (2501000.serial:34)
free (113) PD17 37 --o o-- 38 PB3 uart4.rx (2501000.serial:35)
gnd 39 --o o-- 40 PB4 free (36)
Other gpio outputs of interest:

View File

@ -1,28 +1,28 @@
```
MangoPI MQ Pro GPIO header (dtb name: MangoPi MQ Pro)
MangoPI MQ Pro GPIO header (dtb name: MangoPi MQ Pro)
Gpio Header:
func des pin pin des func
3v3 1 --o o-- 2 5v
i2c0 (2502000.i2c:205) PG13 3 --o o-- 4 5v
i2c0 (2502000.i2c:204) PG12 5 --o o-- 6 gnd
free (39) PB7 7 --o o-- 8 PB8 uart0 (2500000.serial:40)
gnd 9 --o o-- 10 PB9 uart0 (2500000.serial:41)
free (117) PD21 11 --o o-- 12 PB5 i2c1 (2502400.i2c:37)
free (118) PD22 13 --o o-- 14 gnd
uart2 (2500800.serial:32) PB0 15 --o o-- 16 PB1 uart2 (2500800.serial:33)
3v3 17 --o o-- 18 PD14 uart3 (2500c00.serial:110)
free (108) PD12 19 --o o-- 20 gnd
uart3 (2500c00.serial:109) PD13 21 --o o-- 22 PC1 i2c2 (2502800.i2c:65)
uart3 (2500c00.serial:107) PD11 23 --o o-- 24 PD10 uart3 (2500c00.serial:106)
gnd 25 --o o-- 26 PD15 free (111)
i2c3 (2502c00.i2c:145) PE17 27 --o o-- 28 PE16 i2c3 (2502c00.i2c:144)
free (42) PB10 29 --o o-- 30 gnd
free (43) PB11 31 --o o-- 32 PC0 i2c2 (2502800.i2c:64)
free (44) PB12 33 --o o-- 34 gnd
free (38) PB6 35 --o o-- 36 PB2 uart4 (2501000.serial:34)
free (113) PD17 37 --o o-- 38 PB3 uart4 (2501000.serial:35)
gnd 39 --o o-- 40 PB4 i2c1 (2502400.i2c:36)
func des pin pin des func
3v3 1 --o o-- 2 5v
i2c0.sda (2502000.i2c:205) PG13 3 --o o-- 4 5v
i2c0.sck (2502000.i2c:204) PG12 5 --o o-- 6 gnd
free (39) PB7 7 --o o-- 8 PB8 uart0.tx (2500000.serial:40)
gnd 9 --o o-- 10 PB9 uart0.rx (2500000.serial:41)
free (117) PD21 11 --o o-- 12 PB5 i2c1.sda (2502400.i2c:37)
free (118) PD22 13 --o o-- 14 gnd
uart2.tx (2500800.serial:32) PB0 15 --o o-- 16 PB1 uart2.rx (2500800.serial:33)
3v3 17 --o o-- 18 PD14 uart3.cts (2500c00.serial:110)
free (108) PD12 19 --o o-- 20 gnd
uart3.rts (2500c00.serial:109) PD13 21 --o o-- 22 PC1 i2c2.sda (2502800.i2c:65)
uart3.rx (2500c00.serial:107) PD11 23 --o o-- 24 PD10 uart3.tx (2500c00.serial:106)
gnd 25 --o o-- 26 PD15 free (111)
i2c3.sda (2502c00.i2c:145) PE17 27 --o o-- 28 PE16 i2c3.sck (2502c00.i2c:144)
free (42) PB10 29 --o o-- 30 gnd
free (43) PB11 31 --o o-- 32 PC0 i2c2.sck (2502800.i2c:64)
free (44) PB12 33 --o o-- 34 gnd
free (38) PB6 35 --o o-- 36 PB2 uart4.tx (2501000.serial:34)
free (113) PD17 37 --o o-- 38 PB3 uart4.rx (2501000.serial:35)
gnd 39 --o o-- 40 PB4 i2c1.sck (2502400.i2c:36)
Other gpio outputs of interest:
-- PD18: Blue Status Led - gpio (2000000.pinctrl:114)

View File

@ -2,27 +2,27 @@
MangoPI MQ Pro GPIO header (dtb name: MangoPi MQ Pro)
Gpio Header:
func des pin pin des func
3v3 1 --o o-- 2 5v
i2c0 (2502000.i2c:205) PG13 3 --o o-- 4 5v
i2c0 (2502000.i2c:204) PG12 5 --o o-- 6 gnd
free (39) PB7 7 --o o-- 8 PB8 uart0 (2500000.serial:40)
gnd 9 --o o-- 10 PB9 uart0 (2500000.serial:41)
free (117) PD21 11 --o o-- 12 PB5 uart5 (2501400.serial:37)
free (118) PD22 13 --o o-- 14 gnd
uart2 (2500800.serial:32) PB0 15 --o o-- 16 PB1 uart2 (2500800.serial:33)
3v3 17 --o o-- 18 PD14 spi1 (4026000.spi:110)
spi1 (4026000.spi:108) PD12 19 --o o-- 20 gnd
spi1 (4026000.spi:109) PD13 21 --o o-- 22 PC1 i2c2 (2502800.i2c:65)
spi1 (4026000.spi:107) PD11 23 --o o-- 24 PD10 spi1 (4026000.spi:106)
gnd 25 --o o-- 26 PD15 spi1 (4026000.spi:111)
i2c3 (2502c00.i2c:145) PE17 27 --o o-- 28 PE16 i2c3 (2502c00.i2c:144)
free (42) PB10 29 --o o-- 30 gnd
free (43) PB11 31 --o o-- 32 PC0 i2c2 (2502800.i2c:64)
free (44) PB12 33 --o o-- 34 gnd
free (38) PB6 35 --o o-- 36 PB2 uart4 (2501000.serial:34)
free (113) PD17 37 --o o-- 38 PB3 uart4 (2501000.serial:35)
gnd 39 --o o-- 40 PB4 uart5 (2501400.serial:36)
func des pin pin des func
3v3 1 --o o-- 2 5v
i2c0.sda (2502000.i2c:205) PG13 3 --o o-- 4 5v
i2c0.sck (2502000.i2c:204) PG12 5 --o o-- 6 gnd
free (39) PB7 7 --o o-- 8 PB8 uart0.tx (2500000.serial:40)
gnd 9 --o o-- 10 PB9 uart0.rx (2500000.serial:41)
free (117) PD21 11 --o o-- 12 PB5 uart5.rx (2501400.serial:37)
free (118) PD22 13 --o o-- 14 gnd
uart2.tx (2500800.serial:32) PB0 15 --o o-- 16 PB1 uart2.rx (2500800.serial:33)
3v3 17 --o o-- 18 PD14 spi1.hold (4026000.spi:110)
spi1.mosi (4026000.spi:108) PD12 19 --o o-- 20 gnd
spi1.miso (4026000.spi:109) PD13 21 --o o-- 22 PC1 i2c2.sda (2502800.i2c:65)
spi1.clk (4026000.spi:107) PD11 23 --o o-- 24 PD10 spi1.cs (4026000.spi:106)
gnd 25 --o o-- 26 PD15 spi1.wp (4026000.spi:111)
i2c3.sda (2502c00.i2c:145) PE17 27 --o o-- 28 PE16 i2c3.sck (2502c00.i2c:144)
free (42) PB10 29 --o o-- 30 gnd
free (43) PB11 31 --o o-- 32 PC0 i2c2.sck (2502800.i2c:64)
free (44) PB12 33 --o o-- 34 gnd
free (38) PB6 35 --o o-- 36 PB2 uart4.tx (2501000.serial:34)
free (113) PD17 37 --o o-- 38 PB3 uart4.rx (2501000.serial:35)
gnd 39 --o o-- 40 PB4 uart5.tx (2501400.serial:36)
Other gpio outputs of interest:
-- PD18: Blue Status Led - gpio (2000000.pinctrl:114)

View File

@ -6,8 +6,8 @@ Gpio Header:
3v3 1 --o o-- 2 5v
free (205) PG13 3 --o o-- 4 5v
free (204) PG12 5 --o o-- 6 gnd
free (39) PB7 7 --o o-- 8 PB8 uart0 (2500000.serial:40)
gnd 9 --o o-- 10 PB9 uart0 (2500000.serial:41)
free (39) PB7 7 --o o-- 8 PB8 uart0.tx (2500000.serial:40)
gnd 9 --o o-- 10 PB9 uart0.rx (2500000.serial:41)
free (117) PD21 11 --o o-- 12 PB5 free (37)
free (118) PD22 13 --o o-- 14 gnd
free (32) PB0 15 --o o-- 16 PB1 free (33)