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

Difference between revisions of "RockpiE/hardware/gpio"

(General purpose input-output (GPIO) connector)
(40-pin Header)
 
(4 intermediate revisions by the same user not shown)
Line 9: Line 9:
  
 
ROCK Pi E has one 40-pin expansion header. Each pin is distinguished by color.
 
ROCK Pi E has one 40-pin expansion header. Each pin is distinguished by color.
 +
Before using the 40-pin connector (I mean you may use serial console cable or any HAT.), find where the PIN#1(PCBA silkscreen 1) is on ROCK Pi E.
  
 
<div class="col-md-12 ">
 
<div class="col-md-12 ">
Line 56: Line 57:
 
|  || ||  ||  || ADC_IN1 || style="background:green; color:white"|35 ||  || style="background:green; color:white"|36  || GPIO2_C5 || I2S1_SDIO2 || PDM_SDI2_M0 || CARD_DET_M1 || 85
 
|  || ||  ||  || ADC_IN1 || style="background:green; color:white"|35 ||  || style="background:green; color:white"|36  || GPIO2_C5 || I2S1_SDIO2 || PDM_SDI2_M0 || CARD_DET_M1 || 85
 
|-
 
|-
| 66|| ||    || IR_RX || GPIO2_A2 || style="background:green; color:white"|37  ||  || style="background:green; color:white"|38 || GPIO2_C4 || 2S1_SDIO1 || PDM_SDI1_M0 || CARD_RST_M1 ||  84
+
| 66|| ||    || IR_RX || GPIO2_A2 || style="background:green; color:white"|37  ||  || style="background:green; color:white"|38 || GPIO2_C4 || I2S1_SDIO1 || PDM_SDI1_M0 || CARD_RST_M1 ||  84
 
|-
 
|-
 
|  || ||  ||  || GND  || style="background:black; color:white"|39  ||  || style="background:green; color:white"|40 || GPIO2_C6|| I2S1_SDIO3 || PDM_SDI3_M0 || CARD_IO_M1 ||  86
 
|  || ||  ||  || GND  || style="background:black; color:white"|39  ||  || style="background:green; color:white"|40 || GPIO2_C6|| I2S1_SDIO3 || PDM_SDI3_M0 || CARD_IO_M1 ||  86
Line 70: Line 71:
  
 
* Pin#12(GPIO2_D2) is also the sleep pin of PMIC RK805. Be careful when you try to control it.
 
* Pin#12(GPIO2_D2) is also the sleep pin of PMIC RK805. Be careful when you try to control it.
* Pin#27 and Pin#28 are only for I2C communication.
+
* Pin#3 and Pin#5 are only for I2C communication, not for GPIO operation and so forth.
 
* Pins marked with color orange are designed for debug console.
 
* Pins marked with color orange are designed for debug console.
 
* SPI: x1, SPI0(Pin#11/13/15/27)
 
* SPI: x1, SPI0(Pin#11/13/15/27)
Line 138: Line 139:
 
==== More details about V1.2 40-pin Header ====
 
==== More details about V1.2 40-pin Header ====
  
* Pin#27 and Pin#28 are only for I2C communication.
+
* Pin#27 and Pin#28 are only for I2C communication, not for GPIO operation and so forth.
 
* Pins marked with color orange are designed for debug console.
 
* Pins marked with color orange are designed for debug console.
 
* SPI: x1, SPI0(Pin#19/21/23/24)
 
* SPI: x1, SPI0(Pin#19/21/23/24)

Latest revision as of 12:31, 21 January 2021


    ROCK Pi E >  Hardware >  GPIO

General purpose input-output (GPIO) connector

ROCK Pi E has one 40-pin expansion header. Each pin is distinguished by color. Before using the 40-pin connector (I mean you may use serial console cable or any HAT.), find where the PIN#1(PCBA silkscreen 1) is on ROCK Pi E.

Hardware V1.0/V1.1

40-pin Header

GPIO number Func4 Func3 Func2 Func1 Pin# Pin# Func1 Func2 Func3 Func4 GPIO number
+3.3V 1 2 +5.0V
68 I2C1_SDA GPIO2_A4 3 4 +5.0V
69 I2C1_SCL GPIO2_A5 5 6 GND
100 UART1_TX SDMMC0EXT_D0 TSP_D0 GPIO3_A4 7 8 GPIO2_A0 UART2_TX_M1 64
GND 9 10 GPIO2_A1 UART2_RX_M1 65
96 SPI0_CLK SDMMC0EXT_CMD TSP_VALID GPIO3_A0 11 12 GPIO2_D2 90
104 SPI0_CSN0 TSP_D4 GPIO3_B0 13 14 GND
98 SPI0_RXD SDMMC0EXT_CLK TSP_CLK GPIO3_A2 15 16 USB20DM
+3.3V 17 18 USB20DP
27 SPDIF_TX_M0 GPIO0_D3 19 20 GND
83 CARD_CLK_M1 PDM_SDI0_M0 I2S1_SDI GPIO2_C3 21 22 GPIO2_B4 76
60 CLK32KOUT_M1 GPIO1_D4 23 24 GPIO2_A3 EFUSE_PWREN 67
GND 25 26 GPIO2_C7 I2S1_SDO PDM_FSYNC_M0 87
97 SPI0_TXD SDMMC0EXT_DET TSP_FAIL GPIO3_A1 27 28 GPIO2_C1 I2S1_LRCK_TX SPDIF_TX_M1 TSP_D6_M1 81
80 TSP_D5_M1 I2S1_LRCK_RX GPIO2_C0 29 30 GND
79 TSP_SYNC_M1 I2S1_MCLK GPIO2_B7 31 32 GPIO3_A6 TSP_D2 SDMMC0EXT_D2 UART1_RX 102
82 TSP_D7_M1 PDM_CLK_M0 I2S1_SCLK GPIO2_C2 33 34 GND
ADC_IN1 35 36 GPIO2_C5 I2S1_SDIO2 PDM_SDI2_M0 CARD_DET_M1 85
66 IR_RX GPIO2_A2 37 38 GPIO2_C4 I2S1_SDIO1 PDM_SDI1_M0 CARD_RST_M1 84
GND 39 40 GPIO2_C6 I2S1_SDIO3 PDM_SDI3_M0 CARD_IO_M1 86

More details about V1.0/V1.1 40-pin Header

  • Pin#12(GPIO2_D2) is also the sleep pin of PMIC RK805. Be careful when you try to control it.
  • Pin#3 and Pin#5 are only for I2C communication, not for GPIO operation and so forth.
  • Pins marked with color orange are designed for debug console.
  • SPI: x1, SPI0(Pin#11/13/15/27)
  • I2C: x1, I2C1
  • UART: x2, UART1 and UART2
  • USB: USB20DM(Pin#16) and USB20DP(Pin#18)
  • PDM: x1
  • I2S: x1, I2S1

Hardware V1.2

40-pin Header

GPIO number Func3 Func2 Func1 Pin# Pin# Func1 Func2 Func3 GPIO number
+3.3V 1 2 +5.0V
100 UART1_TX GPIO3_A4 3 4 +5.0V
102 UART1_RX GPIO3_A6 5 6 GND
60 GPIO1_D4 7 8 GPIO2_A0 UART2_TX 64
GND 9 10 GPIO2_A1 UART2_RX 65
66 PWM_IR GPIO2_A2 11 12 GPIO2_C2 PDM_CLK I2S1_SCLK 82
67 GPIO2_A3 13 14 GND
27 GPIO0_D3 15 16 USB20DM
+3.3V 17 18 USB20DP
97 SPI0_TXD GPIO3_A1 19 20 GND
98 SPI0_RXD GPIO3_A2 21 22 ADC_IN1
96 SPI0_CLK GPIO3_A0 23 24 GPIO3_B0 SPI0_CSN0 104
GND 25 26 GPIO2_B4 76
68 I2C1_SDA GPIO2_A4 27 28 GPIO2_A5 I2C1_SCL 69
84 I2S1_SDIO1 PDM_SDI1 GPIO2_C4 29 30 GND
85 I2S1_SDIO2 PDM_SDI2 GPIO2_C5 31 32 GPIO2_C0 I2S1_LRCK_RX 80
70 PWM2 GPIO2_A6 33 34 GND
81 I2S1_LRCK_TX GPIO2_C1 35 36 GPIO2_B7 I2S1_MCLK 79
86 PDM_SDI3 GPIO2_C6 37 38 GPIO2_C3 PDM_SDI0 I2S1_SDI 83
GND 39 40 GPIO2_C7 PDM_FSYNC I2S1_SDO 87

More details about V1.2 40-pin Header

  • Pin#27 and Pin#28 are only for I2C communication, not for GPIO operation and so forth.
  • Pins marked with color orange are designed for debug console.
  • SPI: x1, SPI0(Pin#19/21/23/24)
  • I2C: x1, I2C1
  • UART: x2, UART1 and UART2
  • PWM: x1, PWM2
  • USB: USB20DM(Pin#16) and USB20DP(Pin#18)
  • PDM: x1
  • I2S: x1, I2S1

IO Voltage

RK3328 have two IO voltages, 1.8V/3.3V. For ROCK Pi E, the voltage level of GPIOs showed in the tables above are 3.3V and tolerance of those are 3.6V.

GPIO number

Rockchip RK3328 GPIO has 4 banks, GPIO0 to GPIO3, 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 GPIO2_A2(PIN39 on 40PIN GPIO) as an example:

   GPIO2_A2 = 32*2 + 8*0 + 2 = 66

To set GPIO2_A2 output

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