RockpiS/hardware/gpio
ROCK Pi S > Hardware > GPIO
Contents
General purpose input-output (GPIO) connector
ROCK Pi S has two 26-pin expansion headers. Each pin is distinguished by color.
Hardware V10
26-pin Header 1
GPIO number | Func4 | Func3 | Func2 | Func1 | Pin# | Pin# | Func1 | Func2 | Func3 | Func4 | GPIO number | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
+3.3V | 1 | 2 | +5.0V | |||||||||
12 | I2C1_SCL | GPIO0_B4 | 3 | 4 | +5.0V | |||||||
11 | I2C1_SDA | GPIO0_B3 | 5 | 6 | GND | |||||||
69 | I2S0_SCLK_TX | GPIO2_A5 | 7 | 8 | GPIO4_D3 | SDMMC_D3 | UART2_TX_M1 | PMU_ST3 | 155 | |||
64 | SPI0_MISO | UART0_RX | GPIO2_A0 | 9 | 10 | GPIO4_D2 | SDMMC_D2 | UART2_RX_M1 | PMU_ST2 | 154 | ||
65 | SPI0_MOSI | UART0_TX | GPIO2_A1 | 11 | 12 | GPIO0_C0 | PWM3 | I2C3_SCL_M0 | 16 | |||
66 | I2C2_SDA | SPI0_CLK | UART0_CTSN | GPIO2_A2 | 13 | 14 | GND | |||||
67 | I2C2_SCL | SPI0_CSN0 | UART0_RTSN | GPIO2_A3 | 15 | 16 | GPIO2_A7 | I2S0_8CH_LRCK_TX | 71 | |||
+3.3V | 17 | 18 | GPIO2_B1 | I2S0_8CH_SDO0 | 73 | |||||||
55 | SPI2_MOSI | UART2_TX_M0 | UART1_RTSN | GPIO1_C7 | 19 | 20 | GND | |||||
54 | SPI2_MISO | UART2_RX_M0 | UART1_CTSN | GPIO1_C6 | 21 | 22 | GPIO0_B6 | PWM1 | 14 | |||
56 | SPI2_CLK | I2C0_SDA | UART1_RX | GPIO1_D0 | 23 | 24 | GPIO1_D1 | UART1_TX | I2C0_SCL | SPI2_CSN0 | 57 | |
GND | 25 | 26 | GPIO0_B7 | PWM2 | I2C3_SDA_M0 | 15 |
26-pin Header 2
GPIO number | Func3 | Func2 | Func1 | Pin# | Pin# | Func1 | Func2 | Func3 | GPIO number | |
---|---|---|---|---|---|---|---|---|---|---|
GND | 1 | 2 | GPIO2_A6 | I2S0_8CH_SCLK_RX | PDM_CLK_S_M2 | 70 | ||||
ADC_KEY_IN1 | 3 | 4 | GPIO2_B5 | I2S0_8CH_SDI0 | PDM_SDI0_M2 | 77 | ||||
MICBIAS2 | 5 | 6 | GPIO2_B6 | I2S0_8CH_SDI1 | PDM_SDI1_M2 | 78 | ||||
MICBIAS1 | 7 | 8 | GPIO2_B7 | I2S0_8CH_SDI2 | PDM_SDI2_M2 | 79 | ||||
MICN8 | 9 | 10 | MCIP8 | |||||||
MICN7 | 11 | 12 | MCIP7 | |||||||
MICN6 | 13 | 14 | MCIP6 | |||||||
MICN5 | 15 | 16 | MCIP5 | |||||||
MICN4 | 17 | 18 | MCIP4 | |||||||
MICN3 | 19 | 20 | MCIP3 | |||||||
MICN2 | 21 | 22 | MCIP2 | |||||||
MICN1 | 23 | 24 | MCIP1 | |||||||
LINEOUT_R | 25 | 26 | LINEOUT_L |
IO Voltage
RK3308 have two IO voltages, 1.8V/3.3V. For ROCK Pi S, the voltage level of GPIOs showed in the tables above are 3.3V and tolerance of those are 3.63V.
GPIO number
Rockchip RK3308 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.4 kernel, the GPIO number can be calculated as below, take GPIO4_D3(PIN8 on 26PIN GPIO) as an example:
GPIO4_D3 = 32*4 + 8*3 + 3 = 155
To set GPIO4_D3 output
cd /sys/class/gpio echo 155 > export cd gpio155 echo out > direction echo 1 > value # output high echo 0 > value # output low