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

Difference between revisions of "Rock3/CM3/e23/GPIO"

< Rock3‎ | CM3‎ | e23
m (General purpose input-output (GPIO) connector)
 
(4 intermediate revisions by 2 users not shown)
Line 2: Line 2:
 
{{Languages|rock3/cm3/e23/GPIO}}
 
{{Languages|rock3/cm3/e23/GPIO}}
  
     [[rock3 | ROCK 3]] > [[rock3/CM3 | ROCK 3 Compute Module]] > [[rock3/CM3/radxae23 | Radxa E23]] > [[rock3/CM3/radxae23/GPIO | GPIO]]
+
     [[rock3 | ROCK 3]] > [[rock3/CM3 | ROCK 3 Compute Module]] > [[rock3/CM3/e23 | Radxa E23]] > [[rock3/CM3/e23/GPIO | GPIO]]
  
Radxa E23 has one 40-pin expansion header.
+
== <span id="gpio">General purpose input-output (GPIO) connector</span> ==
  
{{rock e23_header}}
+
Radxa E23 has a 40-pin expansion header. Each pin is distinguished by color.
{{Languages|rock e23/hardware/gpio}}
+
  
 
 
 
<div class="col-md-12 ">
 
<div class="col-md-12 ">
 
     <div class="panel panel-midnight-white">
 
     <div class="panel panel-midnight-white">
Line 47: Line 45:
 
| 32
 
| 32
 
|  
 
|  
|
 
|UART3_RX_M0
 
 
| I2C3_SDA_M0
 
| I2C3_SDA_M0
 +
| UART3_RX_M0
 +
| GPIO1_A0
 
| style="background-color:#008000; color:#FFF;" | 3
 
| style="background-color:#008000; color:#FFF;" | 3
 
|  
 
|  
Line 61: Line 59:
 
| 33
 
| 33
 
|  
 
|  
|  
+
| UART3_TX_M0
 
| I2C3_SCL_M0
 
| I2C3_SCL_M0
| UART3_TX_M0
+
| GPIO1_A1
 
| style="background-color:#008000; color:#FFF;" | 5
 
| style="background-color:#008000; color:#FFF;" | 5
 
|  
 
|  
Line 75: Line 73:
 
| 21
 
| 21
 
|  
 
|  
|  
+
| SPI0_MISO_M0
 
| PWM6
 
| PWM6
| SPI0_MISO_M0
+
| GPIO0_C5
 
| style="background-color:#008000; color:#FFF;" | 7
 
| style="background-color:#008000; color:#FFF;" | 7
 
|  
 
|  
 
| style="background-color:#008000; color:#FFF;" | 8
 
| style="background-color:#008000; color:#FFF;" | 8
 +
| GPIO0_D1
 
| style="background-color:#FFA500;" | UART2_TX_M0
 
| style="background-color:#FFA500;" | UART2_TX_M0
|
 
 
|  
 
|  
 
|  
 
|  
Line 95: Line 93:
 
|  
 
|  
 
| style="background-color:#008000; color:#FFF;" | 10
 
| style="background-color:#008000; color:#FFF;" | 10
 +
| GPIO0_D0
 
| style="background-color:#FFA500;" | UART2_RX_M0
 
| style="background-color:#FFA500;" | UART2_RX_M0
|
 
 
|  
 
|  
 
|  
 
|  
Line 103: Line 101:
 
| 97
 
| 97
 
|  
 
|  
|
+
|  
 
| SPI1_CS0_M1
 
| SPI1_CS0_M1
| SDMMC2_D0_M1
+
| GPIO3_A1
 
| style="background-color:#008000; color:#FFF;" | 11
 
| style="background-color:#008000; color:#FFF;" | 11
 
|  
 
|  
 
| style="background-color:#008000; color:#FFF;" | 12
 
| style="background-color:#008000; color:#FFF;" | 12
| PDM_SDI1_M2
+
| GPIO3_B4
| GMAC1_RXER_M0
+
 
| I2C5_SDA_M0
 
| I2C5_SDA_M0
 +
|
 
|  
 
|  
 
| 108
 
| 108
 
|-
 
|-
 
| 20
 
| 20
|  
+
| UART0_RTSn
 
| PWM5
 
| PWM5
 
| SPI0_CS1_M0
 
| SPI0_CS1_M0
| UART0_RTSn
+
| GPIO0_C4
 
| style="background-color:#008000; color:#FFF;" | 13
 
| style="background-color:#008000; color:#FFF;" | 13
 
|  
 
|  
Line 131: Line 129:
 
| 22
 
| 22
 
|  
 
|  
|  
+
| SPI0_CS0_M0
 
| PWM7_IR
 
| PWM7_IR
| SPI0_CS0_M0
+
| GPIO0_C6
 
| style="background-color:#008000; color:#FFF;" | 15
 
| style="background-color:#008000; color:#FFF;" | 15
 
|  
 
|  
Line 143: Line 141:
 
|  
 
|  
 
|-
 
|-
| 17
+
|  
 
|  
 
|  
 
|
 
|
 
|  
 
|  
|  
+
| NC
| style="background-color:#FF0;" | 17
+
| style="background-color:#008000; color:#FFF;" | 17
 
|  
 
|  
 
| style="background-color:#008000; color:#FFF;" | 18
 
| style="background-color:#008000; color:#FFF;" | 18
Line 159: Line 157:
 
| 138
 
| 138
 
|I2C4_SDA_M0
 
|I2C4_SDA_M0
| GMAC1_RXER_M1
+
| I2S2_SDI_M1
 
| SPI3_MOSI_M0
 
| SPI3_MOSI_M0
| I2S2_SDI_M1
+
| GPIO4_B2
 
| style="background-color:#008000; color:#FFF;" | 19
 
| style="background-color:#008000; color:#FFF;" | 19
 
|  
 
|  
Line 173: Line 171:
 
| 136
 
| 136
 
|  
 
|  
|  
+
| I2S1_SDO1_M1
 
| SPI3_MISO_M0
 
| SPI3_MISO_M0
|I2S1_SDO1_M1
+
| GPIO4_B0
 
| style="background-color:#008000; color:#FFF;" | 21
 
| style="background-color:#008000; color:#FFF;" | 21
 
|  
 
|  
 
| style="background-color:#008000; color:#FFF;" | 22
 
| style="background-color:#008000; color:#FFF;" | 22
 +
| GPIO2_C6
 +
| UART8_RX_M0
 
| SPI1_CS1_M0
 
| SPI1_CS1_M0
| UART8_RX_M0
 
|
 
 
|  
 
|  
 
| 86
 
| 86
 
|-
 
|-
 
|139  
 
|139  
|  
+
| I2S2_SDO_M1
 
| I2C4_SCL_M0
 
| I2C4_SCL_M0
 
| SPI3_CLK_M0
 
| SPI3_CLK_M0
| I2S2_SDO_M1
+
| GPIO4_B3
 
| style="background-color:#008000; color:#FFF;" | 23
 
| style="background-color:#008000; color:#FFF;" | 23
 
|  
 
|  
 
| style="background-color:#008000; color:#FFF;" | 24
 
| style="background-color:#008000; color:#FFF;" | 24
| I2S1_SCLK_RX_M1
+
| GPIO4_A6
 
| SPI3_CS0_M0
 
| SPI3_CS0_M0
| GMAC1_TXEN_M1
+
| I2S1_SCLK_RX_M1
 
|  
 
|  
 
| 134
 
| 134
Line 207: Line 205:
 
|  
 
|  
 
| style="background-color:#008000; color:#FFF;" | 26
 
| style="background-color:#008000; color:#FFF;" | 26
| I2S1_LRCK_RX_M1
+
| GPIO4_A7
 
| SPI3_CS1_M0
 
| SPI3_CS1_M0
| GMAC1_RXD0_M1
+
| I2S1_LRCK_RX_M1
 
|  
 
|  
 
| 135
 
| 135
 
|-
 
|-
 +
| 14
 +
| PWM2_M1
 +
| I2C2_SDA_M0
 +
| SPI0_MOSI_M0
 +
| GPIO0_B6
 +
| style="background-color:#008000; color:#FFF;" | 27
 
|  
 
|  
|
+
| style="background-color:#008000; color:#FFF;" | 28
|
+
| GPIO0_B5
|
+
| GND
+
| style="background-color:#000; color:#FFF"  | 27
+
|
+
| style="background-color:#00F; color:#FFF;" | 28
+
| PCIE20_WAKEn_M0
+
 
| SPI0_CLK_M0
 
| SPI0_CLK_M0
 
| I2C2_SCL_M0
 
| I2C2_SCL_M0
Line 230: Line 228:
 
|  
 
|  
 
| SPI1_MOSI_M1
 
| SPI1_MOSI_M1
| PCIE20_PERSTn_M1
 
 
| I2S1_SDO2_M2
 
| I2S1_SDO2_M2
 +
| GPIO3_C1
 
| style="background-color:#008000; color:#FFF;" | 29
 
| style="background-color:#008000; color:#FFF;" | 29
 
|  
 
|  
Line 242: Line 240:
 
|-
 
|-
 
| 114
 
| 114
|  
+
| I2S1_SDO3_M2
 
| SPI1_MISO_M1
 
| SPI1_MISO_M1
 
| UART5_TX_M1
 
| UART5_TX_M1
| I2S1_SDO3_M2
+
| GPIO3_C2
 
| style="background-color:#008000; color:#FFF;" | 31
 
| style="background-color:#008000; color:#FFF;" | 31
 
|  
 
|  
| style="background-color:#000; color:#FFF"| 32
+
| style="background-color:#008000; color:#FFF;" | 32
| GDD
+
| GPIO0_C3
|
+
|PWM4
|  
+
 
|  
 
|  
 
|  
 
|  
 +
| 19
 
|-
 
|-
 
| 15
 
| 15
 
|  
 
|  
 
|
 
|
|
 
 
| PWM0_M0
 
| PWM0_M0
 +
| GPIO0_B7
 
| style="background-color:#008000; color:#FFF;" | 33
 
| style="background-color:#008000; color:#FFF;" | 33
 
|  
 
|  
Line 269: Line 267:
 
|  
 
|  
 
|-
 
|-
 +
| 29
 
|  
 
|  
 
|  
 
|  
 
|  
 
|  
|  
+
| GPIO0_D5
|
+
 
| style="background-color:#008000; color:#FFF;" | 35
 
| style="background-color:#008000; color:#FFF;" | 35
 
|  
 
|  
 
| style="background-color:#008000; color:#FFF;" | 36
 
| style="background-color:#008000; color:#FFF;" | 36
| PCIE20_BUTTONRSTn
+
| GPIO0_B4
 
| I2C1_SDA
 
| I2C1_SDA
 
|  
 
|  
Line 283: Line 281:
 
| 12
 
| 12
 
|-
 
|-
 +
| 30
 
|  
 
|  
 
|  
 
|  
 
|  
 
|  
|  
+
| GPIO0_D6
|
+
 
| style="background-color:#008000; color:#FFF;" | 37
 
| style="background-color:#008000; color:#FFF;" | 37
 
|  
 
|  
 
| style="background-color:#008000; color:#FFF;" | 38
 
| style="background-color:#008000; color:#FFF;" | 38
 +
| GPIO0_C1
 +
| PWM2_M0
 
| UART0_TX
 
| UART0_TX
| PWM2_M0
 
|
 
 
|  
 
|  
 
| 17
 
| 17
Line 305: Line 303:
 
|  
 
|  
 
| style="background-color:#008000; color:#FFF;" | 40
 
| style="background-color:#008000; color:#FFF;" | 40
 +
| GPIO0_B3
 
| I2C1_SCL
 
| I2C1_SCL
|
 
 
|  
 
|  
 
|  
 
|  
Line 318: Line 316:
 
<div class="clearfix"></div>
 
<div class="clearfix"></div>
  
 +
==== More details about 40-pin Header In V1.0 ====
 +
 +
* Pins marked with color orange are designed for debug console.
 +
* PWM; x7;PWM0/PWM1/PWM2/PWM4/PWM5/PWM6/PWM7/
 +
* SPI:x3;SPI0/SPI1/SPI3/
 +
* I2C: x5;I2C1/I2C2/I2C3/I2C4/I2C5
 +
* UART: x5;UART0/UART2/UART3/UART5/UART8
 +
 +
=== GPIO number ===
 +
 +
Rockchip RK3566 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.19 kernel, the GPIO number can be calculated as below, take GPIO4_A7 (PIN26 on 40-PIN HEADER) as an example:
 +
 +
GPIO4_A7 = 4*32 + 0*8 + 7 = 135
 +
(A=0, B=1, C=2, D=3)
 +
 +
To set GPIO4_A7 output
  
===== More details about 40-pin Header =====
+
cd /sys/class/gpio
 +
echo 135 > export
 +
cd gpio135
 +
echo out > direction
 +
echo 1 > value    # output high
 +
echo 0 > value    # output low
  
* PWM:x6,PWM0/PWM1/PWM2/PWM5/PWM6/PWM7
+
=== NOTE ===
* SPI:x3,SPI0/SPI1/SPI3
+
GPIO0_D5 GPIO0_D6 GPIO2_C2  pin voltage is 1.8V
* I2C:x4,I2C1/I2C3/I2C4/I2C5
+
* UART:x4.UART0/UART2/UART3/UART8
+

Latest revision as of 03:43, 2 November 2022

    ROCK 3 >  ROCK 3 Compute Module >  Radxa E23 >  GPIO

General purpose input-output (GPIO) connector

Radxa E23 has a 40-pin expansion header. Each pin is distinguished by color.

Hardware V1.0

GPIO number Function4 Function3 Function2 Function1 Pin# Pin# Function1 Function2 Function3 Function4 GPIO number
+3.3V 1 2 +5.0V
32 I2C3_SDA_M0 UART3_RX_M0 GPIO1_A0 3 4 +5.0V
33 UART3_TX_M0 I2C3_SCL_M0 GPIO1_A1 5 6 GND
21 SPI0_MISO_M0 PWM6 GPIO0_C5 7 8 GPIO0_D1 UART2_TX_M0 25
GND 9 10 GPIO0_D0 UART2_RX_M0 24
97 SPI1_CS0_M1 GPIO3_A1 11 12 GPIO3_B4 I2C5_SDA_M0 108
20 UART0_RTSn PWM5 SPI0_CS1_M0 GPIO0_C4 13 14 GND
22 SPI0_CS0_M0 PWM7_IR GPIO0_C6 15 16 USB_OTG0_DM
NC 17 18 USB_OTG0_DP
138 I2C4_SDA_M0 I2S2_SDI_M1 SPI3_MOSI_M0 GPIO4_B2 19 20 GND
136 I2S1_SDO1_M1 SPI3_MISO_M0 GPIO4_B0 21 22 GPIO2_C6 UART8_RX_M0 SPI1_CS1_M0 86
139 I2S2_SDO_M1 I2C4_SCL_M0 SPI3_CLK_M0 GPIO4_B3 23 24 GPIO4_A6 SPI3_CS0_M0 I2S1_SCLK_RX_M1 134
GND 25 26 GPIO4_A7 SPI3_CS1_M0 I2S1_LRCK_RX_M1 135
14 PWM2_M1 I2C2_SDA_M0 SPI0_MOSI_M0 GPIO0_B6 27 28 GPIO0_B5 SPI0_CLK_M0 I2C2_SCL_M0 PWM1_M1 13
113 SPI1_MOSI_M1 I2S1_SDO2_M2 GPIO3_C1 29 30 GND
114 I2S1_SDO3_M2 SPI1_MISO_M1 UART5_TX_M1 GPIO3_C2 31 32 GPIO0_C3 PWM4 19
15 PWM0_M0 GPIO0_B7 33 34 GND
29 GPIO0_D5 35 36 GPIO0_B4 I2C1_SDA 12
30 GPIO0_D6 37 38 GPIO0_C1 PWM2_M0 UART0_TX 17
GND 39 40 GPIO0_B3 I2C1_SCL 11

More details about 40-pin Header In V1.0

  • Pins marked with color orange are designed for debug console.
  • PWM; x7;PWM0/PWM1/PWM2/PWM4/PWM5/PWM6/PWM7/
  • SPI:x3;SPI0/SPI1/SPI3/
  • I2C: x5;I2C1/I2C2/I2C3/I2C4/I2C5
  • UART: x5;UART0/UART2/UART3/UART5/UART8

GPIO number

Rockchip RK3566 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.19 kernel, the GPIO number can be calculated as below, take GPIO4_A7 (PIN26 on 40-PIN HEADER) as an example:

GPIO4_A7 = 4*32 + 0*8 + 7 = 135
(A=0, B=1, C=2, D=3)

To set GPIO4_A7 output

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

NOTE

GPIO0_D5 GPIO0_D6 GPIO2_C2 pin voltage is 1.8V