Rock3/hardware/3c/gpio
Hardware V1.1
GPIO number | Function4 | Function3 | Function2 | Function1 | Pin# | Pin# | Function1 | Function2 | Function3 | Function4 | GPIO number | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
+3.3V | 1 | 2 | +5.0V | |||||||||
32 | CAN1_RX_M0 | I2C3_SDA_M0 | UART3_RX_M0 | GPIO1_A0 | 3 | 4 | +5.0V | |||||
33 | CAN1_TX_M0 | UART3_TX_M0 | I2C3_SCL_M0 | GPIO1_A1 | 5 | 6 | GND | |||||
116 | PWM12_M0 | GPIO3_C4 | 7 | 8 | GPIO0_D1 | UART2_TX_M0 | 25 | |||||
GND | 9 | 10 | GPIO0_D0 | UART2_RX_M0 | 24 | |||||||
97 | UART7_TX_M1 | PWM14_M0 | GPIO3_A1 | 11 | 12 | GPIO3_A3 | 99 | |||||
98 | UART7_RX_M1 | PWM15_IR_M0 | GPIO3_A2 | 13 | 14 | GND | ||||||
104 | PWM1_M0 | 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 | SPI3_MOSI_M1 | I2S3_SCLK_M1 | GPIO4_C3 | 19 | 20 | GND | |||||
149 | I2S3_SDO1_M1 | SPI3_MISO_M1 | GPIO4_C5 | 21 | 22 | GPIO3_C1 | 113 | |||||
146 | I2S3_MCLK_M1 | SPI3_CLK_M1 | GPIO4_C2 | 23 | 24 | GPIO4_C6 | SPI3_CS0_M1 | PWM13_M1 | 150 | |||
GND | 25 | 26 | GPIO4_D1 | 153 | ||||||||
138 | SPI3_MOSI_M0 | I2C4_SDA_M0 | GPIO4_B2 | 27 | 28 | GPIO4_B3 | 139 | |||||
107 | I2C1_SCL_M0 | GPIO3_B3 | 29 | 30 | GND | |||||||
108 | I2C5_SDA_M0 | GPIO3_B4 | 31 | 32 | GPIO3_C2 | 114 | ||||||
115 | PWM15_IR_M0 | GPIO3_C3 | 33 | 34 | GND | |||||||
100 | GPIO3_A4 | 35 | 36 | GPIO3_A7 | 103 | |||||||
36 | 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 high echo 0 > value # output low