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 03:31, 4 April 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.

Hardware X1.2

GPIO number Function7 Function6 Function5 Function4 Function3 Function2 Function1 Pin# Pin# Function1 Function2 Function3 Function4 Function5 Function6 Function7 GPIO number
+3.3V 1 2 +5.0V
63 PWM15_IR_M3 UART1_CTSN_M1 I2C8_SDA_M2 GPIO1_D7 3 4 +5.0V
62 PWM14_M2 UART1_RTSN_M1 I2C8_SCL_M2 GPIO1_D6 5 6 GND
43 UART4_TX_M2 SPI0_CLK_M2 PDM1_CLK1_M1 GPIO1_B3 7 8 GPIO0_B5 UART2_TX_M0 I2C1_SCL_M0 I2S1_MCLK_M1 13
GND 9 10 GPIO0_B6 UART2_RX_M0 I2C1_SDA_M0 I2S1_SCLK_M1 14
139 CAN1_TX_M1 PWM15_IR_M1 I2S1_SDO2_M0 UART8_CTSN_M0 I2C7_SDA_M3 GPIO4_B3 11 12 GPIO4_A1 SPI0_MOSI_M1 UART9_CTSN_M1 I2S1_SCLK_M0 129
138 CAN1_RX_M1 PWM14_M1 I2S1_SDO1_M0 UART8_RTSN_M0 SPI0_CS0_M1 I2C7_SCL_M3 GPIO4_B2 13 14 GND
140 I2S1_SDO3_M0 SPDIF0_TX_M1 PWM11_IR_M1 UART9_TX_M1 GPIO4_B4 15 16 GPIO1_A5 SPI2_MOSI_M0 37
+3.3V 17 18 GPIO1_B0 PDM1_SDI1_M1 SPI2_CS1_M0 40
33 UART6_TX_M1 SPI4_MOSI_M2 I2C2_SCL_M4 GPIO1_A1 19 20 GND
32 UART6_RX_M1 SPI4_MISO_M2 I2C2_SDA_M4 GPIO1_A0 21 22 GPIO1_B5 SPI0_CS1_M2 UART7_TX_M2 45
34 PWM0_M2 UART6_RTSN_M1 SPI4_CLK_M2 I2C4_SDA_M3 GPIO1_A2 23 24 GPIO1_A3 I2C4_SCL_M3 SPI4_CS0_M2 UART6_CTSN_M1 PWM1_M2 35
GND 25 26 GPIO1_A4 SPI2_MISO_M0 36
23 SPI0_MISO_M0 I2S1_SDI2_M1 I2C6_SDA_M0 PDM0_SDI0_M1 UART1_RTSN_M2 PWM6_M0 GPIO0_C7 27 28 GPIO0_D0 PWM7_IR_M0 UART1_CTSN_M2 PDM0_SDI1_M1 I2C6_SCL_M0 I2S1_SDI3_M1 SPI3_MISO_M2 24
42 UART4_RX_M2 SPI0_MOSI_M2 PDM1_SDI3_M1 GPIO1_B2 29 30 GND
41 SPI0_MISO_M2 PDM1_SDI2_M1 GPIO1_B1 31 32 GPIO4_B0 I2C6_SDA_M3 SPI2_CS1_M1 UART8_TX_M0 I2S1_SDI3_M0 136
44 UART7_RX_M2 SPI0_CS0_M2 PDM1_CLK0_M1 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
SARADC_VIN2 37 38 GPIO4_A5 I2C3_SDA_M2 UART3_TX_M2 UART3_TX_M2 I2S1_SDI0_M0 133
GND 39 40 GPIO4_B1 I2C6_SCL_M3 SPI0_CS1_M1 UART8_RX_M0 I2S1_SDO0_M0 SPDIF1_TX_M1 137

More details about X1.2 Headers

  • Pins marked with color orange are designed for debug console.


Hardware X1.1

GPIO number Function6 Function5 Function4 Function3 Function2 Function1 Pin# Pin# Function1 Function2 Function3 Function4 Function5 Function6 Function7 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_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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 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

More details about X1.1 Headers

  • Pins marked with color orange are designed for debug console.
  • PWM: X6
    • PWM0
      • sysfs: /sys/class/pwm/pwmchip0
      • Pin#11 PWM0_M2
    • PWM1
      • sysfs: /sys/class/pwm/pwmchip1
      • Pin#13 PWM1_M2
    • PWM3
      • sysfs: /sys/class/pwm/pwmchip3
      • Pin#24 PWM3_IR_M3
    • PWM11
      • sysfs: /sys/class/pwm/pwmchip11
      • Pin#15 PWM11_IR_M1
    • PWM14
      • sysfs: /sys/class/pwm/pwmchip14
      • Pin#16 PWM14_M2
      • Pin#28 PWM14_M1
    • PWM15
      • sysfs: /sys/class/pwm/pwmchip15
      • Pin#18 PWM15_IR_M3
      • Pin#27 PWM15_IR_M1
  • I2C: X5
    • I2C-1
      • device: /sys/i2c-1
      • Pin#10 I2C1_SDA_M0 + Pin#8 I2C1_SCL_M0
    • I2C-4
      • device: /sys/i2c-4
      • Pin#11 I2C4_SDA_M3 + Pin#13 I2C4_SCL_M3
    • I2C-6
      • device: /sys/i2c-6
      • Pin#32 I2C6_SDA_M3 + Pin#40 I2C6_SCL_M3
    • I2C-7
      • device: /sys/i2c-7
      • Pin#27 I2C7_SDA_M3 + Pin#28 I2C7_SCL_M3
      • Each pin is connected to the 3.3V supply through a 2.2K pull-up resistor.
    • I2C-8
      • device: /sys/i2c-8
      • Pin#18 I2C8_SDA_M2 + Pin#16 I2C8_SCL_M2
  • SPI: X3
    • SPI0
    • SPI2
    • SPI4
  • UART: X5
    • UART2
    • UART4
    • UART6
    • UART7
    • UART8
  • ADC: X1
    • Pin#26 SARADC_VIN5
  • CAN: X1, CAN1
  • USB 2.0: X1, USB_DP(PIN#27) + USB_DM(PIN#28)
    • When selecting the USB function, we need to rework the hardware like this.
      • Add R104 and R106
      • Remove R169 and R170
  • I2S
  • PDM
  • S/PDIF

IO Voltage

GPIO Voltage Level Tolerance
All GPIO 3.3V 3.63V
SARADC_IN5 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