Difference between revisions of "GPIO Pinout"
(→Notes) |
|||
(30 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
==Notes== | ==Notes== | ||
#GPIO pins are 3.3 volt logic levels and are not tolerant of 5V levels | #GPIO pins are 3.3 volt logic levels and are not tolerant of 5V levels | ||
− | #THE GPIO PINS ARE NUMBERED TWO DIFFERENT WAYS, Broadcom and RPi. | + | #THE GPIO PINS ARE NUMBERED TWO DIFFERENT WAYS, Broadcom and RPi. Hivetool uses RPi numbers. |
#These GPIO properties are set as a block, not per pin (GPIO pins 0-27 are in the same block). | #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. | ##Can interrupt based on high/low/rise/fall/change. | ||
Line 21: | Line 21: | ||
<table border=1> | <table border=1> | ||
<th colspan=3>Color Legend</th> | <th colspan=3>Color Legend</th> | ||
− | <tr><td bgcolor="orange">3.3 VDC Power</td><td bgcolor="blue">Serial Console/Power</td><td bgcolor=" | + | <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=" | + | <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=" | + | <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= | + | <tr><td bgcolor="#cceecc" colspan=1>Unused</td><td bgcolor="#8888ff">LED</td><td bgcolor="bb55bb">SPI</td></tr> |
</table> | </table> | ||
</center> | </center> | ||
<br> | <br> | ||
− | Light green signals labeled "Unused" are available for development. Other colors are being used or are reserved for sensor families. A | + | 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> | <br> | ||
==GPIO ordered by Header Pins== | ==GPIO ordered by Header Pins== | ||
− | |||
− | The first 26 pins on J8 (A+ | + | '''''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. | ||
+ | |||
+ | |||
+ | |||
<center> | <center> | ||
<table> | <table> | ||
Line 44: | 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=" | + | <tr><td bgcolor="#66aa66">Reserved for 1-Wire</td></tr> |
− | <tr><td bgcolor=" | + | <tr><td bgcolor="555555">Ground</td></tr> |
− | <tr><td bgcolor=" | + | <tr><td bgcolor="#8888ff">Reserved for LED</td></tr> |
− | <tr><td bgcolor="# | + | <tr><td bgcolor="#44ff44">Reserved DHT22</td></tr> |
− | <tr><td bgcolor="# | + | <tr><td bgcolor="#44ff44">Reserved DHT22</td></tr> |
− | <tr><td bgcolor=" | + | <tr><td bgcolor="Orange">3.3 VDC Power</td></tr> |
− | <tr><td bgcolor="# | + | <tr><td bgcolor="#bb55bb">Reserved SPI</td></tr> |
− | <tr><td bgcolor="# | + | <tr><td bgcolor="#bb55bb">Reserved SPI</td></tr> |
− | <tr><td bgcolor="# | + | <tr><td bgcolor="#bb55bb">Reserved SPI</td></tr> |
− | + | <tr><td bgcolor="#555555">Ground</td></tr> | |
− | <tr><td bgcolor="# | ||
<tr><td bgcolor="#eecccc">Reserved ID EEPROM</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> | ||
Line 63: | 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="# | + | <tr><td bgcolor="#555555">Ground</td></tr> |
</table> | </table> | ||
</td> | </td> | ||
Line 72: | Line 78: | ||
<tr><td bgcolor="yellow">GPIO 8 <b>I2C SDA</b></td></tr> | <tr><td bgcolor="yellow">GPIO 8 <b>I2C SDA</b></td></tr> | ||
<tr><td bgcolor="yellow">GPIO 9 <b>I2C SCL</b></td></tr> | <tr><td bgcolor="yellow">GPIO 9 <b>I2C SCL</b></td></tr> | ||
− | <tr><td bgcolor="# | + | <tr><td bgcolor="#66aa66">GPIO 7 GPCLK0</td></tr> |
<tr><td bgcolor="#555555">Ground</td></tr> | <tr><td bgcolor="#555555">Ground</td></tr> | ||
− | <tr><td bgcolor="# | + | <tr><td bgcolor="#8888ff">GPIO 0</td></tr> |
− | <tr><td bgcolor="# | + | <tr><td bgcolor="#44ff44">GPIO 2</td></tr> |
− | <tr><td bgcolor="# | + | <tr><td bgcolor="#44ff44">GPIO 3</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="# | + | <tr><td bgcolor="#bb55bb">GPIO 12 SPI0 MOSI</td></tr> |
− | <tr><td bgcolor="# | + | <tr><td bgcolor="#bb55bb">GPIO 13 SPI0 MISO</td></tr> |
− | <tr><td bgcolor="# | + | <tr><td bgcolor="#bb55bb">GPIO 14 SPI0 SCLK</td></tr> |
<tr><td bgcolor="#555555">Ground</td></tr> | <tr><td bgcolor="#555555">Ground</td></tr> | ||
<tr><td bgcolor="#eecccc">GPIO 30 I2C0_SDA</td></tr> | <tr><td bgcolor="#eecccc">GPIO 30 I2C0_SDA</td></tr> | ||
Line 97: | Line 103: | ||
<tr><td bgcolor="yellow">GPIO 2 <b>I2C SDA</b></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="yellow">GPIO 3 <b>I2C SCL</b></td></tr> | ||
− | <tr><td bgcolor="# | + | <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="# | + | <tr><td bgcolor="#8888ff">GPIO 17</td></tr> |
− | <tr><td bgcolor="# | + | <tr><td bgcolor="#44ff44">GPIO 27</td></tr> |
− | <tr><td bgcolor="# | + | <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="# | + | <tr><td bgcolor="#bb55bb">GPIO 10 SPI0 MOSI</td></tr> |
− | <tr><td bgcolor="# | + | <tr><td bgcolor="#bb55bb">GPIO 09 SPI0 MISO</td></tr> |
− | <tr><td bgcolor="# | + | <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="#eecccc">GPIO 0 I2C0_SDA</td></tr> | <tr><td bgcolor="#eecccc">GPIO 0 I2C0_SDA</td></tr> | ||
Line 154: | 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=" | + | <tr><td bgcolor="11bb11">GPIO 25</td></tr> |
− | <tr><td bgcolor=" | + | <tr><td bgcolor="bb55bb">GPIO 8 SPI0_CE0</td></tr> |
− | <tr><td bgcolor=" | + | <tr><td bgcolor="bb55bb">GPIO 7 SPI0_CE1</td></tr> |
<tr><td bgcolor="eecccc">GPIO 1 I2C0_SCL</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> | ||
Line 179: | Line 185: | ||
<tr><td bgcolor="green">GPIO 5</td></tr> | <tr><td bgcolor="green">GPIO 5</td></tr> | ||
<tr><td bgcolor="#555555">Ground</td></tr> | <tr><td bgcolor="#555555">Ground</td></tr> | ||
− | <tr><td bgcolor=" | + | <tr><td bgcolor="11bb11">GPIO 6</td></tr> |
− | <tr><td bgcolor=" | + | <tr><td bgcolor="bb55bb">GPIO 10 SPI0_CE0</td></tr> |
− | <tr><td bgcolor=" | + | <tr><td bgcolor="bb55bb">GPIO 11 SPI0_CE1</td></tr> |
<tr><td bgcolor="eecccc">GPIO 31 I2C0_SCL</td></tr> | <tr><td bgcolor="eecccc">GPIO 31 I2C0_SCL</td></tr> | ||
<tr><td bgcolor="#555555">Ground</td></tr> | <tr><td bgcolor="#555555">Ground</td></tr> | ||
Line 194: | Line 200: | ||
<table border=1> | <table border=1> | ||
<th>Hivetool</th> | <th>Hivetool</th> | ||
− | <tr><td bgcolor=" | + | <tr><td bgcolor="red">5 VDC Power HX711</td></tr> |
− | <tr><td bgcolor=" | + | <tr><td bgcolor="red">5 VDC Power</td></tr> |
− | <tr><td bgcolor=" | + | <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="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="#555555">Ground</td></tr> | |
− | <tr><td bgcolor="# | + | <tr><td bgcolor="#11bb11">Reserved Rain Gauge</td></tr> |
− | <tr><td bgcolor="# | + | <tr><td bgcolor="#bb55bb">Reserved SPI</td></tr> |
− | <tr><td bgcolor="# | + | <tr><td bgcolor="#bb55bb">Reserved SPI</td></tr> |
− | <tr><td bgcolor="# | ||
<tr><td bgcolor="#eecccc">Reserved ID EEPROM</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="# | + | <tr><td bgcolor="#555555">Ground</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 254: | Line 260: | ||
==GPIO ordered by Signal Name== | ==GPIO ordered by Signal Name== | ||
<table border=1> | <table border=1> | ||
− | <th> | + | <th>Broadcom</th><th>Alt Function</th><th>J8</th><th>H1</th><th>H5</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></td><td>1</td><td>1</td><td>3</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></td><td>17</td><td>17</td><td></td></tr> | ||
Line 308: | Line 314: | ||
#[http://elinux.org/BCM2835_datasheet_errata eLinux.org BCM2835 datasheet errata] | #[http://elinux.org/BCM2835_datasheet_errata eLinux.org BCM2835 datasheet errata] | ||
#[https://github.com/raspberrypi/hats Hardware attached on Top] | #[https://github.com/raspberrypi/hats Hardware attached on Top] | ||
− | #[http://wiringpi.com/pins/ | + | #[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
Contents
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
- GPIO pins are 3.3 volt logic levels and are not tolerant of 5V levels
- THE GPIO PINS ARE NUMBERED TWO DIFFERENT WAYS, Broadcom and RPi. Hivetool uses RPi numbers.
- 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 | ||
---|---|---|
3.3 VDC Power | Serial Console/Power | I2C Sensors |
5 VDC Power | HX711 Scale | I2S Audio |
Ground | DHT22 Temp/Hum. | SPI |
HAT ID ROM | Rain Gauge | 1-Wire |
Unused | LED | SPI |
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:
- 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.
|
|
|
|
|
|
|
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
Broadcom | Alt Function | J8 | H1 | H5 |
---|---|---|---|---|
3.3 VDC Power | 1 | 1 | 3 | |
3.3 VDC Power | 17 | 17 | ||
5 VDC Power | 2 | 2 | 1 | |
5 VDC Power | 4 | 4 | ||
GPIO 0 | I2C0_SDA | 27 | ||
GPIO 1 | I2C0_SCL | 28 | ||
GPIO 2 | I2C1 SDA | 3 | 3 | |
GPIO 3 | I2C1 SCL | 5 | 5 | |
GPIO 4 | GPCLK0 | 7 | 7 | |
GPIO 5 | GPCLK1 | 29 | ||
GPIO 6 | GPCLK2 | 31 | ||
GPIO 7 | SPI0 CE1 | 26 | 26 | |
GPIO 8 | SPI0 CE0 | 24 | 24 | |
GPIO 9 | SPI0 MISO | 21 | 21 | |
GPIO 10 | SPI0 MOSI | 19 | 19 | |
GPIO 11 | SPI0 SCLK | 23 | 23 | |
GPIO 12 | PWM0 | 32 | ||
GPIO 13 | PWM1 | 33 | ||
GPIO 14 | UART0 TXD | 8 | 8 | |
GPIO 15 | UART0 RXD | 10 | 10 | |
GPIO 16 | 36 | |||
GPIO 17 | 11 | 11 | ||
GPIO 18 | PCM_CLK | 12 | 12 | |
GPIO 19 | PCM_FS | 35 | ||
GPIO 20 | PCM_DIN | 38 | ||
GPIO 21 | PCM DOUT | 40 | ||
GPIO 22 | 15 | 15 | ||
GPIO 23 | 16 | 16 | ||
GPIO 24 | 18 | 18 | ||
GPIO 25 | 22 | 22 | ||
GPIO 26 | 37 | |||
GPIO 27 | 13 | 13 | ||
GPIO 28 | I2C0_SDA | 3 | ||
GPIO 29 | I2C0_SCL | 4 | ||
GPIO 30 | 5 | |||
GPIO 31 | 6 | |||
Ground | 6 | 6 | 7 | |
Ground | 9 | 9 | 8 | |
Ground | 14 | 14 | ||
Ground | 20 | 20 | ||
Ground | 25 | 25 | ||
Ground | 30 | |||
Ground | 34 | |||
Ground | 39 |