Difference between revisions of "Rock3/hardware/3c/gpio"
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
<div class="col-md-12 "> | <div class="col-md-12 "> | ||
<div class="panel panel-midnight-white"> | <div class="panel panel-midnight-white"> | ||
− | <div class="panel-heading"><h3>Hardware V1.1</h3></div> | + | <div class="panel-heading"><h3>Hardware V1.1/V1.2</h3></div> |
+ | <div class="panel-heading"><h3> [https://github.com/nascs/wiringX/blob/rock3/docs/source/platforms/radxa/rock3c.rst wiringX GPIO mapping] </h3></div> | ||
<div class="panel-body"> | <div class="panel-body"> | ||
− | {| class="wikitable" style="vertical-align:middle;" | + | {| class="wikitable" style="text-align:center; vertical-align:middle;" |
− | |- style="font-weight:bold | + | |- style="font-weight:bold;" |
! GPIO number | ! GPIO number | ||
+ | ! Function5 | ||
! Function4 | ! Function4 | ||
! Function3 | ! Function3 | ||
Line 17: | Line 19: | ||
! Function2 | ! Function2 | ||
! Function3 | ! Function3 | ||
− | ! Function4 | + | ! style="text-align:left;" | Function4 |
+ | ! Function5 | ||
! GPIO number | ! GPIO number | ||
|- | |- | ||
Line 24: | Line 27: | ||
| | | | ||
| | | | ||
− | | +3.3V | + | | |
+ | | style="background-color:#F00; color:#ffffff;" | +3.3V | ||
| style="background-color:#FF0;" | 1 | | style="background-color:#FF0;" | 1 | ||
| | | | ||
− | | style="background-color:#F00;" | 2 | + | | style="background-color:#F00; color:#FFF;" | 2 |
− | | +5.0V | + | | style="background-color:#F00; color:#FFF;" | +5.0V |
| | | | ||
| | | | ||
+ | | style="text-align:left;" | | ||
| | | | ||
| | | | ||
|- | |- | ||
| 32 | | 32 | ||
− | | | + | | |
| I2C3_SDA_M0 | | I2C3_SDA_M0 | ||
| UART3_RX_M0 | | UART3_RX_M0 | ||
Line 41: | Line 46: | ||
| style="background-color:#008000; color:#FFF;" | 3 | | style="background-color:#008000; color:#FFF;" | 3 | ||
| | | | ||
− | | style="background-color:#F00;" | 4 | + | | style="background-color:#F00; color:#FFF;" | 4 |
− | | +5.0V | + | | style="background-color:#F00; color:#ffffff;" | +5.0V |
| | | | ||
| | | | ||
+ | | style="text-align:left;" | | ||
| | | | ||
| | | | ||
|- | |- | ||
| 33 | | 33 | ||
− | | | + | | |
− | + | ||
| I2C3_SCL_M0 | | I2C3_SCL_M0 | ||
+ | | UART3_TX_M0 | ||
| GPIO1_A1 | | GPIO1_A1 | ||
| style="background-color:#008000; color:#FFF;" | 5 | | style="background-color:#008000; color:#FFF;" | 5 | ||
| | | | ||
− | | style="background-color:# | + | | style="background-color:#333333; color:#FFF;" | 6 |
− | | GND | + | | style="background-color:#333333; color:#FFF;" | GND |
| | | | ||
| | | | ||
+ | | style="text-align:left;" | | ||
| | | | ||
| | | | ||
|- | |- | ||
| 116 | | 116 | ||
+ | | | ||
+ | | PWM14_M0 | ||
| | | | ||
| | | | ||
− | |||
| GPIO3_C4 | | GPIO3_C4 | ||
| style="background-color:#008000; color:#FFF;" | 7 | | style="background-color:#008000; color:#FFF;" | 7 | ||
Line 73: | Line 81: | ||
| style="background-color:#FFA500;" | UART2_TX_M0 | | style="background-color:#FFA500;" | UART2_TX_M0 | ||
| | | | ||
+ | | style="text-align:left;" | | ||
| | | | ||
| 25 | | 25 | ||
Line 80: | Line 89: | ||
| | | | ||
| | | | ||
− | | GND | + | | |
− | | style="background-color:# | + | | style="background-color:#333333; color:#FFF;" | GND |
+ | | style="background-color:#333333; color:#FFF;" | 9 | ||
| | | | ||
| style="background-color:#008000; color:#FFF;" | 10 | | style="background-color:#008000; color:#FFF;" | 10 | ||
Line 87: | Line 97: | ||
| style="background-color:#FFA500;" | UART2_RX_M0 | | style="background-color:#FFA500;" | UART2_RX_M0 | ||
| | | | ||
+ | | style="text-align:left;" | | ||
| | | | ||
| 24 | | 24 | ||
Line 92: | Line 103: | ||
| 97 | | 97 | ||
| | | | ||
− | | | + | | |
− | | | + | | |
+ | | | ||
| GPIO3_A1 | | GPIO3_A1 | ||
| style="background-color:#008000; color:#FFF;" | 11 | | style="background-color:#008000; color:#FFF;" | 11 | ||
Line 101: | Line 113: | ||
| | | | ||
| | | | ||
− | | | + | | style="text-align:left;" | |
+ | | I2S3_SCLK_M0 | ||
| 99 | | 99 | ||
|- | |- | ||
| 98 | | 98 | ||
| | | | ||
− | | | + | | I2S3_MCLK_M0 |
− | | | + | | |
+ | | | ||
| GPIO3_A2 | | GPIO3_A2 | ||
| style="background-color:#008000; color:#FFF;" | 13 | | style="background-color:#008000; color:#FFF;" | 13 | ||
| | | | ||
− | | style="background-color:# | + | | style="background-color:#333333; color:#FFF;" | 14 |
− | | GND | + | | style="background-color:#333333; color:#FFF;" | GND |
| | | | ||
| | | | ||
+ | | style="text-align:left;" | | ||
| | | | ||
| | | | ||
Line 121: | Line 136: | ||
| | | | ||
| | | | ||
− | | | + | | |
+ | | | ||
| GPIO3_B0 | | GPIO3_B0 | ||
| style="background-color:#008000; color:#FFF;" | 15 | | style="background-color:#008000; color:#FFF;" | 15 | ||
Line 129: | Line 145: | ||
| UART4_RX_M1 | | UART4_RX_M1 | ||
| PWM8_M0 | | PWM8_M0 | ||
+ | | style="text-align:left;" | | ||
| | | | ||
| 105 | | 105 | ||
Line 134: | Line 151: | ||
| | | | ||
| | | | ||
− | |||
| | | | ||
− | | +3.3V | + | | |
− | | style="background-color:#008000; color:# | + | | |
+ | | style="background-color:#F00; color:#ffffff;" | +3.3V | ||
+ | | style="background-color:#008000; color:#FFF;" | 17 | ||
| | | | ||
| style="background-color:#008000; color:#FFF;" | 18 | | style="background-color:#008000; color:#FFF;" | 18 | ||
Line 143: | Line 161: | ||
| UART4_TX_M1 | | UART4_TX_M1 | ||
| PWM9_M0 | | PWM9_M0 | ||
+ | | style="text-align:left;" | | ||
| | | | ||
| 106 | | 106 | ||
|- | |- | ||
| 147 | | 147 | ||
+ | | | ||
| PWM15_IR_M1 | | PWM15_IR_M1 | ||
− | |||
| I2S3_SCLK_M1 | | I2S3_SCLK_M1 | ||
+ | | SPI3_MOSI_M1 | ||
| GPIO4_C3 | | GPIO4_C3 | ||
| style="background-color:#008000; color:#FFF;" | 19 | | style="background-color:#008000; color:#FFF;" | 19 | ||
| | | | ||
− | | style="background-color:# | + | | style="background-color:#333333; color:#FFF;" | 20 |
− | | GND | + | | style="background-color:#333333; color:#FFF;" | GND |
| | | | ||
| | | | ||
+ | | style="text-align:left;" | | ||
| | | | ||
| | | | ||
|- | |- | ||
| 149 | | 149 | ||
− | | | + | | UART9_TX_M1 |
− | | | + | | PWM12_M1 |
+ | | I2S3_SDO_M1 | ||
| SPI3_MISO_M1 | | SPI3_MISO_M1 | ||
| GPIO4_C5 | | GPIO4_C5 | ||
Line 171: | Line 193: | ||
| | | | ||
| | | | ||
− | | | + | | style="text-align:left;" | |
+ | | I2S1_SDO2_M2 | ||
| 113 | | 113 | ||
|- | |- | ||
− | |146 | + | | 146 |
| | | | ||
+ | | PWM14_M1 | ||
| I2S3_MCLK_M1 | | I2S3_MCLK_M1 | ||
| SPI3_CLK_M1 | | SPI3_CLK_M1 | ||
Line 185: | Line 209: | ||
| SPI3_CS0_M1 | | SPI3_CS0_M1 | ||
| PWM13_M1 | | PWM13_M1 | ||
− | | | + | | style="text-align:left;" | UART9_RX_M1 |
+ | | I2S3_SDI_M1 | ||
| 150 | | 150 | ||
|- | |- | ||
Line 192: | Line 217: | ||
| | | | ||
| | | | ||
− | | GND | + | | |
− | | style="background-color:# | + | | style="background-color:#333333; color:#FFF;" | GND |
+ | | style="background-color:#333333; color:#FFF;" | 25 | ||
| | | | ||
| style="background-color:#008000; color:#FFF;" | 26 | | style="background-color:#008000; color:#FFF;" | 26 | ||
− | | | + | | NC |
| | | | ||
+ | | | ||
+ | | style="text-align:left;" | | ||
| | | | ||
| | | | ||
− | |||
|- | |- | ||
| 138 | | 138 | ||
| | | | ||
− | |||
| I2C4_SDA_M0 | | I2C4_SDA_M0 | ||
+ | | I2S2_SDI_M1 | ||
+ | | | ||
| GPIO4_B2 | | GPIO4_B2 | ||
− | | style="background-color:# | + | | style="background-color:#0070C0; color:#FFF;" | 27 |
| | | | ||
− | | style="background-color:# | + | | style="background-color:#0070C0; color:#FFF;" | 28 |
| GPIO4_B3 | | GPIO4_B3 | ||
| | | | ||
| | | | ||
− | | | + | | style="text-align:left;" | I2C4_SCL_M0 |
+ | | I2S2_SDO_M1 | ||
| 139 | | 139 | ||
|- | |- | ||
Line 219: | Line 248: | ||
| | | | ||
| | | | ||
− | | | + | | |
+ | | | ||
| GPIO3_B3 | | GPIO3_B3 | ||
| style="background-color:#008000; color:#FFF;" | 29 | | style="background-color:#008000; color:#FFF;" | 29 | ||
| | | | ||
− | | style="background-color:# | + | | style="background-color:#333333; color:#FFF;" | 30 |
− | | GND | + | | style="background-color:#333333; color:#ffffff;" | GND |
| | | | ||
| | | | ||
+ | | style="text-align:left;" | | ||
| | | | ||
| | | | ||
Line 233: | Line 264: | ||
| | | | ||
| | | | ||
− | | | + | | |
+ | | | ||
| GPIO3_B4 | | GPIO3_B4 | ||
| style="background-color:#008000; color:#FFF;" | 31 | | style="background-color:#008000; color:#FFF;" | 31 | ||
| | | | ||
− | | style="background-color:#008000; color:#FFF;" | + | | style="background-color:#008000; color:#FFF;" | 32 |
| GPIO3_C2 | | GPIO3_C2 | ||
− | | | + | | UART5_TX_M1 |
− | + | ||
| | | | ||
+ | | style="text-align:left;" | | ||
+ | | I2S1_SDO3_M2 | ||
| 114 | | 114 | ||
|- | |- | ||
| 115 | | 115 | ||
+ | | UART5_RX_M1 | ||
+ | | | ||
+ | | I2S1_SCLK_RX_M2 | ||
| | | | ||
− | |||
− | |||
| GPIO3_C3 | | GPIO3_C3 | ||
| style="background-color:#008000; color:#FFF;" | 33 | | style="background-color:#008000; color:#FFF;" | 33 | ||
| | | | ||
− | | style="background-color:# | + | | style="background-color:#333333; color:#FFF;" | 34 |
− | | GND | + | | style="background-color:#333333; color:#FFF;" | GND |
| | | | ||
| | | | ||
+ | | style="text-align:left;" | | ||
| | | | ||
| | | | ||
Line 261: | Line 296: | ||
| | | | ||
| | | | ||
+ | | I2S3_LRCK_M0 | ||
| | | | ||
| GPIO3_A4 | | GPIO3_A4 | ||
Line 269: | Line 305: | ||
| | | | ||
| | | | ||
+ | | style="text-align:left;" | | ||
| | | | ||
| 103 | | 103 | ||
Line 275: | Line 312: | ||
| | | | ||
| | | | ||
+ | | I2S1_SCLK_RX_M0 | ||
| | | | ||
| GPIO1_A4 | | GPIO1_A4 | ||
Line 281: | Line 319: | ||
| style="background-color:#008000; color:#FFF;" | 38 | | style="background-color:#008000; color:#FFF;" | 38 | ||
| GPIO3_A6 | | GPIO3_A6 | ||
− | |||
| | | | ||
| | | | ||
+ | | style="text-align:left;" | | ||
+ | | I2S3_SDI_M0 | ||
| 102 | | 102 | ||
|- | |- | ||
Line 290: | Line 329: | ||
| | | | ||
| | | | ||
− | | GND | + | | |
− | | style="background-color:# | + | | style="background-color:#333333; color:#FFF;" | GND |
+ | | style="background-color:#333333; color:#FFF;" | 39 | ||
| | | | ||
| style="background-color:#008000; color:#FFF;" | 40 | | style="background-color:#008000; color:#FFF;" | 40 | ||
| GPIO3_A5 | | GPIO3_A5 | ||
− | |||
| | | | ||
| | | | ||
+ | | style="text-align:left;" | | ||
+ | | I2S3_SDO_M0 | ||
| 101 | | 101 | ||
|} | |} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
=== GPIO number === | === GPIO number === | ||
Line 326: | Line 361: | ||
To set GPIO4_A7 output | To set GPIO4_A7 output | ||
− | + | ||
− | cd /sys/class/gpio | + | cd /sys/class/gpio |
echo 135 > export | echo 135 > export | ||
cd gpio135 | cd gpio135 |
Latest revision as of 03:21, 29 June 2023
Hardware V1.1/V1.2
GPIO number | Function5 | Function4 | Function3 | Function2 | Function1 | Pin# | Pin# | Function1 | Function2 | Function3 | Function4 | Function5 | GPIO number | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+3.3V | 1 | 2 | +5.0V | |||||||||||
32 | I2C3_SDA_M0 | UART3_RX_M0 | GPIO1_A0 | 3 | 4 | +5.0V | ||||||||
33 | I2C3_SCL_M0 | UART3_TX_M0 | GPIO1_A1 | 5 | 6 | GND | ||||||||
116 | PWM14_M0 | GPIO3_C4 | 7 | 8 | GPIO0_D1 | UART2_TX_M0 | 25 | |||||||
GND | 9 | 10 | GPIO0_D0 | UART2_RX_M0 | 24 | |||||||||
97 | GPIO3_A1 | 11 | 12 | GPIO3_A3 | I2S3_SCLK_M0 | 99 | ||||||||
98 | I2S3_MCLK_M0 | GPIO3_A2 | 13 | 14 | GND | |||||||||
104 | GPIO3_B0 | 15 | 16 | GPIO3_B1 | UART4_RX_M1 | PWM8_M0 | 105 | |||||||
+3.3V | 17 | 18 | GPIO3_B2 | UART4_TX_M1 | PWM9_M0 | 106 | ||||||||
147 | PWM15_IR_M1 | I2S3_SCLK_M1 | SPI3_MOSI_M1 | GPIO4_C3 | 19 | 20 | GND | |||||||
149 | UART9_TX_M1 | PWM12_M1 | I2S3_SDO_M1 | SPI3_MISO_M1 | GPIO4_C5 | 21 | 22 | GPIO3_C1 | I2S1_SDO2_M2 | 113 | ||||
146 | PWM14_M1 | I2S3_MCLK_M1 | SPI3_CLK_M1 | GPIO4_C2 | 23 | 24 | GPIO4_C6 | SPI3_CS0_M1 | PWM13_M1 | UART9_RX_M1 | I2S3_SDI_M1 | 150 | ||
GND | 25 | 26 | NC | |||||||||||
138 | I2C4_SDA_M0 | I2S2_SDI_M1 | GPIO4_B2 | 27 | 28 | GPIO4_B3 | I2C4_SCL_M0 | I2S2_SDO_M1 | 139 | |||||
107 | GPIO3_B3 | 29 | 30 | GND | ||||||||||
108 | GPIO3_B4 | 31 | 32 | GPIO3_C2 | UART5_TX_M1 | I2S1_SDO3_M2 | 114 | |||||||
115 | UART5_RX_M1 | I2S1_SCLK_RX_M2 | GPIO3_C3 | 33 | 34 | GND | ||||||||
100 | I2S3_LRCK_M0 | GPIO3_A4 | 35 | 36 | GPIO3_A7 | 103 | ||||||||
36 | I2S1_SCLK_RX_M0 | GPIO1_A4 | 37 | 38 | GPIO3_A6 | I2S3_SDI_M0 | 102 | |||||||
GND | 39 | 40 | GPIO3_A5 | I2S3_SDO_M0 | 101 |
GPIO number
Rockchip RK3566 GPIO has 5 banks, GPIO0 to GPIO4, each bank has 32pins, naming as below:
GPIO0_A0 ~ A7 GPIO0_B0 ~ B7 GPIO0_C0 ~ C7 GPIO0_D0 ~ D7 GPIO1_A0 ~ A7 .... GPIO1_D0 ~ D7
For Rockchip 4.19 kernel, the GPIO number can be calculated as below, take GPIO4_A7 (PIN26 on 40-PIN HEADER) as an example:
GPIO4_A7 = 4*32 + 0*8 + 7 = 135 (A=0, B=1, C=2, D=3)
To set GPIO4_A7 output
cd /sys/class/gpio
echo 135 > export cd gpio135 echo out > direction echo 1 > value # output highecho 0 > value # output low