Difference between revisions of "GPIO Pinout"

From HiveTool
Jump to: navigation, search
(General Purpose Input Output (GPIO))
 
(79 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
==General Purpose Input Output (GPIO)==
 
==General Purpose Input Output (GPIO)==
  
Resources:
+
This page is to identify the alternate functions of the Raspberry Pi GPIO
#[http://elinux.org/RPi_Low-level_peripherals eLinux.org RPi Low-level peripherals]
+
and to keep Hivetool developers from stepping on each other by reserving pins for Hivetool hardware.
  
Notes:
+
==Notes==
#GPIO pins are 3.3 volt logic level and are not tolerant of 5V levels
+
#GPIO pins are 3.3 volt logic levels and are not tolerant of 5V levels
#Each GPIO can interrupt, high/low/rise/fall/change.
+
#THE GPIO PINS ARE NUMBERED TWO DIFFERENT WAYS, Broadcom and RPi. Hivetool uses RPi numbers.
#GPIO input hysteresis (Schmitt trigger) can be on or off, output slew rate can be fast or limited, and source and sink current is configurable from 2 mA up to 16 mA. Note that chipset GPIO pins 0-27 are in the same block and these properties are set per block, not per pin.
+
#These GPIO properties are set as a block, not per pin (GPIO pins 0-27 are in the same block).
 +
##Can interrupt based on high/low/rise/fall/change.
 +
##Schmitt Trigger Input (hysteresis) can be on or off,  
 +
##Output slew rate can be fast or limited, and  
 +
##Source and sink currents are configurable from 2 mA up to 16 mA.
 +
#ID_SD and ID_SC PINS are reserved for ID EEPROM.
 +
#:At boot time this I2C interface will be interrogated to look for an EEPROM  that identifies the attached board and allows
 +
#:automagic setup of the GPIOs (and optionally, Linux drivers).
 +
#:DO NOT USE these pins for anything other  than attaching an I2C ID EEPROM. Leave unconnected if ID EEPROM not required.
  
 
==Color Legend==
 
==Color Legend==
 +
<center>
 +
<table border=1>
 +
<th colspan=3>Color Legend</th>
 +
<tr><td bgcolor="orange">3.3 VDC Power</td><td bgcolor="blue">Serial Console/Power</td><td bgcolor="yellow">I2C Sensors</td></tr>
 +
<tr><td bgcolor="red">5 VDC Power</td><td bgcolor="green">HX711 Scale</td><td bgcolor="purple">I2S Audio</td></tr>
 +
<tr><td bgcolor="#555555">Ground</td><td bgcolor="44ff44">DHT22 Temp/Hum.</td><td bgcolor="bb55bb">SPI</td></tr>
 +
<tr><td bgcolor="#EEcccc">[https://github.com/raspberrypi/hats HAT ID ROM]</td><td bgcolor="#11bb11">Rain Gauge</td><td bgcolor="#66aa66">1-Wire</td></tr>
 +
 +
<tr><td bgcolor="#cceecc" colspan=1>Unused</td><td bgcolor="#8888ff">LED</td><td bgcolor="bb55bb">SPI</td></tr>
  
<table border=1>
 
<th colspan=2>Color Legend</th>
 
<tr><td bgcolor="orange">3.3 VDC Power</td><td bgcolor="blue">Serial Console/Power</td></tr>
 
<tr><td bgcolor="red">5 VDC Power</td><td bgcolor="green">HX711 Scale</td></tr>
 
<tr><td bgcolor="#555555">Ground</td><td bgcolor="yellow">I2C Sensors</td></tr>
 
<tr><td bgcolor="#cceecc">Unused</td><td bgcolor="purple">I2S Audio</td></tr>
 
 
   </table>
 
   </table>
 +
</center>
 +
<br>
 +
Light green signals labeled "Unused" are available for development.    Other colors are being used or are reserved for sensor families.  A  tilt sensor needs to be implemented.
 +
 +
<br>
 +
 +
==GPIO ordered by Header Pins==
 +
 +
'''''Notes:'''''
 +
#'''Pins 7 and 11 were swapped''' between Hive Interface Board versions 0.3 and 1.0.  On version 1.0 the LED was moved from pin 7, the default 1-wire bus, to pin 11.
 +
#'''THE GPIO PINS ARE REFERRED TO BY TWO DIFFERENT NAMING CONVENTIONS''', Broadcom and RPi. Some drivers use the RPi numbers, some drivers use the Broadcom numbering
 +
#The first 26 pins on J8 (A+, B+ Pi2, PiZero, Pi 3 models) are the same as H1 on the A and B models.
 +
  
<br><br>
 
  
==J8 Header Signals==
+
<center>
 
  <table>
 
  <table>
 
   <tr>
 
   <tr>
Line 27: Line 50:
 
       <table  border=1>
 
       <table  border=1>
 
       <th>Hivetool</th>
 
       <th>Hivetool</th>
 +
      <tr><td bgcolor="Orange">3.3 VDC Power</td></tr>
 
       <tr><td bgcolor="Yellow">Reserved for I2C Sensors</td></tr>
 
       <tr><td bgcolor="Yellow">Reserved for I2C Sensors</td></tr>
 
       <tr><td bgcolor="Yellow">Reserved for I2C Sensors</td></tr>
 
       <tr><td bgcolor="Yellow">Reserved for I2C Sensors</td></tr>
       <tr><td bgcolor="Yellow">Reserved for I2C Sensors</td></tr>
+
       <tr><td bgcolor="#66aa66">Reserved for 1-Wire</td></tr>
       <tr><td bgcolor="#cceecc">Unused</td></tr>
+
       <tr><td bgcolor="555555">Ground</td></tr>
       <tr><td bgcolor="Yellow">Reserved for I2C Sensors</td></tr>
+
       <tr><td bgcolor="#8888ff">Reserved for LED</td></tr>
       <tr><td bgcolor="#cceecc">Unused</td></tr>
+
       <tr><td bgcolor="#44ff44">Reserved DHT22</td></tr>
       <tr><td bgcolor="#cceecc">Unused</td></tr>
+
       <tr><td bgcolor="#44ff44">Reserved DHT22</td></tr>
       <tr><td bgcolor="#cceecc">Unused</td></tr>
+
       <tr><td bgcolor="Orange">3.3 VDC Power</td></tr>
       <tr><td bgcolor="#cceecc">Unused</td></tr>
+
       <tr><td bgcolor="#bb55bb">Reserved SPI</td></tr>
       <tr><td bgcolor="#cceecc">Unused</td></tr>
+
       <tr><td bgcolor="#bb55bb">Reserved SPI</td></tr>
       <tr><td bgcolor="#cceecc">Unused</td></tr>
+
       <tr><td bgcolor="#bb55bb">Reserved SPI</td></tr>
       <tr><td bgcolor="#cceecc">Unused</td></tr>
+
       <tr><td bgcolor="#555555">Ground</td></tr>
       <tr><td bgcolor="#cceecc">Unused</td></tr>
+
       <tr><td bgcolor="#eecccc">Reserved ID EEPROM</td></tr>
      <tr><td bgcolor="#cceecc">Unused</td></tr>
 
 
       <tr><td bgcolor="#cceecc">Unused</td></tr>
 
       <tr><td bgcolor="#cceecc">Unused</td></tr>
 
       <tr><td bgcolor="#cceecc">Unused</td></tr>
 
       <tr><td bgcolor="#cceecc">Unused</td></tr>
Line 46: Line 69:
 
       <tr><td bgcolor="purple">Reserved I2S</td></tr>
 
       <tr><td bgcolor="purple">Reserved I2S</td></tr>
 
       <tr><td bgcolor="#cceecc">Unused</td></tr>
 
       <tr><td bgcolor="#cceecc">Unused</td></tr>
       <tr><td bgcolor="#cceecc">Unused</td></tr>
+
       <tr><td bgcolor="#555555">Ground</td></tr>
 
       </table>
 
       </table>
 
     </td>
 
     </td>
Line 53: Line 76:
 
       <th>R Pi</th>
 
       <th>R Pi</th>
 
       <tr><td bgcolor="orange">3.3 VDC Power</td></tr>
 
       <tr><td bgcolor="orange">3.3 VDC Power</td></tr>
       <tr><td bgcolor="yellow">GPIO 2 <b>I2C</b></td></tr>
+
      <tr><td bgcolor="yellow">GPIO 8 <b>I2C SDA</b></td></tr>
       <tr><td bgcolor="yellow">GPIO 3 <b>I2C</b></td></tr>
+
      <tr><td bgcolor="yellow">GPIO 9 <b>I2C SCL</b></td></tr>
       <tr><td bgcolor="#cceecc">GPIO 4</td></tr>
+
      <tr><td bgcolor="#66aa66">GPIO 7 GPCLK0</td></tr>
 +
      <tr><td bgcolor="#555555">Ground</td></tr>
 +
      <tr><td bgcolor="#8888ff">GPIO 0</td></tr>
 +
      <tr><td bgcolor="#44ff44">GPIO 2</td></tr>
 +
      <tr><td bgcolor="#44ff44">GPIO 3</td></tr>
 +
      <tr><td bgcolor="orange">3.3 VDC Power</td></tr>
 +
      <tr><td bgcolor="#bb55bb">GPIO 12 SPI0 MOSI</td></tr>
 +
      <tr><td bgcolor="#bb55bb">GPIO 13 SPI0 MISO</td></tr>
 +
      <tr><td bgcolor="#bb55bb">GPIO 14 SPI0 SCLK</td></tr>
 +
      <tr><td bgcolor="#555555">Ground</td></tr>
 +
      <tr><td bgcolor="#eecccc">GPIO 30 I2C0_SDA</td></tr>
 +
      <tr><td bgcolor="#cceecc">GPIO 21 GPCLK1</td></tr>
 +
      <tr><td bgcolor="#cceecc">GPIO 22 GPCLK2</td></tr>
 +
      <tr><td bgcolor="#cceecc">GPIO 23 PWM1</td></tr>
 +
      <tr><td bgcolor="purple">GPIO 24 <b>PCM_FS</b></td></tr>
 +
      <tr><td bgcolor="#cceecc">GPIO 25</td></tr>
 +
      <tr><td bgcolor="#555555">Ground</td></tr>
 +
      </table>
 +
    </td>
 +
    <td>
 +
      <table  border=1>
 +
      <th>Broadcom</th>
 +
      <tr><td bgcolor="orange">3.3 VDC Power</td></tr>
 +
       <tr><td bgcolor="yellow">GPIO 2 <b>I2C SDA</b></td></tr>
 +
       <tr><td bgcolor="yellow">GPIO 3 <b>I2C SCL</b></td></tr>
 +
       <tr><td bgcolor="#66aa66">GPIO 4 GPCLK0</td></tr>
 
       <tr><td bgcolor="#555555">Ground</td></tr>
 
       <tr><td bgcolor="#555555">Ground</td></tr>
       <tr><td bgcolor="#cceecc">GPIO 17</td></tr>
+
       <tr><td bgcolor="#8888ff">GPIO 17</td></tr>
       <tr><td bgcolor="#cceecc">GPIO 27</td></tr>
+
       <tr><td bgcolor="#44ff44">GPIO 27</td></tr>
       <tr><td bgcolor="#cceecc">GPIO 22</td></tr>
+
       <tr><td bgcolor="#44ff44">GPIO 22</td></tr>
 
       <tr><td bgcolor="orange">3.3 VDC Power</td></tr>
 
       <tr><td bgcolor="orange">3.3 VDC Power</td></tr>
       <tr><td bgcolor="#cceecc">GPIO 10 SPIO MOSI</td></tr>
+
       <tr><td bgcolor="#bb55bb">GPIO 10 SPI0 MOSI</td></tr>
       <tr><td bgcolor="#cceecc">GPIO &nbsp;9 SPIO MISO</td></tr>
+
       <tr><td bgcolor="#bb55bb">GPIO 09 SPI0 MISO</td></tr>
       <tr><td bgcolor="#cceecc">GPIO 11 SPIO SCLK</td></tr>
+
       <tr><td bgcolor="#bb55bb">GPIO 11 SPI0 SCLK</td></tr>
 
       <tr><td bgcolor="#555555">Ground</td></tr>
 
       <tr><td bgcolor="#555555">Ground</td></tr>
       <tr><td bgcolor="#cceecc">I2C EEPROM ID_SD</td></tr>
+
       <tr><td bgcolor="#eecccc">GPIO 0 I2C0_SDA</td></tr>
       <tr><td bgcolor="#cceecc">GPIO 5</td></tr>
+
       <tr><td bgcolor="#cceecc">GPIO 5 GPCLK1</td></tr>
       <tr><td bgcolor="#cceecc">GPIO 6</td></tr>
+
       <tr><td bgcolor="#cceecc">GPIO 6 GPCLK2</td></tr>
       <tr><td bgcolor="#cceecc">GPIO 13</td></tr>
+
       <tr><td bgcolor="#cceecc">GPIO 13 PWM1</td></tr>
 
       <tr><td bgcolor="purple">GPIO 19 <b>PCM_FS</b></td></tr>
 
       <tr><td bgcolor="purple">GPIO 19 <b>PCM_FS</b></td></tr>
 
       <tr><td bgcolor="#cceecc">GPIO 26</td></tr>
 
       <tr><td bgcolor="#cceecc">GPIO 26</td></tr>
Line 74: Line 122:
 
       </table>
 
       </table>
 
     </td>
 
     </td>
    <td>
+
    <td>
 
       <table border=1 bgcolor="#DDDDDD">
 
       <table border=1 bgcolor="#DDDDDD">
 
       <th colspan=2>J8</th>
 
       <th colspan=2>J8</th>
Line 101: Line 149:
 
     <td>
 
     <td>
 
       <table  border=1>
 
       <table  border=1>
       <th>R Pi</th>
+
       <th>Broadcom</th>
 
       <tr><td bgcolor="red">5 VDC Power</td></tr>
 
       <tr><td bgcolor="red">5 VDC Power</td></tr>
 
       <tr><td bgcolor="red">5 VDC Power</td></tr>
 
       <tr><td bgcolor="red">5 VDC Power</td></tr>
 
       <tr><td bgcolor="#555555">Ground</td></tr>
 
       <tr><td bgcolor="#555555">Ground</td></tr>
       <tr><td bgcolor="blue">GPIO 14 <b>TXDO</b></td></tr>
+
       <tr><td bgcolor="blue">GPIO 14 <b>TXD</b></td></tr>
       <tr><td bgcolor="blue">GPIO 15 <b>RXDO</b></td></tr>
+
       <tr><td bgcolor="blue">GPIO 15 <b>RXD</b></td></tr>
 
       <tr><td bgcolor="purple">GPIO 18 <b>PCM_CLK</b></td></tr>
 
       <tr><td bgcolor="purple">GPIO 18 <b>PCM_CLK</b></td></tr>
 
       <tr><td bgcolor="#555555">Ground</td></tr>
 
       <tr><td bgcolor="#555555">Ground</td></tr>
Line 112: Line 160:
 
       <tr><td bgcolor="green">GPIO 24</td></tr>
 
       <tr><td bgcolor="green">GPIO 24</td></tr>
 
       <tr><td bgcolor="#555555">Ground</td></tr>
 
       <tr><td bgcolor="#555555">Ground</td></tr>
       <tr><td bgcolor="cceecc">GPIO 25</td></tr>
+
       <tr><td bgcolor="11bb11">GPIO 25</td></tr>
       <tr><td bgcolor="cceecc">GPIO 8</td></tr>
+
       <tr><td bgcolor="bb55bb">GPIO 8 SPI0_CE0</td></tr>
       <tr><td bgcolor="cceecc">GPIO 7</td></tr>
+
       <tr><td bgcolor="bb55bb">GPIO 7 SPI0_CE1</td></tr>
       <tr><td bgcolor="cceecc">I2C EEPROM ID_SC</td></tr>
+
       <tr><td bgcolor="eecccc">GPIO 1 I2C0_SCL</td></tr>
 
       <tr><td bgcolor="#555555">Ground</td></tr>
 
       <tr><td bgcolor="#555555">Ground</td></tr>
       <tr><td bgcolor="cceecc">GPIO 12</td></tr>
+
       <tr><td bgcolor="cceecc">GPIO 12 PWM0</td></tr>
 
       <tr><td bgcolor="#555555">Ground</td></tr>
 
       <tr><td bgcolor="#555555">Ground</td></tr>
 
       <tr><td bgcolor="#cceecc">GPIO 16</td></tr>
 
       <tr><td bgcolor="#cceecc">GPIO 16</td></tr>
 
       <tr><td bgcolor="purple">GPIO 20 <b>PCM_DIN</b></td></tr>
 
       <tr><td bgcolor="purple">GPIO 20 <b>PCM_DIN</b></td></tr>
 
       <tr><td bgcolor="purple">GPIO 21 <b>PCM DOUT</b></td></tr>
 
       <tr><td bgcolor="purple">GPIO 21 <b>PCM DOUT</b></td></tr>
 +
      </table>
 +
    </td>
 +
    <td>
 +
      <table  border=1>
 +
      <th>R Pi</th>
 +
      <tr><td bgcolor="red">5 VDC Power</td></tr>
 +
      <tr><td bgcolor="red">5 VDC Power</td></tr>
 +
      <tr><td bgcolor="#555555">Ground</td></tr>
 +
      <tr><td bgcolor="blue">GPIO 15 <b>TXD</b></td></tr>
 +
      <tr><td bgcolor="blue">GPIO 16 <b>RXD</b></td></tr>
 +
      <tr><td bgcolor="purple">GPIO 1 <b>PCM_CLK</b></td></tr>
 +
      <tr><td bgcolor="#555555">Ground</td></tr>
 +
      <tr><td bgcolor="green">GPIO 4</td></tr>
 +
      <tr><td bgcolor="green">GPIO 5</td></tr>
 +
      <tr><td bgcolor="#555555">Ground</td></tr>
 +
      <tr><td bgcolor="11bb11">GPIO 6</td></tr>
 +
      <tr><td bgcolor="bb55bb">GPIO 10 SPI0_CE0</td></tr>
 +
      <tr><td bgcolor="bb55bb">GPIO 11 SPI0_CE1</td></tr>
 +
      <tr><td bgcolor="eecccc">GPIO 31 I2C0_SCL</td></tr>
 +
      <tr><td bgcolor="#555555">Ground</td></tr>
 +
      <tr><td bgcolor="cceecc">GPIO 26 PWM0</td></tr>
 +
      <tr><td bgcolor="#555555">Ground</td></tr>
 +
      <tr><td bgcolor="#cceecc">GPIO 27</td></tr>
 +
      <tr><td bgcolor="purple">GPIO 28 <b>PCM_DIN</b></td></tr>
 +
      <tr><td bgcolor="purple">GPIO 29 <b>PCM DOUT</b></td></tr>
 
       </table>
 
       </table>
 
     </td>
 
     </td>
Line 127: Line 200:
 
       <table  border=1>
 
       <table  border=1>
 
       <th>Hivetool</th>
 
       <th>Hivetool</th>
       <tr><td bgcolor="green">Reserved Power HX711</td></tr>
+
       <tr><td bgcolor="red">5 VDC Power HX711</td></tr>
       <tr><td bgcolor="blue">Reserved Power</td></tr>
+
       <tr><td bgcolor="red">5 VDC Power</td></tr>
       <tr><td bgcolor="blue">Reserved Ground</td></tr>
+
       <tr><td bgcolor="555555">Ground</td></tr>
 
       <tr><td bgcolor="blue">Reserved serial console</td></tr>
 
       <tr><td bgcolor="blue">Reserved serial console</td></tr>
 
       <tr><td bgcolor="blue">Reserved serial console</td></tr>
 
       <tr><td bgcolor="blue">Reserved serial console</td></tr>
 
       <tr><td bgcolor="purple">Reserved I2S</td></tr>
 
       <tr><td bgcolor="purple">Reserved I2S</td></tr>
       <tr><td bgcolor="#cceecc">Unused</td></tr>
+
       <tr><td bgcolor="555555">Ground</td></tr>
      <tr><td bgcolor="green">Reserved HX711</td></tr>
 
 
       <tr><td bgcolor="green">Reserved HX711</td></tr>
 
       <tr><td bgcolor="green">Reserved HX711</td></tr>
 
       <tr><td bgcolor="green">Reserved HX711</td></tr>
 
       <tr><td bgcolor="green">Reserved HX711</td></tr>
 +
      <tr><td bgcolor="#555555">Ground</td></tr>
 +
      <tr><td bgcolor="#11bb11">Reserved Rain Gauge</td></tr>
 +
      <tr><td bgcolor="#bb55bb">Reserved SPI</td></tr>
 +
      <tr><td bgcolor="#bb55bb">Reserved SPI</td></tr>
 +
      <tr><td bgcolor="#eecccc">Reserved ID EEPROM</td></tr>
 +
      <tr><td bgcolor="#555555">Ground</td></tr>
 
       <tr><td bgcolor="#cceecc">Unused</td></tr>
 
       <tr><td bgcolor="#cceecc">Unused</td></tr>
       <tr><td bgcolor="#cceecc">Unused</td></tr>
+
       <tr><td bgcolor="#555555">Ground</td></tr>
      <tr><td bgcolor="#cceecc">Unused</td></tr>
 
      <tr><td bgcolor="#cceecc">Unused</td></tr>
 
      <tr><td bgcolor="#cceecc">Unused</td></tr>
 
      <tr><td bgcolor="#cceecc">Unused</td></tr>
 
      <tr><td bgcolor="#cceecc">Unused</td></tr>
 
 
       <tr><td bgcolor="#cceecc">Unused</td></tr>
 
       <tr><td bgcolor="#cceecc">Unused</td></tr>
 
       <tr><td bgcolor="purple">Reserved I2S</td></tr>
 
       <tr><td bgcolor="purple">Reserved I2S</td></tr>
Line 150: Line 223:
 
     </td>
 
     </td>
 
   </tr>
 
   </tr>
  </table>   
+
  </table>
   
+
 
   
+
 
   
+
 
 +
 
 +
Output of wiringPi gpio command (sudo gpio readall):
 +
  +-----+-----+---------+------+---+--B Plus--+---+------+---------+-----+-----+
 +
| BCM | wPi |  Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 +
|    |    |    3.3v |      |  |  1 || 2  |  |      | 5v      |    |    |
 +
|  2 |  8 |  SDA.1 | ALT0 | 1 |  3 || 4  |  |      | 5V      |    |    |
 +
|  3 |  9 |  SCL.1 | ALT0 | 1 |  5 || 6  |  |      | 0v      |    |    |
 +
|  4 |  7 | GPIO. 7 |  IN | 1 |  7 || 8  | 1 | ALT0 | TxD    | 15  | 14 |
 +
  |    |    |      0v |      |  |  9 || 10 | 1 | ALT0 | RxD    | 16  | 15  |
 +
  |  17 |  0 | GPIO. 0 |  IN | 0 | 11 || 12 | 0 | OUT  | GPIO. 1 | 1  | 18  |
 +
|  27 |  2 | GPIO. 2 |  IN | 0 | 13 || 14 |  |      | 0v      |    |    |
 +
  |  22 |  3 | GPIO. 3 |  IN | 0 | 15 || 16 | 0 | IN  | GPIO. 4 | 4  | 23  |
 +
|    |    |    3.3v |      |  | 17 || 18 | 0 | OUT  | GPIO. 5 | 5  | 24  |
 +
|  10 |  12 |    MOSI |  IN | 0 | 19 || 20 |  |      | 0v      |    |    |
 +
|  9 |  13 |    MISO |  IN | 0 | 21 || 22 | 1 | IN  | GPIO. 6 | 6  | 25  |
 +
|  11 |  14 |    SCLK |  IN | 0 | 23 || 24 | 1 | IN  | CE0    | 10  | 8  |
 +
|    |    |      0v |      |  | 25 || 26 | 1 | IN  | CE1    | 11  | 7  |
 +
|  0 |  30 |  SDA.0 |  IN | 1 | 27 || 28 | 1 | IN  | SCL.0  | 31  | 1  |
 +
|  5 |  21 | GPIO.21 |  IN | 1 | 29 || 30 |  |      | 0v      |    |    |
 +
|  6 |  22 | GPIO.22 |  IN | 1 | 31 || 32 | 0 | IN  | GPIO.26 | 26  | 12  |
 +
|  13 |  23 | GPIO.23 |  IN | 0 | 33 || 34 |  |      | 0v      |    |    |
 +
|  19 |  24 | GPIO.24 |  IN | 0 | 35 || 36 | 0 | IN  | GPIO.27 | 27  | 16  |
 +
|  26 |  25 | GPIO.25 |  IN | 0 | 37 || 38 | 0 | IN  | GPIO.28 | 28  | 20  |
 +
|    |    |      0v |      |  | 39 || 40 | 0 | IN  | GPIO.29 | 29  | 21  |
 +
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 +
| BCM | wPi |  Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +
+-----+-----+---------+------+---+--B Plus--+---+------+---------+-----+-----+
 +
</center>
 
<br><br>
 
<br><br>
==J8 ordered by Signal Name==
+
 
+
==GPIO ordered by Signal Name==
+
        <table  border=1>
      <table  border=1>
+
       <th>Broadcom</th><th>Alt Function</th><th>J8</th><th>H1</th><th>H5</th>
       <th>Signal</th><th>J8</th>
+
       <tr><td bgcolor="orange">3.3 VDC Power</td><td></td><td>1</td><td>1</td><td>3</td></tr>
      <tr><td bgcolor="orange">3.3 VDC Power</td><td>1</td></tr>
+
       <tr><td bgcolor="orange">3.3 VDC Power</td><td></td><td>17</td><td>17</td><td></td></tr>
       <tr><td bgcolor="orange">3.3 VDC Power</td><td>17</td></tr>
+
       <tr><td bgcolor="red">5 VDC Power</td><td></td><td>2</td><td>2</td><td>1</td></tr>
      <tr><td bgcolor="red">5 VDC Power</td><td>2</td></tr>
+
       <tr><td bgcolor="red">5 VDC Power</td><td></td><td>4</td><td>4</td><td></td></tr>
       <tr><td bgcolor="red">5 VDC Power</td><td>4</td></tr>
+
       <tr><td bgcolor="#eecccc">GPIO 0</td><td>I2C0_SDA</td><td>27</td><td></td><td></td></tr>
      <tr><td bgcolor="yellow">GPIO 2 <b>I2C</b></td><td>3</td></tr>
+
       <tr><td bgcolor="#eecccc">GPIO 1</td><td>I2C0_SCL</td><td>28</td><td></td><td></td></tr>
       <tr><td bgcolor="yellow">GPIO 3 <b>I2C</b></td><td>5</td></tr>
+
       <tr><td bgcolor="yellow">GPIO 2</td><td><b>I2C1 SDA</b></td><td>3</td><td>3</td><td></td></tr>
      <tr><td bgcolor="#cceecc">GPIO 4</td><td>7</td></tr>
+
       <tr><td bgcolor="yellow">GPIO 3</td><td><b>I2C1 SCL</b></td><td>5</td><td>5</td><td></td></tr>
       <tr><td bgcolor="#cceecc">GPIO 5</td><td>29</td></tr>
+
       <tr><td bgcolor="#cceecc">GPIO 4</td><td>GPCLK0</td><td>7</td><td>7</td><td></td></tr>
      <tr><td bgcolor="#cceecc">GPIO 6</td><td>31</td></tr>
+
       <tr><td bgcolor="#cceecc">GPIO 5</td><td>GPCLK1</td><td>29</td><td></td><td></td></tr>
       <tr><td bgcolor="#cceecc">GPIO 7</td><td>26</td></tr>
+
       <tr><td bgcolor="#cceecc">GPIO 6</td><td>GPCLK2</td><td>31</td><td></td><td></td></tr>
      <tr><td bgcolor="#cceecc">GPIO 8</td><td>24</td></tr>
+
       <tr><td bgcolor="#cceecc">GPIO 7</td><td>SPI0 CE1</td><td>26</td><td>26</td><td></td></tr>
       <tr><td bgcolor="#cceecc">GPIO 9 SPIO MISO</td><td>21</td></tr>
+
       <tr><td bgcolor="#cceecc">GPIO 8</td><td>SPI0 CE0</td><td>24</td><td>24</td><td></td></tr>
      <tr><td bgcolor="#cceecc">GPIO 10 SPIO MOSI</td><td>19</td></tr>
+
       <tr><td bgcolor="#cceecc">GPIO 9 </td><td>SPI0 MISO</td><td>21</td><td>21</td><td></td></tr>
       <tr><td bgcolor="#cceecc">GPIO 11 SPIO SCLK</td><td>23</td></tr>
+
       <tr><td bgcolor="#cceecc">GPIO 10</td><td>SPI0 MOSI</td><td>19</td><td>19</td><td></td></tr>
      <tr><td bgcolor="#cceecc">GPIO 12</td><td>32</td></tr>
+
       <tr><td bgcolor="#cceecc">GPIO 11</td><td>SPI0 SCLK</td><td>23</td><td>23</td><td></td></tr>
       <tr><td bgcolor="#cceecc">GPIO 13</td><td>33</td></tr>
+
       <tr><td bgcolor="#cceecc">GPIO 12</td><td>PWM0</td><td>32</td><td></td><td></td></tr>
      <tr><td bgcolor="blue">GPIO 14 <b>TXDO</b></td><td>8</td></tr>
+
       <tr><td bgcolor="#cceecc">GPIO 13</td><td>PWM1</td><td>33</td><td></td><td></td></tr>
       <tr><td bgcolor="blue">GPIO 15 <b>RXDO</b></td><td>10</td></tr>
+
       <tr><td bgcolor="blue">GPIO 14</td><td><b>UART0 TXD</b></td><td>8</td><td>8</td><td></td></tr>
      <tr><td bgcolor="#cceecc">GPIO 16</td><td>36</td></tr>
+
       <tr><td bgcolor="blue">GPIO 15</td><td><b>UART0 RXD</b></td><td>10</td><td>10</td><td></td></tr>
       <tr><td bgcolor="#cceecc">GPIO 17</td><td>11</td></tr>
+
       <tr><td bgcolor="#cceecc">GPIO 16</td><td></td><td>36</td><td></td><td></td></tr>
      <tr><td bgcolor="purple">GPIO 18 <b>PCM_CLK</b></td><td>12</td></tr>
+
       <tr><td bgcolor="#cceecc">GPIO 17</td><td></td><td>11</td><td>11</td><td></td></tr>
       <tr><td bgcolor="purple">GPIO 19 <b>PCM_FS</b></td><td>35</td></tr>
+
      <tr><td bgcolor="purple">GPIO 18</td><td><b>PCM_CLK</b></td><td>12</td><td>12</td><td></td></tr>
       <tr><td bgcolor="purple">GPIO 20 <b>PCM_DIN</b></td><td>38</td></tr>
+
      <tr><td bgcolor="purple">GPIO 19</td><td><b>PCM_FS</b></td><td>35</td><td></td><td></td></tr>
       <tr><td bgcolor="purple">GPIO 21 <b>PCM DOUT</b></td><td>40</td></tr>
+
      <tr><td bgcolor="purple">GPIO 20</td><td><b>PCM_DIN</b></td><td>38</td><td></td><td></td></tr>
       <tr><td bgcolor="#cceecc">GPIO 22</td><td>15</td></tr>
+
      <tr><td bgcolor="purple">GPIO 21</td><td><b>PCM DOUT</b></td><td>40</td><td></td><td></td></tr>
      <tr><td bgcolor="green">GPIO 23</td><td>16</td></tr>
+
      <tr><td bgcolor="#cceecc">GPIO 22</td><td></td><td>15</td><td>15</td><td></td></tr>
       <tr><td bgcolor="green">GPIO 24</td><td>18</td></tr>
+
      <tr><td bgcolor="green">GPIO 23</td><td></td><td>16</td><td>16</td><td></td></tr>
      <tr><td bgcolor="cceecc">GPIO 25</td><td>22</td></tr>
+
      <tr><td bgcolor="green">GPIO 24</td><td></td><td>18</td><td>18</td><td></td></tr>
       <tr><td bgcolor="#cceecc">GPIO 26</td><td>37</td></tr>
+
      <tr><td bgcolor="#cceecc">GPIO 25</td><td></td><td>22</td><td>22</td><td></td></tr>
      <tr><td bgcolor="#cceecc">GPIO 27</td><td>13</td></tr>
+
      <tr><td bgcolor="#cceecc">GPIO 26</td><td></td><td>37</td><td></td><td></td></tr>
       <tr><td bgcolor="#cceecc">I2C EEPROM ID_SD</td><td>27</td></tr>
+
      <tr><td bgcolor="#cceecc">GPIO 27</td><td></td><td>13</td><td>13</td><td></td></tr>
      <tr><td bgcolor="#cceecc">I2C EEPROM ID_SC</td><td>28</td></tr>
+
      <tr><td bgcolor="#cceecc">GPIO 28</td><td>I2C0_SDA</td><td></td><td></td><td>3</td></tr>
       <tr><td bgcolor="#555555">Ground</td><td>6</td></tr>
+
      <tr><td bgcolor="#cceecc">GPIO 29</td><td>I2C0_SCL</td><td></td><td></td><td>4</td></tr>
      <tr><td bgcolor="#555555">Ground</td><td>9</td></tr>
+
      <tr><td bgcolor="#cceecc">GPIO 30</td><td></td><td></td><td></td><td>5</td></tr>
       <tr><td bgcolor="#555555">Ground</td><td>14</td></tr>
+
      <tr><td bgcolor="#cceecc">GPIO 31</td><td></td><td></td><td></td><td>6</td></tr>
      <tr><td bgcolor="#555555">Ground</td><td>20</td></tr>
+
      <tr><td bgcolor="#555555">Ground</td><td></td><td>6</td><td>6</td><td>7</td></tr>
       <tr><td bgcolor="#555555">Ground</td><td>25</td></tr>
+
      <tr><td bgcolor="#555555">Ground</td><td></td><td>9</td><td>9</td><td>8</td></tr>
      <tr><td bgcolor="#555555">Ground</td><td>30</td></tr>
+
      <tr><td bgcolor="#555555">Ground</td><td></td><td>14</td><td>14</td><td></td></tr>
       <tr><td bgcolor="#555555">Ground</td><td>34</td></tr>
+
      <tr><td bgcolor="#555555">Ground</td><td></td><td>20</td><td>20</td><td></td></tr>
       <tr><td bgcolor="#555555">Ground</td><td>39</td></tr>
+
      <tr><td bgcolor="#555555">Ground</td><td></td><td>25</td><td>25</td><td></td></tr>
 +
      <tr><td bgcolor="#555555">Ground</td><td></td><td>30</td><td></td><td></td></tr>
 +
      <tr><td bgcolor="#555555">Ground</td><td></td><td>34</td><td></td><td></td></tr>
 +
      <tr><td bgcolor="#555555">Ground</td><td></td><td>39</td><td></td><td></td></tr>
 
       </table>
 
       </table>
 +
 +
==Resources==
 +
#[http://elinux.org/RPi_Low-level_peripherals eLinux.org RPi Low-level peripherals]
 +
#[[media:RPI-BPLUS-V1 2-SCHEMATIC-REDUCED.pdf|Raspberry Pi B+ Reduced Schematic]]
 +
#[http://elinux.org/RPi_BCM2835_GPIOs eLinux.org BCM2835 GPIO functions]
 +
#[[media:BCM2835-ARM-Peripherals.pdf Broadcom|BCM2835 Data Sheet (Manual)]]
 +
#[http://elinux.org/BCM2835_datasheet_errata eLinux.org BCM2835 datasheet errata]
 +
#[https://github.com/raspberrypi/hats Hardware attached on Top]
 +
#[http://wiringpi.com/pins/ WiringPi Alternate GPIO Assignments]
 +
#[http://wiringpi.com/pins/special-pin-functions/ WiringPi Special Pin Functions]

Latest revision as of 12:25, 19 August 2018

General Purpose Input Output (GPIO)

This page is to identify the alternate functions of the Raspberry Pi GPIO and to keep Hivetool developers from stepping on each other by reserving pins for Hivetool hardware.

Notes

  1. GPIO pins are 3.3 volt logic levels and are not tolerant of 5V levels
  2. THE GPIO PINS ARE NUMBERED TWO DIFFERENT WAYS, Broadcom and RPi. Hivetool uses RPi numbers.
  3. These GPIO properties are set as a block, not per pin (GPIO pins 0-27 are in the same block).
    1. Can interrupt based on high/low/rise/fall/change.
    2. Schmitt Trigger Input (hysteresis) can be on or off,
    3. Output slew rate can be fast or limited, and
    4. Source and sink currents are configurable from 2 mA up to 16 mA.
  4. ID_SD and ID_SC PINS are reserved for ID EEPROM.
    At boot time this I2C interface will be interrogated to look for an EEPROM that identifies the attached board and allows
    automagic setup of the GPIOs (and optionally, Linux drivers).
    DO NOT USE these pins for anything other than attaching an I2C ID EEPROM. Leave unconnected if ID EEPROM not required.

Color Legend

Color Legend
3.3 VDC PowerSerial Console/PowerI2C Sensors
5 VDC PowerHX711 ScaleI2S Audio
GroundDHT22 Temp/Hum.SPI
HAT ID ROMRain Gauge1-Wire
UnusedLEDSPI


Light green signals labeled "Unused" are available for development. Other colors are being used or are reserved for sensor families. A tilt sensor needs to be implemented.


GPIO ordered by Header Pins

Notes:

  1. Pins 7 and 11 were swapped between Hive Interface Board versions 0.3 and 1.0. On version 1.0 the LED was moved from pin 7, the default 1-wire bus, to pin 11.
  2. THE GPIO PINS ARE REFERRED TO BY TWO DIFFERENT NAMING CONVENTIONS, Broadcom and RPi. Some drivers use the RPi numbers, some drivers use the Broadcom numbering
  3. The first 26 pins on J8 (A+, B+ Pi2, PiZero, Pi 3 models) are the same as H1 on the A and B models.


Hivetool
3.3 VDC Power
Reserved for I2C Sensors
Reserved for I2C Sensors
Reserved for 1-Wire
Ground
Reserved for LED
Reserved DHT22
Reserved DHT22
3.3 VDC Power
Reserved SPI
Reserved SPI
Reserved SPI
Ground
Reserved ID EEPROM
Unused
Unused
Unused
Reserved I2S
Unused
Ground
R Pi
3.3 VDC Power
GPIO 8 I2C SDA
GPIO 9 I2C SCL
GPIO 7 GPCLK0
Ground
GPIO 0
GPIO 2
GPIO 3
3.3 VDC Power
GPIO 12 SPI0 MOSI
GPIO 13 SPI0 MISO
GPIO 14 SPI0 SCLK
Ground
GPIO 30 I2C0_SDA
GPIO 21 GPCLK1
GPIO 22 GPCLK2
GPIO 23 PWM1
GPIO 24 PCM_FS
GPIO 25
Ground
Broadcom
3.3 VDC Power
GPIO 2 I2C SDA
GPIO 3 I2C SCL
GPIO 4 GPCLK0
Ground
GPIO 17
GPIO 27
GPIO 22
3.3 VDC Power
GPIO 10 SPI0 MOSI
GPIO 09 SPI0 MISO
GPIO 11 SPI0 SCLK
Ground
GPIO 0 I2C0_SDA
GPIO 5 GPCLK1
GPIO 6 GPCLK2
GPIO 13 PWM1
GPIO 19 PCM_FS
GPIO 26
Ground
J8
12
34
56
78
910
1112
1314
1516
1718
1920
2122
2324
2526
2728
2930
3132
3334
3536
3738
3940
Broadcom
5 VDC Power
5 VDC Power
Ground
GPIO 14 TXD
GPIO 15 RXD
GPIO 18 PCM_CLK
Ground
GPIO 23
GPIO 24
Ground
GPIO 25
GPIO 8 SPI0_CE0
GPIO 7 SPI0_CE1
GPIO 1 I2C0_SCL
Ground
GPIO 12 PWM0
Ground
GPIO 16
GPIO 20 PCM_DIN
GPIO 21 PCM DOUT
R Pi
5 VDC Power
5 VDC Power
Ground
GPIO 15 TXD
GPIO 16 RXD
GPIO 1 PCM_CLK
Ground
GPIO 4
GPIO 5
Ground
GPIO 6
GPIO 10 SPI0_CE0
GPIO 11 SPI0_CE1
GPIO 31 I2C0_SCL
Ground
GPIO 26 PWM0
Ground
GPIO 27
GPIO 28 PCM_DIN
GPIO 29 PCM DOUT
Hivetool
5 VDC Power HX711
5 VDC Power
Ground
Reserved serial console
Reserved serial console
Reserved I2S
Ground
Reserved HX711
Reserved HX711
Ground
Reserved Rain Gauge
Reserved SPI
Reserved SPI
Reserved ID EEPROM
Ground
Unused
Ground
Unused
Reserved I2S
Reserved I2S



Output of wiringPi gpio command (sudo gpio readall):

 +-----+-----+---------+------+---+--B Plus--+---+------+---------+-----+-----+
| BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
|     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
|   2 |   8 |   SDA.1 | ALT0 | 1 |  3 || 4  |   |      | 5V      |     |     |
|   3 |   9 |   SCL.1 | ALT0 | 1 |  5 || 6  |   |      | 0v      |     |     |
|   4 |   7 | GPIO. 7 |   IN | 1 |  7 || 8  | 1 | ALT0 | TxD     | 15  | 14  |
|     |     |      0v |      |   |  9 || 10 | 1 | ALT0 | RxD     | 16  | 15  |
|  17 |   0 | GPIO. 0 |   IN | 0 | 11 || 12 | 0 | OUT  | GPIO. 1 | 1   | 18  |
|  27 |   2 | GPIO. 2 |   IN | 0 | 13 || 14 |   |      | 0v      |     |     |
|  22 |   3 | GPIO. 3 |   IN | 0 | 15 || 16 | 0 | IN   | GPIO. 4 | 4   | 23  |
|     |     |    3.3v |      |   | 17 || 18 | 0 | OUT  | GPIO. 5 | 5   | 24  |
|  10 |  12 |    MOSI |   IN | 0 | 19 || 20 |   |      | 0v      |     |     |
|   9 |  13 |    MISO |   IN | 0 | 21 || 22 | 1 | IN   | GPIO. 6 | 6   | 25  |
|  11 |  14 |    SCLK |   IN | 0 | 23 || 24 | 1 | IN   | CE0     | 10  | 8   |
|     |     |      0v |      |   | 25 || 26 | 1 | IN   | CE1     | 11  | 7   |
|   0 |  30 |   SDA.0 |   IN | 1 | 27 || 28 | 1 | IN   | SCL.0   | 31  | 1   |
|   5 |  21 | GPIO.21 |   IN | 1 | 29 || 30 |   |      | 0v      |     |     |
|   6 |  22 | GPIO.22 |   IN | 1 | 31 || 32 | 0 | IN   | GPIO.26 | 26  | 12  |
|  13 |  23 | GPIO.23 |   IN | 0 | 33 || 34 |   |      | 0v      |     |     |
|  19 |  24 | GPIO.24 |   IN | 0 | 35 || 36 | 0 | IN   | GPIO.27 | 27  | 16  |
|  26 |  25 | GPIO.25 |   IN | 0 | 37 || 38 | 0 | IN   | GPIO.28 | 28  | 20  |
|     |     |      0v |      |   | 39 || 40 | 0 | IN   | GPIO.29 | 29  | 21  |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
| BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
+-----+-----+---------+------+---+--B Plus--+---+------+---------+-----+-----+



GPIO ordered by Signal Name

BroadcomAlt FunctionJ8H1H5
3.3 VDC Power113
3.3 VDC Power1717
5 VDC Power221
5 VDC Power44
GPIO 0I2C0_SDA27
GPIO 1I2C0_SCL28
GPIO 2I2C1 SDA33
GPIO 3I2C1 SCL55
GPIO 4GPCLK077
GPIO 5GPCLK129
GPIO 6GPCLK231
GPIO 7SPI0 CE12626
GPIO 8SPI0 CE02424
GPIO 9 SPI0 MISO2121
GPIO 10SPI0 MOSI1919
GPIO 11SPI0 SCLK2323
GPIO 12PWM032
GPIO 13PWM133
GPIO 14UART0 TXD88
GPIO 15UART0 RXD1010
GPIO 1636
GPIO 171111
GPIO 18PCM_CLK1212
GPIO 19PCM_FS35
GPIO 20PCM_DIN38
GPIO 21PCM DOUT40
GPIO 221515
GPIO 231616
GPIO 241818
GPIO 252222
GPIO 2637
GPIO 271313
GPIO 28I2C0_SDA3
GPIO 29I2C0_SCL4
GPIO 305
GPIO 316
Ground667
Ground998
Ground1414
Ground2020
Ground2525
Ground30
Ground34
Ground39

Resources

  1. eLinux.org RPi Low-level peripherals
  2. Raspberry Pi B+ Reduced Schematic
  3. eLinux.org BCM2835 GPIO functions
  4. BCM2835 Data Sheet (Manual)
  5. eLinux.org BCM2835 datasheet errata
  6. Hardware attached on Top
  7. WiringPi Alternate GPIO Assignments
  8. WiringPi Special Pin Functions