RPi BCM2835 GPIOs
Back to RPi_Low-level_peripherals
BCM2835 GPIO functions
This is a wiki-fied copy of Table 6-31 from the BCM2835 datasheet including any relevant errata, with a couple of extra columns, all nicely hyperlinked together and cross-referenced so that clicking on a function name will automatically take you to the description of that function.
Any GPIOs that aren't connected on the RaspberryPi Model B revision 1.0 circuit board are crossed out, and the GPIOs available on the GPIO Connector (P1) are in bold, with their default function (according to the schematics) in bold italics.
(If you want to see how GPIO-pins map back to actual pins, see this page). A selection of common circuits for interfacing with the GPIOs is given at RPi_GPIO_Interface_Circuits.
GPIO Pins Alternative Function Assignment
Pull | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 | RPi Rev1.0 signal name | RPi Rev2.0 signal name | RPi Rev1.0 connection | RPi Rev2.0 connection | Compute Module connection | CM IO Board connection | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
GPIO0 |
High | SDA0 | SA5 | <reserved> | SDA0 | SDA0 | P1-03 | S5-14 | J1-03 | J5-01 | |||
GPIO1 |
High | SCL0 | SA4 | <reserved> | SCL0 | SCL0 | P1-05 | S5-13 | J1-05 | J5-03 | |||
GPIO2 |
High | SDA1 | SA3 | <reserved> | SDA1 | SDA1 | S5-14 | P1-03 | J1-09 | J5-05 | |||
GPIO3 |
High | SCL1 | SA2 | <reserved> | SCL1 | SCL1 | S5-13 | P1-05 | J1-11 | J5-07 | |||
GPIO4 |
High | GPCLK0 | SA1 | <reserved> | ARM_TDI | GPIO_GCLK | GPIO_GCLK | P1-07 | P1-07 | J1-15 | J5-09 | ||
GPIO5 |
High | GPCLK1 | SA0 | <reserved> | ARM_TDO | CAM_CLK | CAM_CLK | S5-12 | S5-12 | J1-17 | J5-11 | ||
GPIO6 |
High | GPCLK2 | SOE_N / SE | <reserved> | ARM_RTCK | LAN_RUN | LAN_RUN | IC3-12 | IC3-12 | J1-21 | J5-13 | ||
GPIO7 |
High | SPI0_CE1_N | SWE_N / SRW_N | <reserved> | SPI_CE1_N | SPI_CE1_N | P1-26 | P1-26 | J1-23 | J5-15 | |||
GPIO8 |
High | SPI0_CE0_N | SD0 | <reserved> | SPI_CE0_N | SPI_CE0_N | P1-24 | P1-24 | J1-27 | J5-17 | |||
GPIO9 |
Low | SPI0_MISO | SD1 | <reserved> | SPI_MISO | SPI_MISO | P1-21 | P1-21 | J1-29 | J5-19 | |||
GPIO10 |
Low | SPI0_MOSI | SD2 | <reserved> | SPI_MOSI | SPI_MOSI | P1-19 | P1-19 | J1-33 | J5-21 | |||
GPIO11 |
Low | SPI0_SCLK | SD3 | <reserved> | SPI_SCLK | SPI_SCLK | P1-23 | P1-23 | J1-35 | J5-23 | |||
Low | PWM0 | SD4 | <reserved> | ARM_TMS | nc | nc | J1-45 | J5-25 | |||||
Low | PWM1 | SD5 | <reserved> | ARM_TCK | nc | nc | J1-47 | J5-27 | |||||
GPIO14 |
Low | TXD0 | SD6 | <reserved> | TXD1 | TXD0 | TXD0 | P1-08 | P1-08 | J1-51 | J5-29 | ||
GPIO15 |
Low | RXD0 | SD7 | <reserved> | RXD1 | RXD0 | RXD0 | P1-10 | P1-10 | J1-53 | J5-31 | ||
GPIO16 |
Low | <reserved> | SD8 | <reserved> | CTS0 | SPI1_CE2_N | CTS1 | STATUS_LED_N | STATUS_LED_N | D5 (OK LED) | D5 (ACT LED) | J1-57 | J5-33 |
GPIO17 |
Low | <reserved> | SD9 | <reserved> | RTS0 | SPI1_CE1_N | RTS1 | GPIO_GEN0 | GPIO_GEN0 | P1-11 | P1-11 | J1-59 | J5-35 |
GPIO18 |
Low | PCM_CLK | SD10 | <reserved> | BSCSL SDA / MOSI | SPI1_CE0_N | PWM0 | GPIO_GEN1 | GPIO_GEN1 | P1-12 | P1-12 | J1-63 | J5-37 |
Low | PCM_FS | SD11 | <reserved> | BSCSL SCL / SCLK | SPI1_MISO | PWM1 | nc | nc | J1-65 | J5-39 | |||
Low | PCM_DIN | SD12 | <reserved> | BSCSL / MISO | SPI1_MOSI | GPCLK0 | nc | nc | J1-69 | J5-41 | |||
GPIO21 |
Low | PCM_DOUT | SD13 | <reserved> | BSCSL / CE_N | SPI1_SCLK | GPCLK1 | GPIO_GEN2 | CAM_GPIO | P1-13 | S5-11 | J1-71 | J5-43 |
GPIO22 |
Low | <reserved> | SD14 | <reserved> | SD1_CLK | ARM_TRST | GPIO_GEN3 | GPIO_GEN3 | P1-15 | P1-15 | J1-75 | J5-45 | |
GPIO23 |
Low | <reserved> | SD15 | <reserved> | SD1_CMD | ARM_RTCK | GPIO_GEN4 | GPIO_GEN4 | P1-16 | P1-16 | J1-77 | J5-47 | |
GPIO24 |
Low | <reserved> | SD16 | <reserved> | SD1_DAT0 | ARM_TDO | GPIO_GEN5 | GPIO_GEN5 | P1-18 | P1-18 | J1-81 | J5-49 | |
GPIO25 |
Low | <reserved> | SD17 | <reserved> | SD1_DAT1 | ARM_TCK | GPIO_GEN6 | GPIO_GEN6 | P1-22 | P1-22 | J1-83 | J5-51 | |
Low | <reserved> | <reserved> | <reserved> | SD1_DAT2 | ARM_TDI | nc | nc | J1-87 | J5-53 | ||||
GPIO27 |
Low | <reserved> | <reserved> | <reserved> | SD1_DAT3 | ARM_TMS | CAM_GPIO | GPIO_GEN2 | S5-11 | P1-13 | J1-89 | J5-55 | |
GPIO28 |
- | SDA0 | SA5 | PCM_CLK | <reserved> | CONFIG0 | GPIO_GEN7 | R10 / R8 | P5-03 | J1-28 | J6-01 | ||
GPIO29 |
- | SCL0 | SA4 | PCM_FS | <reserved> | CONFIG1 | GPIO_GEN8 | R9 / R7 | P5-04 | J1-30 | J6-03 | ||
GPIO30 |
Low | <reserved> | SA3 | PCM_DIN | CTS0 | CTS1 | CONFIG2 | GPIO_GEN9 | R6 / R4 | P5-05 | J1-34 | J6-05 | |
GPIO31 |
Low | <reserved> | SA2 | PCM_DOUT | RTS0 | RTS1 | CONFIG3 | GPIO_GEN10 | R5 / R3 | P5-06 | J1-36 | J6-07 | |
Low | GPCLK0 | SA1 | <reserved> | TXD0 | TXD1 | nc | nc | J1-46 | J6-09 | ||||
Low | <reserved> | SA0 | <reserved> | RXD0 | RXD1 | nc | nc | J1-48 | J6-11 | ||||
High | GPCLK0 | SOE_N / SE | <reserved> | <reserved> | nc | nc | J1-52 | J6-13 | |||||
High | SPI0_CE1_N | SWE_N / SRW_N | <reserved> | nc | nc | J1-54 | J6-15 | ||||||
High | SPI0_CE0_N | SD0 | TXD0 | <reserved> | nc | nc | J1-58 | J6-17 | |||||
Low | SPI0_MISO | SD1 | RXD0 | <reserved> | nc | nc | J1-60 | J6-19 | |||||
Low | SPI0_MOSI | SD2 | RTS0 | <reserved> | nc | nc | J1-64 | J6-21 | |||||
Low | SPI0_SCLK | SD3 | CTS0 | <reserved> | nc | nc | J1-66 | J6-23 | |||||
GPIO40 |
Low | PWM0 | SD4 | <reserved> | SPI2_MISO | TXD1 | PWM0_OUT | PWM0_OUT | R21 | R21 | J1-70 | J6-25 | |
Low | PWM1 | SD5 | <reserved> | <reserved> | SPI2_MOSI | RXD1 | nc | nc | J1-72 | J6-27 | |||
Low | GPCLK1 | SD6 | <reserved> | <reserved> | SPI2_SCLK | RTS1 | nc | nc | J1-76 | J6-29 | |||
Low | GPCLK2 | SD7 | <reserved> | <reserved> | SPI2_CE0_N | CTS1 | nc | nc | J1-78 | J6-31 | |||
- | GPCLK1 | SDA0 | SDA1 | <reserved> | SPI2_CE1_N | nc | nc | J1-82 | J6-33 | ||||
GPIO45 |
- | PWM1 | SCL0 | SCL1 | <reserved> | SPI2_CE2_N | PWM1_OUT | PWM1_OUT | R27 | R27 | J1-84 | J6-35 | |
GPIO46 |
High | <internal> | HDMI_HPD_P | HDMI_HPD_P | IC1-6 | IC1-6 | J1-88 | Q4 | |||||
GPIO47 |
High | <internal> | SD_CARD_DET | SD_CARD_DET | S8-10 | S8-10 | J1-90 | Q2 | |||||
GPIO48 |
High | <internal> | SD_CLK_R | SD_CLK_R | R48 | R48 | R8 | n/a | |||||
GPIO49 |
High | <internal> | SD_CMD_R | SD_CMD_R | R47 | R47 | U3-1 | n/a | |||||
GPIO50 |
High | <internal> | SD_DATA0_R | SD_DATA0_R | R49 | R49 | U2-A3 | n/a | |||||
GPIO51 |
High | <internal> | SD_DATA1_R | SD_DATA1_R | R50 | R50 | U2-A4 | n/a | |||||
GPIO52 |
High | <internal> | SD_DATA2_R | SD_DATA2_R | R45 | R45 | U2-A5 | n/a | |||||
GPIO53 |
High | <internal> | SD_DATA3_R | SD_DATA3_R | R46 | R46 | U2-B2 | n/a | |||||
Pull | ALT0 | ALT1 | ALT2 | ALT3 | ALT4 | ALT5 | RPi Rev1.0 signal name | RPi Rev2.0 signal name | RPi Rev1.0 connection | RPi Rev2.0 connection | Compute Module connection | CM IO Board connection |
This next paragraph (which I've crossed out) only applies to Rev.1 boards, and even then these GPIOs were apparently never actually used for board identification!
Board revision coding
GPIO 28-31 are brought out, with each pin attached to a voltage divider. These four GPIO's are used to auto detect the revision version, as is indicated in the schematic (sheet to, location 7D). With 10K resistors either mounted or unmounted the pins are either pulled low or high, giving a four bit condition that can be read, with currently only two of the sixteen possible combinations used, one (code '0') for the model A and the other (code '1') for the model B, with codes '2' to 'F' reserved for future use.
As in the table above, the GPIOs available on the GPIO Connector (P1) are in bold, with their default function (according to the schematics) in bold italics.
Special function legend:
Name | Function | Datasheet section | GPIOs |
---|---|---|---|
SDA0 |
BSC master 0 data line | BSC | GPIO0 GPIO28 |
SCL0 |
BSC master 0 clock line | BSC | GPIO1 GPIO29 GPIO45 |
SDA1 |
BSC master 1 data line | BSC | GPIO2 |
SCL1 |
BSC master 1 clock line | BSC | GPIO3 GPIO45 |
GPCLK0 |
General purpose Clock 0 | <TBD> | GPIO4 |
GPCLK1 |
General purpose Clock 1 | <TBD> | GPIO5 GPIO21 |
GPCLK2 |
General purpose Clock 2 | <TBD> | GPIO6 |
SPI0_CE1_N |
SPI0 Chip select 1 | SPI | GPIO7 |
SPI0_CE0_N |
SPI0 Chip select 0 | SPI | GPIO8 |
SPI0_MISO |
SPI0 MISO | SPI | GPIO9 |
SPI0_MOSI |
SPI0 MOSI | SPI | GPIO10 |
SPI0_SCLK |
SPI0 Serial clock | SPI | GPIO11 |
PWMx |
Pulse Width Modulator 0..1 | Pulse Width Modulator | PWM0: PWM1: |
TXD0 |
UART 0 Transmit Data | UART | GPIO14 |
RXD0 |
UART 0 Receive Data | UART | GPIO15 |
CTS0 |
UART 0 Clear To Send | UART | GPIO16 GPIO30 |
RTS0 |
UART 0 Request To Send | UART | GPIO17 GPIO31 |
PCM_CLK |
PCM clock | PCM Audio | GPIO18 GPIO28 |
PCM_FS |
PCM Frame Sync | PCM Audio | |
PCM_DIN |
PCM Data in | PCM Audio | |
PCM_DOUT |
PCM data out | PCM Audio | GPIO21 GPIO31 |
SAx |
Secondary mem Address bus | Secondary Memory Interface | many |
SOE_N / SE |
Secondary mem. Controls | Secondary Memory Interface | GPIO6 |
SWE_N / SRW_N |
Secondary mem. Controls | Secondary Memory Interface | GPIO7 |
SDx |
Secondary mem. data bus | Secondary Memory Interface | many |
BSCSL SDA / MOSI |
BSC slave Data, SPI slave MOSI | BSC/SPI slave | GPIO18 |
BSCSL SCL / SCLK |
BSC slave Clock, SPI slave clock | BSC/SPI slave | |
BSCSL - / MISO |
BSC <not used>, SPI MISO | BSC/SPI slave | |
BSCSL - / CE_N |
BSC <not used>, SPI CSn | BSC/SPI slave | GPIO21 |
SPI1_CEx_N |
SPI1 Chip select 0-2 | Auxiliary I/O | SPI1_CE0_N: GPIO18 SPI1_CE1_N: GPIO17 SPI1_CE2_N: GPIO16 |
SPI1_MISO |
SPI1 MISO | Auxiliary I/O | |
SPI1_MOSI |
SPI1 MOSI | Auxiliary I/O | |
SPI1_SCLK |
SPI1 Serial clock | Auxiliary I/O | GPIO21 |
TXD1 |
UART 1 Transmit Data | Auxiliary I/O | GPIO14 |
RXD1 |
UART 1 Receive Data | Auxiliary I/O | GPIO15 |
CTS1 |
UART 1 Clear To Send | Auxiliary I/O | GPIO16 GPIO30 |
RTS1 |
UART 1 Request To Send | Auxiliary I/O | GPIO17 GPIO31 |
SPI2_CEx_N |
SPI2 Chip select 0-2 | Auxiliary I/O | SPI2_CE0_N: SPI2_CE1_N: SPI2_CE2_N: GPIO45 |
SPI2_MISO |
SPI2 MISO | Auxiliary I/O | GPIO40 |
SPI2_MOSI |
SPI2 MOSI | Auxiliary I/O | |
SPI2_SCLK |
SPI2 Serial clock | Auxiliary I/O | |
ARM_TRST |
ARM JTAG reset | <TBD> | GPIO22 |
ARM_RTCK |
ARM JTAG return clock | <TBD> | GPIO6 GPIO23 |
ARM_TDO |
ARM JTAG Data out | <TBD> | GPIO4 GPIO24 |
ARM_TCK |
ARM JTAG Clock | <TBD> | |
ARM_TDI |
ARM JTAG Data in | <TBD> | GPIO4 |
ARM_TMS |
ARM JTAG Mode select | <TBD> | |
Name | Function | Datasheet section | GPIOs |