Please enable javascript, or click here to visit my ecommerce web site powered by Shopify.
Jump to: navigation, search

Rock5/hardware/5a/gpio

< Rock5‎ | hardware‎ | 5a
Revision as of 09:31, 10 January 2023 by Stephen (Talk | contribs)


    ROCK 5 >  Hardware >  ROCK 5A hardware details >  GPIO

General purpose input-output (GPIO) connector

ROCK 5A has one 40-pin expansion header. Each pin is distinguished by color.

GPIO number Function9 Function8 Function7 Function6 Function5 Function4 Function3 Function2 Function1 Pin# Pin# Function1 Function2 Function3 Function4 Function5 Function6 Function7 Function8 Function9 GPIO number
+3.3V 1 2 +5.0V
32 UART6_RX_M1 SPI4_MISO_M2 I2C2_SDA_M4 GPIO1_A0 3 4 +5.0V
33 UART6_TX_M1 SPI4_MOSI_M2 I2C2_SCL_M4 GPIO1_A1 5 6 GND
43 PDM1_CLK1_M1 UART4_TX_M2 SPI0_CLK_M2 GPIO1_B3 7 8 GPIO0_B5 I2C1_SCL_M0 UART2_TX_M0 I2S1_MCLK_M1 13
GND 9 10 GPIO0_B6 I2C1_SDA_M0 UART2_RX_M0 I2S1_SCLK_M1 14
34 PWM0_M2 UART6_RTSN_M1 SPI4_CLK_M2 I2C4_SDA_M3 GPIO1_A2 11 12 GPIO4_A1 SPI0_MOSI_M1 UART9_CTSN_M1 I2S1_SCLK_M0 129
35 PWM1_M2 UART6_CTSN_M1 SPI4_CS0_M2 I2C4_SCL_M3 GPIO1_A3 13 14 GND
140 I2S1_SDO3_M0 SPDIF0_TX_M1 PWM11_IR_M1 UART9_TX_M1 GPIO4_B4 15 16 GPIO1_D6 I2C8_SCL_M2 UART1_RTSN_M1 PWM14_M2 62
+3.3V 17 18 GPIO1_D7 I2C8_SDA_M2 UART1_CTSN_M1 PWM15_IR_M3 63
37 SPI2_MOSI_M0 GPIO1_A5 19 20 GND
36 SPI2_MISO_M0 GPIO1_A4 21 22 GPIO1_B5 SPI0_CS1_M2 UART7_TX_M2 45
38 SPI2_CLK_M0 GPIO1_A6 23 24 GPIO1_A7 SPI2_CS0_M0 PDM1_SDI0_M1 PWM3_IR_M3 39
GND 25 26 SARADC_VIN5
139 CAN1_TX_M1 I2S1_SDO2_M0 PWM15_IR_M1 UART8_CTSN_M0 I2C7_SDA_M3 GPIO4_B3 27 28 GPIO4_B2 I2C7_SCL_M3 SPI0_CS0_M1 UART8_RTSN_M0 PWM14_M1 I2S1_SDO1_M0 CAN1_RX_M1 138
42 PDM1_SDI3_M1 UART4_RX_M2 SPI0_MOSI_M2 GPIO1_B2 29 30 GND
41 PDM1_SDI2_M1 SPI0_MISO_M2 GPIO1_B1 31 32 GPIO4_B0 I2C6_SDA_M3 SPI2_CS1_M1 UART8_TX_M0 I2S1_SDI3_M0 136
44 PDM1_CLK0_M1 UART7_RX_M2 SPI0_CS0_M2 GPIO1_B4 33 34 GND
128 I2S1_MCLK_M0 UART9_RTSN_M1 SPI0_MISO_M1 GPIO4_A0 35 36 GPIO4_A2 SPI0_CLK_M1 I2S1_LRCK_M0 130
40 PDM1_SDI1_M1 SPI2_CS1_M0 GPIO1_B0 37 38 GPIO4_A5 I2C3_SDA_M2 SPI2_MOSI_M1 UART3_TX_M2 I2S1_SDI0_M0 133
GND 39 40 GPIO4_B1 I2C6_SCL_M3 SPI0_CS1_M1 UART8_RX_M0 SPDIF1_TX_M1 I2S1_SDO0_M0 137

IO Voltage

GPIO Voltage Level Tolerance
All GPIO 3.3V 3.63V
SARADC_IN4 1.8V 1.98V

GPIO number

Rockchip RK3588 GPIO has 5 banks, GPIO0 to GPIO4, each bank has 32 pins, naming as below:

GPIO0_A0 ~ A7 
GPIO0_B0 ~ B7
GPIO0_C0 ~ C7
GPIO0_D0 ~ D7
   
GPIO1_A0 ~ A7
....
GPIO1_D0 ~ D7
GPIO2_A0 ~ A7
....
GPIO2_D0 ~ D7
GPIO3_A0 ~ A7
....
GPIO3_D0 ~ D7
GPIO4_A0 ~ A7
....
GPIO4_D0 ~ D7


For Rockchip 5.10 kernel, the GPIO number can be calculated as below, take GPIO4_D5 as an example:

GPIO4_D5 = 32*4 + 8*3 + 5 = 157
(A=0, B=1, C=2, D=3)

Gpio number.png

To set GPIO4_D5 output

# cd /sys/class/gpio
# echo 157 > export
# cd gpio157
# echo out > direction
# echo 1 > value     # output high
# echo 0 > value     # output low