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

Difference between revisions of "Rock3/hardware/rock3a-gpio"

(More details about 40-pin Header In V1.3)
Line 2: Line 2:
 
{{Languages|rock3/hardware/gpio}}
 
{{Languages|rock3/hardware/gpio}}
  
     [[rock3 | ROCK 3]] > [[rock3/hardware | Hardware]] > [[rock3/hardware/rock3a-gpio | ROCK 3 A GPIO]]
+
     [[rock3 | ROCK 3]] > [[rock3/hardware | Hardware]] > [[rock3/hardware/rock3a-gpio | ROCK 3A GPIO]]
  
 
== <span id="gpio">General purpose input-output (GPIO) connector</span> ==
 
== <span id="gpio">General purpose input-output (GPIO) connector</span> ==
  
ROCK 3 A has a 40-pin expansion header. Each pin is distinguished by color.
+
ROCK 3A has one 40-pin expansion header. Each pin is distinguished by color.
  
 
<div class="col-md-12 ">
 
<div class="col-md-12 ">
Line 136: Line 136:
 
| style="background-color:#008000; color:#FFF;" | 16
 
| style="background-color:#008000; color:#FFF;" | 16
 
| GPIO3_A1
 
| GPIO3_A1
| SPI1_CS0_M1
+
|  
 
|  
 
|  
 
|  
 
|  
Line 212: Line 212:
 
|-
 
|-
 
| 14
 
| 14
 +
| USB_DP
 
| PWM2_M1
 
| PWM2_M1
| SPI0_MOSI_M0
 
 
| I2C2_SDA_M0
 
| I2C2_SDA_M0
 
| GPIO0_B6
 
| GPIO0_B6
Line 221: Line 221:
 
| GPIO0_B5
 
| GPIO0_B5
 
| I2C2_SCL_M0
 
| I2C2_SCL_M0
| SPI0_CLK_M0
 
 
| PWM1_M1
 
| PWM1_M1
 +
| USB_DM
 
| 13
 
| 13
 
|-
 
|-
 
| 95
 
| 95
 
|  
 
|  
| UART8_TX_M1
+
|  
| SPI2_MISO_M1
+
| UART8_TX_M1
 
| GPIO2_D7
 
| GPIO2_D7
 
| style="background-color:#008000; color:#FFF;" | 29
 
| style="background-color:#008000; color:#FFF;" | 29
Line 248: Line 248:
 
| style="background-color:#008000; color:#FFF;" | 32
 
| style="background-color:#008000; color:#FFF;" | 32
 
| GPIO3_C2
 
| GPIO3_C2
| SPI1_MISO_M1
 
 
| UART5_TX_M1
 
| UART5_TX_M1
 +
|
 
|  
 
|  
 
| 114
 
| 114
 
|-
 
|-
 
| 115
 
| 115
 +
|
 
|  
 
|  
 
| UART5_RX_M1
 
| UART5_RX_M1
| SPI1_CLK_M1
 
 
| GPIO3_C3
 
| GPIO3_C3
 
| style="background-color:#008000; color:#FFF;" | 33
 
| style="background-color:#008000; color:#FFF;" | 33
Line 319: Line 319:
  
 
* Pins marked with color orange are designed for debug console.
 
* Pins marked with color orange are designed for debug console.
* PWM; x7, PWM1/PWM2/PWM9/PWM12/PWM13/PWM14/PWM15
+
* PWM; x7, PWM1 / PWM2 / PWM9 / PWM12 / PWM13 / PWM14 / PWM15
 
* SPI: x1, SPI3
 
* SPI: x1, SPI3
* I2C: x2, I2C2/I2C3
+
* I2C: x2, I2C2 / I2C3
* UART: x6, UART0/UART3/UART5/UART7/UART8/UART9
+
* UART: x6, UART0 / UART3 / UART5 / UART7 / UART8 / UART9
 
* ADC: x1, ADC_IN5
 
* ADC: x1, ADC_IN5
 
* CAN: x1, CAN1
 
* CAN: x1, CAN1
* USB: x1, PIN#27 and PIN#28
+
* USB 2.0: x1, USB_DP(PIN#27) + USB_DM(PIN#28)
 
** When we select this USB function, you need to modify the hardware like this.
 
** When we select this USB function, you need to modify the hardware like this.
 
*** Remove R90526 R90527
 
*** Remove R90526 R90527
Line 332: Line 332:
 
<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 V1.3</h3></div>
+
         <div class="panel-heading"><h3>Hardware V1.3/V1.31</h3></div>
 
         <div class="panel-body">
 
         <div class="panel-body">
 
{| class="wikitable" style="vertical-align:middle; background-color:#F9F9F9;"
 
{| class="wikitable" style="vertical-align:middle; background-color:#F9F9F9;"
Line 393: Line 393:
 
|-
 
|-
 
| 13
 
| 13
 +
|
 
| PWM1_M1
 
| PWM1_M1
| SPI0_CLK_M0
 
 
| I2C2_SCL_M0
 
| I2C2_SCL_M0
 
| GPIO0_B5
 
| GPIO0_B5
Line 458: Line 458:
 
| GPIO0_B6
 
| GPIO0_B6
 
| I2C2_SDA_M0
 
| I2C2_SDA_M0
| SPI0_MOSI_M0
 
 
| PWM2_M1
 
| PWM2_M1
 +
|
 
| 14
 
| 14
 
|-
 
|-
Line 533: Line 533:
 
|-
 
|-
 
| 12
 
| 12
|  
+
| USB_DP
 
| CAN0_RX_M0
 
| CAN0_RX_M0
 
| I2C1_SDA
 
| I2C1_SDA
Line 543: Line 543:
 
| I2C1_SCL
 
| I2C1_SCL
 
| CAN0_TX_M0
 
| CAN0_TX_M0
|  
+
| USB_DM
 
| 11
 
| 11
 
|-
 
|-
 
| 95
 
| 95
 +
|
 
|  
 
|  
 
| UART8_TX_M1
 
| UART8_TX_M1
| SPI2_MISO_M1
 
 
| GPIO2_D7
 
| GPIO2_D7
 
| style="background-color:#008000; color:#FFF;" | 29
 
| style="background-color:#008000; color:#FFF;" | 29
Line 561: Line 561:
 
|-
 
|-
 
| 96
 
| 96
 +
|
 
|  
 
|  
 
| UART8_RX_M1
 
| UART8_RX_M1
| SPI2_CLK_M1
 
 
| GPIO3_A0
 
| GPIO3_A0
 
| style="background-color:#008000; color:#FFF;" | 31
 
| style="background-color:#008000; color:#FFF;" | 31
Line 569: Line 569:
 
| style="background-color:#008000; color:#FFF;" | 32
 
| style="background-color:#008000; color:#FFF;" | 32
 
| GPIO3_C2
 
| GPIO3_C2
| SPI1_MISO_M1
 
 
| UART5_TX_M1
 
| UART5_TX_M1
 +
|
 
|  
 
|  
 
| 114
 
| 114
Line 636: Line 636:
 
<div class="clearfix"></div>
 
<div class="clearfix"></div>
  
==== More details about 40-pin Header In V1.3 ====
+
==== More details about 40-pin Header In V1.3/V1.31 ====
  
 
* Pins marked with color orange are designed for debug console.
 
* Pins marked with color orange are designed for debug console.
* PWM; x7, PWM1/PWM2/PWM9/PWM12/PWM13/PWM14/PWM15
+
* PWM; x7, PWM1 / PWM2 / PWM9 / PWM12 / PWM13 / PWM14 / PWM15
 
* SPI: x1, SPI3
 
* SPI: x1, SPI3
* I2C: x3, I2C1/I2C2/I2C3
+
* I2C: x3, I2C1 / I2C2 / I2C3
* UART: x6, UART0/UART3/UART5/UART7/UART8/UART9
+
* UART: x6, UART0 / UART3 / UART5 / UART7 / UART8 / UART9
 
* ADC: x1, SARADC_VIN5
 
* ADC: x1, SARADC_VIN5
* CAN: x2, CAN0/CAN1
+
* CAN: x2, CAN0 / CAN1
* USB: x1, PIN#27 and PIN#28
+
* USB 2.0: x1, USB_DP(PIN#27) + USB_DM(PIN#28)
 
** When we select this USB function, you need to modify the hardware like this.
 
** When we select this USB function, you need to modify the hardware like this.
 
*** Remove R90526 R90527
 
*** Remove R90526 R90527

Revision as of 13:07, 6 February 2022

    ROCK 3 >  Hardware >  ROCK 3A GPIO

General purpose input-output (GPIO) connector

ROCK 3A has one 40-pin expansion header. Each pin is distinguished by color.

Hardware V1.2

GPIO number Function4 Function3 Function2 Function1 Pin# Pin# Function1 Function2 Function3 Function4 GPIO number
+3.3V 1 2 +5.0V
32 CAN1_RX_M0 UART3_RX_M0 I2C3_SDA_M0 GPIO1_A0 3 4 +5.0V
33 CAN1_TX_M0 UART3_TX_M0 I2C3_SCL_M0 GPIO1_A1 5 6 GND
111 UART3_TX_M1 PWM12_M0 GPIO3_B7 7 8 GPIO0_D1 UART2_TXD 25
GND 9 10 GPIO0_D0 UART2_RXD 24
116 UART7_TX_M1 PWM14_M0 GPIO3_C4 11 12 GPIO3_A3 99
117 UART7_RX_M1 PWM15_IR_M0 GPIO3_C5 13 14 GND
16 UART0_RX PWM1_M0 GPIO0_C0 15 16 GPIO3_A1 97
17 UART0_TX PWM2_M0 GPIO0_C1 17 18 GPIO3_B2 UART4_TX_M1 PWM9_M0 106
147 CAN1_TX_M1 SPI3_MOSI_M1 PWM15_IR_M1 GPIO4_C3 19 20 GND
149 UART9_TX_M1 SPI3_MISO_M1 PWM12_M1 GPIO4_C5 21 22 ADC_IN5
146 CAN1_RX_M1 SPI3_CLK_M1 PWM14_M1 GPIO4_C2 23 24 GPIO4_C6 PWM13_M1 SPI3_CS0_M1 UART9_RX_M1 150
GND 25 26 GPIO4_D1 SPI3_CS1_M1 153
14 USB_DP PWM2_M1 I2C2_SDA_M0 GPIO0_B6 27 28 GPIO0_B5 I2C2_SCL_M0 PWM1_M1 USB_DM 13
95 UART8_TX_M1 GPIO2_D7 29 30 GND
96 UART8_RX_M1 SPI2_CLK_M1 GPIO3_A0 31 32 GPIO3_C2 UART5_TX_M1 114
115 UART5_RX_M1 GPIO3_C3 33 34 GND
100 GPIO3_A4 35 36 GPIO3_A2 98
112 UART3_RX_M1 PWM13_M0 GPIO3_C0 37 38 GPIO3_A6 102
GND 39 40 GPIO3_A5 101

More details about 40-pin Header In V1.2

  • Pins marked with color orange are designed for debug console.
  • PWM; x7, PWM1 / PWM2 / PWM9 / PWM12 / PWM13 / PWM14 / PWM15
  • SPI: x1, SPI3
  • I2C: x2, I2C2 / I2C3
  • UART: x6, UART0 / UART3 / UART5 / UART7 / UART8 / UART9
  • ADC: x1, ADC_IN5
  • CAN: x1, CAN1
  • USB 2.0: x1, USB_DP(PIN#27) + USB_DM(PIN#28)
    • When we select this USB function, you need to modify the hardware like this.
      • Remove R90526 R90527
      • Add R90536 R90537

Hardware V1.3/V1.31

GPIO number Function4 Function3 Function2 Function1 Pin# Pin# Function1 Function2 Function3 Function4 GPIO number
+3.3V 1 2 +5.0V
32 CAN1_RX_M0 UART3_RX_M0 I2C3_SDA_M0 GPIO1_A0 3 4 +5.0V
33 CAN1_TX_M0 UART3_TX_M0 I2C3_SCL_M0 GPIO1_A1 5 6 GND
13 PWM1_M1 I2C2_SCL_M0 GPIO0_B5 7 8 GPIO0_D1 UART2_TXD 25
GND 9 10 GPIO0_D0 UART2_RXD 24
116 UART7_TX_M1 PWM14_M0 GPIO3_C4 11 12 GPIO3_A3 99
117 UART7_RX_M1 PWM15_IR_M0 GPIO3_C5 13 14 GND
16 UART0_RX PWM1_M0 GPIO0_C0 15 16 GPIO0_B6 I2C2_SDA_M0 PWM2_M1 14
+3.3V 17 18 GPIO3_B2 UART4_TX_M1 PWM9_M0 106
147 CAN1_TX_M1 SPI3_MOSI_M1 PWM15_IR_M1 GPIO4_C3 19 20 GND
149 UART9_TX_M1 SPI3_MISO_M1 PWM12_M1 GPIO4_C5 21 22 GPIO0_C1 PWM2_M0 UART0_TX 17
146 CAN1_RX_M1 SPI3_CLK_M1 PWM14_M1 GPIO4_C2 23 24 GPIO4_C6 PWM13_M1 SPI3_CS0_M1 UART9_RX_M1 150
GND 25 26 GPIO4_D1 SPI3_CS1_M1 153
12 USB_DP CAN0_RX_M0 I2C1_SDA GPIO0_B4 27 28 GPIO0_B3 I2C1_SCL CAN0_TX_M0 USB_DM 11
95 UART8_TX_M1 GPIO2_D7 29 30 GND
96 UART8_RX_M1 GPIO3_A0 31 32 GPIO3_C2 UART5_TX_M1 114
115 UART5_RX_M1 SPI1_CLK_M1 GPIO3_C3 33 34 GND
100 GPIO3_A4 35 36 GPIO3_A2 98
SARADC_VIN5 37 38 GPIO3_A6 102
GND 39 40 GPIO3_A5 101

More details about 40-pin Header In V1.3/V1.31

  • Pins marked with color orange are designed for debug console.
  • PWM; x7, PWM1 / PWM2 / PWM9 / PWM12 / PWM13 / PWM14 / PWM15
  • SPI: x1, SPI3
  • I2C: x3, I2C1 / I2C2 / I2C3
  • UART: x6, UART0 / UART3 / UART5 / UART7 / UART8 / UART9
  • ADC: x1, SARADC_VIN5
  • CAN: x2, CAN0 / CAN1
  • USB 2.0: x1, USB_DP(PIN#27) + USB_DM(PIN#28)
    • When we select this USB function, you need to modify the hardware like this.
      • Remove R90526 R90527
      • Add R90536 R90537

IO Voltage

RK3568 have three IO voltages, 1.8V/3.3V. For ROCK 3, the high level voltage of GPIO pin on 40-PIN HEADER is 3.3V.

| GPIO       | Voltage Level | Tolerance |
| ---------- | ------------- | --------- |
| GPIO3_C0   | 3.3V          | 3.63V     |
| ADC_IN5    | 1.8V          | 1.98V     |

GPIO number

Rockchip RK3568 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_D1 (PIN26 on 4-0PIN HEADER) as an example:

GPIO4_D1 = 4*32 + 3*8 + 1 = 153
(A=0, B=1, C=2, D=3)

To set GPIO4_D1 output

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