RPi BCM2835 GPIOs

From eLinux.org
Revision as of 10:35, 6 December 2012 by BerryBerry (Talk | contribs)

Jump to: navigation, search


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)

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
GPIO0
High SDA0 SA5 <reserved> SDA0 SDA0 P1-03 S5-14
GPIO1
High SCL0 SA4 <reserved> SCL0 SCL0 P1-05 S5-13
GPIO2
High SDA1 SA3 <reserved> SDA1 SDA1 S5-14 P1-03
GPIO3
High SCL1 SA2 <reserved> SCL1 SCL1 S5-13 P1-05
GPIO4
High GPCLK0 SA1 <reserved> ARM_TDI GPIO_GCLK GPIO_GCLK P1-07 P1-07
GPIO5
High GPCLK1 SA0 <reserved> ARM_TDO CAM_CLK CAM_CLK S5-12 S5-12
GPIO6
High GPCLK2 SOE_N / SE <reserved> ARM_RTCK LAN_RUN LAN_RUN IC3-12 IC3-12
GPIO7
High SPI0_CE1_N SWE_N / SRW_N <reserved> SPI_CE1_N SPI_CE1_N P1-26 P1-26
GPIO8
High SPI0_CE0_N SD0 <reserved> SPI_CE0_N SPI_CE0_N P1-24 P1-24
GPIO9
Low SPI0_MISO SD1 <reserved> SPI_MISO SPI_MISO P1-21 P1-21
GPIO10
Low SPI0_MOSI SD2 <reserved> SPI_MOSI SPI_MOSI P1-19 P1-19
GPIO11
Low SPI0_SCLK SD3 <reserved> SPI_SCLK SPI_SCLK P1-23 P1-23
GPIO12
Low PWM0 SD4 <reserved> ARM_TMS nc nc
GPIO13
Low PWM1 SD5 <reserved> ARM_TCK nc nc
GPIO14
Low TXD0 SD6 <reserved> TXD1 TXD0 TXD0 P1-08 P1-08
GPIO15
Low RXD0 SD7 <reserved> RXD1 RXD0 RXD0 P1-10 P1-10
GPIO16
Low <reserved> SD8 <reserved> CTS0 SPI1_CE2_N CTS1 STATUS_LED_N STATUS_LED_N D5 (OK LED) D5 (ACT LED)
GPIO17
Low <reserved> SD9 <reserved> RTS0 SPI1_CE1_N RTS1 GPIO_GEN0 GPIO_GEN0 P1-11 P1-11
GPIO18
Low PCM_CLK SD10 <reserved> BSCSL SDA / MOSI SPI1_CE0_N PWM0 GPIO_GEN1 GPIO_GEN1 P1-12 P1-12
GPIO19
Low PCM_FS SD11 <reserved> BSCSL SCL / SCLK SPI1_MISO PWM1 nc nc
GPIO20
Low PCM_DIN SD12 <reserved> BSCSL / MISO SPI1_MOSI GPCLK0 nc nc
GPIO21
Low PCM_DOUT SD13 <reserved> BSCSL / CE_N SPI1_SCLK GPCLK1 GPIO_GEN2 CAM_GPIO P1-13 S5-11
GPIO22
Low <reserved> SD14 <reserved> SD1_CLK ARM_TRST GPIO_GEN3 GPIO_GEN3 P1-15 P1-15
GPIO23
Low <reserved> SD15 <reserved> SD1_CMD ARM_RTCK GPIO_GEN4 GPIO_GEN4 P1-16 P1-16
GPIO24
Low <reserved> SD16 <reserved> SD1_DAT0 ARM_TDO GPIO_GEN5 GPIO_GEN5 P1-18 P1-18
GPIO25
Low <reserved> SD17 <reserved> SD1_DAT1 ARM_TCK GPIO_GEN6 GPIO_GEN6 P1-22 P1-22
GPIO26
Low <reserved> <reserved> <reserved> SD1_DAT2 ARM_TDI nc nc
GPIO27
Low <reserved> <reserved> <reserved> SD1_DAT3 ARM_TMS CAM_GPIO GPIO_GEN2 S5-11 P1-13
GPIO28
- SDA0 SA5 PCM_CLK <reserved> CONFIG0 GPIO_GEN7 R10 / R8 P5-3
GPIO29
- SCL0 SA4 PCM_FS <reserved> CONFIG1 GPIO_GEN8 R9 / R7 P5-4
GPIO30
Low <reserved> SA3 PCM_DIN CTS0 CTS1 CONFIG2 GPIO_GEN9 R6 / R4 P5-5
GPIO31
Low <reserved> SA2 PCM_DOUT RTS0 RTS1 CONFIG3 GPIO_GEN10 R5 / R3 P5-6
GPIO32
Low GPCLK0 SA1 <reserved> TXD0 TXD1 nc nc
GPIO33
Low <reserved> SA0 <reserved> RXD0 RXD1 nc nc
GPIO34
High GPCLK0 SOE_N / SE <reserved> <reserved> nc nc
GPIO35
High SPI0_CE1_N SWE_N / SRW_N <reserved> nc nc
GPIO36
High SPI0_CE0_N SD0 TXD0 <reserved> nc nc
GPIO37
Low SPI0_MISO SD1 RXD0 <reserved> nc nc
GPIO38
Low SPI0_MOSI SD2 RTS0 <reserved> nc nc
GPIO39
Low SPI0_SCLK SD3 CTS0 <reserved> nc nc
GPIO40
Low PWM0 SD4 <reserved> SPI2_MISO TXD1 PWM0_OUT PWM0_OUT R21 R21
GPIO41
Low PWM1 SD5 <reserved> <reserved> SPI2_MOSI RXD1 nc nc
GPIO42
Low GPCLK1 SD6 <reserved> <reserved> SPI2_SCLK RTS1 nc nc
GPIO43
Low GPCLK2 SD7 <reserved> <reserved> SPI2_CE0_N CTS1 nc nc
GPIO44
- GPCLK1 SDA0 SDA1 <reserved> SPI2_CE1_N nc nc
GPIO45
- PWM1 SCL0 SCL1 <reserved> SPI2_CE2_N PWM1_OUT PWM1_OUT R27 R27
GPIO46
High <internal> HDMI_HPD_P HDMI_HPD_P IC1-6 IC1-6
GPIO47
High <internal> SD_CARD_DET SD_CARD_DET S8-10 S8-10
GPIO48
High <internal> SD_CLK_R SD_CLK_R R48 R48
GPIO49
High <internal> SD_CMD_R SD_CMD_R R47 R47
GPIO50
High <internal> SD_DATA0_R SD_DATA0_R R49 R49
GPIO51
High <internal> SD_DATA1_R SD_DATA1_R R50 R50
GPIO52
High <internal> SD_DATA2_R SD_DATA2_R R45 R45
GPIO53
High <internal> SD_DATA3_R SD_DATA3_R R46 R46
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

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 GPIO44
SCL0
BSC master 0 clock line BSC GPIO1 GPIO29 GPIO45
SDA1
BSC master 1 data line BSC GPIO2 GPIO44
SCL1
BSC master 1 clock line BSC GPIO3 GPIO45
GPCLK0
General purpose Clock 0 <TBD> GPIO4 GPIO20 GPIO32 GPIO34
GPCLK1
General purpose Clock 1 <TBD> GPIO5 GPIO21 GPIO42 GPIO44
GPCLK2
General purpose Clock 2 <TBD> GPIO6 GPIO43
SPI0_CE1_N
SPI0 Chip select 1 SPI GPIO7 GPIO35
SPI0_CE0_N
SPI0 Chip select 0 SPI GPIO8 GPIO36
SPI0_MISO
SPI0 MISO SPI GPIO9 GPIO37
SPI0_MOSI
SPI0 MOSI SPI GPIO10 GPIO38
SPI0_SCLK
SPI0 Serial clock SPI GPIO11 GPIO39
PWMx
Pulse Width Modulator 0..1 Pulse Width Modulator PWM0: GPIO12 GPIO18 GPIO40
PWM1: GPIO13 GPIO19 GPIO41 GPIO45
TXD0
UART 0 Transmit Data UART GPIO14 GPIO32 GPIO36
RXD0
UART 0 Receive Data UART GPIO15 GPIO33 GPIO37
CTS0
UART 0 Clear To Send UART GPIO16 GPIO30 GPIO39
RTS0
UART 0 Request To Send UART GPIO17 GPIO31 GPIO38
PCM_CLK
PCM clock PCM Audio GPIO18 GPIO28
PCM_FS
PCM Frame Sync PCM Audio GPIO19 GPIO29
PCM_DIN
PCM Data in PCM Audio GPIO20 GPIO30
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 GPIO34
SWE_N / SRW_N
Secondary mem. Controls Secondary Memory Interface GPIO7 GPIO35
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 GPIO19
BSCSL - / MISO
BSC <not used>, SPI MISO BSC/SPI slave GPIO20
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 GPIO19
SPI1_MOSI
SPI1 MOSI Auxiliary I/O GPIO20
SPI1_SCLK
SPI1 Serial clock Auxiliary I/O GPIO21
TXD1
UART 1 Transmit Data Auxiliary I/O GPIO14 GPIO32 GPIO40
RXD1
UART 1 Receive Data Auxiliary I/O GPIO15 GPIO33 GPIO41
CTS1
UART 1 Clear To Send Auxiliary I/O GPIO16 GPIO30 GPIO43
RTS1
UART 1 Request To Send Auxiliary I/O GPIO17 GPIO31 GPIO42
SPI2_CEx_N
SPI2 Chip select 0-2 Auxiliary I/O SPI2_CE0_N: GPIO43
SPI2_CE1_N: GPIO44
SPI2_CE2_N: GPIO45
SPI2_MISO
SPI2 MISO Auxiliary I/O GPIO40
SPI2_MOSI
SPI2 MOSI Auxiliary I/O GPIO41
SPI2_SCLK
SPI2 Serial clock Auxiliary I/O GPIO42
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> GPIO13 GPIO25
ARM_TDI
ARM JTAG Data in <TBD> GPIO4 GPIO26
ARM_TMS
ARM JTAG Mode select <TBD> GPIO12 GPIO27
Name Function Datasheet section GPIOs