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"

(Created page with "{{rockpiE_header}} {{Languages|rockpiE/hardware/gpio}} ROCK Pi E > Hardware > GPIO == <span id="gpio">Ge...")
 
(40-pin Header)
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{rockpiE_header}}
 
{{rockpiE_header}}
 
{{Languages|rockpiE/hardware/gpio}}
 
{{Languages|rockpiE/hardware/gpio}}
 +
 +
__NOTOC__
  
 
     [[rockpiE | ROCK Pi E]] > [[rockpiE/hardware | Hardware]] > [[rockpiE/hardware/gpio | GPIO]]
 
     [[rockpiE | ROCK Pi E]] > [[rockpiE/hardware | Hardware]] > [[rockpiE/hardware/gpio | GPIO]]
  
== <span id="gpio">General purpose input-output (GPIO) connector</span> ==
+
=== <span id="gpio">General purpose input-output (GPIO) connector</span> ===
  
 
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 ">
 
     <div class="panel panel-midnight-white">
 
     <div class="panel panel-midnight-white">
         <div class="panel-heading"><h3>Hardware V10</h3></div>
+
         <div class="panel-heading"><h3>Hardware V1.0/V1.1</h3></div>
 
         <div class="panel-body">
 
         <div class="panel-body">
  
==== 26-pin Header ====
+
==== 40-pin Header ====
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 25: Line 27:
 
| 69||  ||  ||  I2C1_SCL||  GPIO2_A5 || style="background:green; color:white"| 5 || || style="background:black; color:white"| 6 || GND || || || ||  
 
| 69||  ||  ||  I2C1_SCL||  GPIO2_A5 || style="background:green; color:white"| 5 || || style="background:black; color:white"| 6 || GND || || || ||  
 
|-
 
|-
| 100||  UART1_TX || SDMMC0EXT_D0 ||    TSP_D0 || GPIO3_A4 || style="background:green; color:white"| 7 || || style="background:green; color:white"| 8 ||GPIO2_A0 || style="background:orange"| UART2_TX_M1 ||POWERSTATE0 || || 64
+
| 100||  UART1_TX || SDMMC0EXT_D0 ||    TSP_D0 || GPIO3_A4 || style="background:green; color:white"| 7 || || style="background:green; color:white"| 8 ||GPIO2_A0 || style="background:orange"| UART2_TX_M1 || || || 64
 
|-
 
|-
|  ||  ||  ||  || GND || style="background:black; color:white"| 9 || || style="background:green; color:white"|10 || GPIO2_A1 || style="background:orange"| UART2_RX_M1 || POWERSTATE1 || || 65
+
|  ||  ||  ||  || GND || style="background:black; color:white"| 9 || || style="background:green; color:white"|10 || GPIO2_A1 || style="background:orange"| UART2_RX_M1 ||   || || 65
 
|-
 
|-
| 96||    SPI_CLK_M2 || SDMMC0EXT_CMD ||  TSP_VALID || GPIO3_A0  || style="background:green; color:white"|11 || || style="background:green; color:white"|12 || GPIO2_D2 ||  || ||  || 90
+
| 96||    SPI0_CLK || SDMMC0EXT_CMD ||  TSP_VALID || GPIO3_A0  || style="background:green; color:white"|11 || || style="background:green; color:white"|12 || GPIO2_D2 ||  || ||  || 90
 
|-
 
|-
| 104||  SPI_CSN0_M2 ||  ||  TSP_D4|| GPIO3_B0 || style="background:green; color:white"|13 ||  || style="background:black; color:white"|14 || GND || || ||    ||
+
| 104||  SPI0_CSN0 ||  ||  TSP_D4|| GPIO3_B0 || style="background:green; color:white"|13 ||  || style="background:black; color:white"|14 || GND || || ||    ||
 
|-
 
|-
| 98||  SPI_RXD_M2 || SDMMC0EXT_CLK ||  TSP_CLK || GPIO3_A2 || style="background:green; color:white"|15 || || style="background:green; color:white"|16 || USB20DM || || ||    ||
+
| 98||  SPI0_RXD || SDMMC0EXT_CLK ||  TSP_CLK || GPIO3_A2 || style="background:green; color:white"|15 || || style="background:green; color:white"|16 || USB20DM || || ||    ||
 
|-
 
|-
 
| || ||  || || +3.3V || style="background:yellow"|17 || || style="background:green; color:white"|18 ||  USB20DP || || ||    ||
 
| || ||  || || +3.3V || style="background:yellow"|17 || || style="background:green; color:white"|18 ||  USB20DP || || ||    ||
Line 39: Line 41:
 
| 27|| ||  ||SPDIF_TX_M0 ||GPIO0_D3 || style="background:green; color:white"|19 ||  ||style="background:black; color:white"|20 || GND || || ||    ||
 
| 27|| ||  ||SPDIF_TX_M0 ||GPIO0_D3 || style="background:green; color:white"|19 ||  ||style="background:black; color:white"|20 || GND || || ||    ||
 
|-
 
|-
| 83||  CARD_CLK_M1 || PDM_SDI0_M0|| I2S1_SDI || GPIO2_C3 || style="background:green; color:white"|21 ||  || style="background:green; color:white"|22  || GPIO2_B4 || SPI_CSN1_M0 || FLASH_VOL_SEL ||    || 76
+
| 83||  CARD_CLK_M1 || PDM_SDI0_M0|| I2S1_SDI || GPIO2_C3 || style="background:green; color:white"|21 ||  || style="background:green; color:white"|22  || GPIO2_B4 ||   ||   ||    || 76
 
|-
 
|-
| 60|| ||    || CLK32KOUT_M1 || GPIO1_D4 || style="background:green; color:white"|23 ||  || style="background:green; color:white"|24 || GPIO2_A3 || EFUSE_PWREN || POWERSTATE3 ||    || 67
+
| 60|| ||    || CLK32KOUT_M1 || GPIO1_D4 || style="background:green; color:white"|23 ||  || style="background:green; color:white"|24 || GPIO2_A3 || EFUSE_PWREN ||   ||    || 67
 
|-
 
|-
 
||| || ||  ||  GND || style="background:black; color:white"|25  ||  || style="background:green; color:white"|26 || GPIO2_C7 || I2S1_SDO || PDM_FSYNC_M0 || ||  87
 
||| || ||  ||  GND || style="background:black; color:white"|25  ||  || style="background:green; color:white"|26 || GPIO2_C7 || I2S1_SDO || PDM_FSYNC_M0 || ||  87
 
|-
 
|-
| 97||  SPI_TXD_M2 ||SDMMC0EXT_DET ||  TSP_FAIL ||GPIO3_A1 || style="background:green; color:white"|27 ||  || style="background:green; color:white"|28 || GPIO2_C1 || I2S1_LRCK_TX || SPDIF_TX_M1 || TSP_D6_M1 ||  81
+
| 97||  SPI0_TXD ||SDMMC0EXT_DET ||  TSP_FAIL ||GPIO3_A1 || style="background:green; color:white"|27 ||  || style="background:green; color:white"|28 || GPIO2_C1 || I2S1_LRCK_TX || SPDIF_TX_M1 || TSP_D6_M1 ||  81
 
|-
 
|-
 
| 80||    || TSP_D5_M1 || I2S1_LRCK_RX || GPIO2_C0 || style="background:green; color:white"|29 || || style="background:black; color:white"|30 || GND ||  || ||  ||
 
| 80||    || TSP_D5_M1 || I2S1_LRCK_RX || GPIO2_C0 || style="background:green; color:white"|29 || || style="background:black; color:white"|30 || GND ||  || ||  ||
Line 55: 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|| || POWERSTATE2 || IR_RX || GPIO2_A2 || style="background:green; color:white"|39 ||  || 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 66: Line 68:
 
<div class="clearfix"></div>
 
<div class="clearfix"></div>
  
==== More details about 40-pin Header ====
+
==== 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.
 
* 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
 +
 +
<div class="col-md-12 ">
 +
    <div class="panel panel-midnight-white">
 +
        <div class="panel-heading"><h3>Hardware V1.2</h3></div>
 +
        <div class="panel-body">
 +
 +
==== 40-pin Header ====
 +
 +
{| class="wikitable"
 +
! GPIO number ||  Func3 || Func2 ||  Func1 ||  Pin# || || Pin# || Func1 || Func2 || Func3 ||  GPIO number
 +
|-
 +
|  ||  || || +3.3V  || style="background:yellow" | 1 ||  || style="background:red" | 2 || +5.0V  || || |||
 +
|-
 +
| 100  ||  || UART1_TX || GPIO3_A4 || style="background:green; color:white" | 3 ||  || style="background:red" | 4 || +5.0V  || || ||| 
 +
|-
 +
| 102 ||  || UART1_RX || GPIO3_A6 || style="background:green; color:white" | 5 ||  || style="background:black; color:white" | 6 || GND  || || ||| 
 +
|-
 +
| 60 ||  || || GPIO1_D4 ||  style="background:green; color:white" | 7 ||  ||  style="background:green; color:white" | 8 || GPIO2_A0  || style="background:orange" | UART2_TX || |||  64
 +
|-
 +
|  ||  || || GND  || style="background:black; color:white" | 9 ||  ||  style="background:green; color:white" | 10 || GPIO2_A1  || style="background:orange" | UART2_RX || ||| 65
 +
|-
 +
| 66 ||  || PWM_IR || GPIO2_A2 ||  style="background:green; color:white" | 11 ||  ||  style="background:green; color:white" | 12 || GPIO2_C2  || PDM_CLK || I2S1_SCLK |||  82
 +
|-
 +
|  67  ||  || ||GPIO2_A3  ||  style="background:green; color:white" | 13 ||  ||  style="background:black; color:white" | 14 || GND  || || ||| 
 +
|-
 +
|  27 ||  || || GPIO0_D3 ||  style="background:green; color:white" | 15 ||  ||  style="background:green; color:white" | 16 || USB20DM  || || ||| 
 +
|-
 +
| ||  || || +3.3V  || style="background:yellow" | 17 ||  ||  style="background:green; color:white" | 18 || USB20DP  || || |||
 +
|-
 +
| 97  || || SPI0_TXD || GPIO3_A1 ||  style="background:green; color:white" | 19 ||  || style="background:black; color:white" | 20 ||  GND  || || ||| 
 +
|-
 +
| 98  ||  || SPI0_RXD || GPIO3_A2 ||  style="background:green; color:white" | 21 ||  ||  style="background:green; color:white" | 22 || ADC_IN1  || || ||| 
 +
|-
 +
|  96 ||  || SPI0_CLK|| GPIO3_A0 ||  style="background:green; color:white" | 23 ||  ||  style="background:green; color:white" | 24 || GPIO3_B0  || SPI0_CSN0 || |||  104
 +
|-
 +
|    ||  || ||  GND  ||  style="background:black; color:white" | 25 ||  ||  style="background:green; color:white" | 26 || GPIO2_B4  || || |||  76
 +
|-
 +
| 68  ||  || I2C1_SDA || GPIO2_A4  ||  style="background:blue; color:white" | 27 ||  ||  style="background:blue; color:white" | 28 || GPIO2_A5  || I2C1_SCL || |||  69
 +
|-
 +
| 84  || I2S1_SDIO1 || PDM_SDI1 || GPIO2_C4  ||  style="background:green; color:white" | 29 ||  ||  style="background:black; color:white" | 30 ||  GND  || || |||
 +
|-
 +
|  85  || I2S1_SDIO2 || PDM_SDI2 || GPIO2_C5 ||  style="background:green; color:white" | 31 ||  ||  style="background:green; color:white" | 32 || GPIO2_C0  || I2S1_LRCK_RX|| ||| 80
 +
|-
 +
|  70  ||  || PWM2|| GPIO2_A6 ||  style="background:green; color:white" | 33 ||  ||  style="background:black; color:white" | 34 || GND  || || ||| 
 +
|-
 +
|  81  ||  || I2S1_LRCK_TX|| GPIO2_C1 ||  style="background:green; color:white" | 35 ||  ||  style="background:green; color:white" | 36 || GPIO2_B7  || I2S1_MCLK|| |||  79
 +
|-
 +
|  86  ||  || PDM_SDI3 || GPIO2_C6 ||  style="background:green; color:white" | 37 ||  ||  style="background:green; color:white" | 38 || GPIO2_C3  || PDM_SDI0 || I2S1_SDI|||  83
 +
|-
 +
|    ||  || ||  GND ||  style="background:black; color:white" | 39 ||  ||  style="background:green; color:white" | 40 || GPIO2_C7  || PDM_FSYNC || I2S1_SDO|||  87
 +
|}
 +
 +
        </div>
 +
    </div>
 +
</div>
 +
 +
<div class="clearfix"></div>
 +
 +
==== 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 ==
 
== IO Voltage ==
RK3328 have two IO voltages, '''1.8V/3.3V'''.
+
 
 +
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 ==
 
== GPIO number ==

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