raspberry GPIO引脚说明

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

 PullALT0ALT1ALT2ALT3ALT4ALT5RPi Rev1.0 signal nameRPi Rev2.0 signal nameRPi Rev1.0connectionRPi Rev2.0connection
GPIO0
HighSDA0SA5<reserved>   SDA0SDA0P1-03S5-14
GPIO1
HighSCL0SA4<reserved>   SCL0SCL0P1-05S5-13
GPIO2
HighSDA1SA3<reserved>   SDA1SDA1S5-14P1-03
GPIO3
HighSCL1SA2<reserved>   SCL1SCL1S5-13P1-05
GPIO4
HighGPCLK0SA1<reserved>  ARM_TDIGPIO_GCLKGPIO_GCLKP1-07P1-07
GPIO5
HighGPCLK1SA0<reserved>  ARM_TDOCAM_CLKCAM_CLKS5-12S5-12
GPIO6
HighGPCLK2SOE_N / SE<reserved>  ARM_RTCKLAN_RUNLAN_RUNIC3-12IC3-12
GPIO7
HighSPI0_CE1_NSWE_N / SRW_N<reserved>   SPI_CE1_NSPI_CE1_NP1-26P1-26
GPIO8
HighSPI0_CE0_NSD0<reserved>   SPI_CE0_NSPI_CE0_NP1-24P1-24
GPIO9
LowSPI0_MISOSD1<reserved>   SPI_MISOSPI_MISOP1-21P1-21
GPIO10
LowSPI0_MOSISD2<reserved>   SPI_MOSISPI_MOSIP1-19P1-19
GPIO11
LowSPI0_SCLKSD3<reserved>   SPI_SCLKSPI_SCLKP1-23P1-23
GPIO12
LowPWM0SD4<reserved>  ARM_TMSncnc  
GPIO13
LowPWM1SD5<reserved>  ARM_TCKncnc  
GPIO14
LowTXD0SD6<reserved>  TXD1TXD0TXD0P1-08P1-08
GPIO15
LowRXD0SD7<reserved>  RXD1RXD0RXD0P1-10P1-10
GPIO16
Low<reserved>SD8<reserved>CTS0SPI1_CE2_NCTS1STATUS_LED_NSTATUS_LED_ND5 (OK LED)D5 (ACT LED)
GPIO17
Low<reserved>SD9<reserved>RTS0SPI1_CE1_NRTS1GPIO_GEN0GPIO_GEN0P1-11P1-11
GPIO18
LowPCM_CLKSD10<reserved>BSCSL SDA / MOSISPI1_CE0_NPWM0GPIO_GEN1GPIO_GEN1P1-12P1-12
GPIO19
LowPCM_FSSD11<reserved>BSCSL SCL / SCLKSPI1_MISOPWM1ncnc  
GPIO20
LowPCM_DINSD12<reserved>BSCSL / MISOSPI1_MOSIGPCLK0ncnc  
GPIO21
LowPCM_DOUTSD13<reserved>BSCSL / CE_NSPI1_SCLKGPCLK1GPIO_GEN2CAM_GPIOP1-13S5-11
GPIO22
Low<reserved>SD14<reserved>SD1_CLKARM_TRST GPIO_GEN3GPIO_GEN3P1-15P1-15
GPIO23
Low<reserved>SD15<reserved>SD1_CMDARM_RTCK GPIO_GEN4GPIO_GEN4P1-16P1-16
GPIO24
Low<reserved>SD16<reserved>SD1_DAT0ARM_TDO GPIO_GEN5GPIO_GEN5P1-18P1-18
GPIO25
Low<reserved>SD17<reserved>SD1_DAT1ARM_TCK GPIO_GEN6GPIO_GEN6P1-22P1-22
GPIO26
Low<reserved><reserved><reserved>SD1_DAT2ARM_TDI ncnc  
GPIO27
Low<reserved><reserved><reserved>SD1_DAT3ARM_TMS CAM_GPIOGPIO_GEN2S5-11P1-13
GPIO28
-SDA0SA5PCM_CLK<reserved>  CONFIG0GPIO_GEN7R10 / R8P5-3
GPIO29
-SCL0SA4PCM_FS<reserved>  CONFIG1GPIO_GEN8R9 / R7P5-4
GPIO30
Low<reserved>SA3PCM_DINCTS0 CTS1CONFIG2GPIO_GEN9R6 / R4P5-5
GPIO31
Low<reserved>SA2PCM_DOUTRTS0 RTS1CONFIG3GPIO_GEN10R5 / R3P5-6
GPIO32
LowGPCLK0SA1<reserved>TXD0 TXD1ncnc  
GPIO33
Low<reserved>SA0<reserved>RXD0 RXD1ncnc  
GPIO34
HighGPCLK0SOE_N / SE<reserved><reserved>  ncnc  
GPIO35
HighSPI0_CE1_NSWE_N / SRW_N <reserved>  ncnc  
GPIO36
HighSPI0_CE0_NSD0TXD0<reserved>  ncnc  
GPIO37
LowSPI0_MISOSD1RXD0<reserved>  ncnc  
GPIO38
LowSPI0_MOSISD2RTS0<reserved>  ncnc  
GPIO39
LowSPI0_SCLKSD3CTS0<reserved>  ncnc  
GPIO40
LowPWM0SD4 <reserved>SPI2_MISOTXD1PWM0_OUTPWM0_OUTR21R21
GPIO41
LowPWM1SD5<reserved><reserved>SPI2_MOSIRXD1ncnc  
GPIO42
LowGPCLK1SD6<reserved><reserved>SPI2_SCLKRTS1ncnc  
GPIO43
LowGPCLK2SD7<reserved><reserved>SPI2_CE0_NCTS1ncnc  
GPIO44
-GPCLK1SDA0SDA1<reserved>SPI2_CE1_N ncnc  
GPIO45
-PWM1SCL0SCL1<reserved>SPI2_CE2_N PWM1_OUTPWM1_OUTR27R27
GPIO46
High   <internal>  HDMI_HPD_PHDMI_HPD_PIC1-6IC1-6
GPIO47
High   <internal>  SD_CARD_DETSD_CARD_DETS8-10S8-10
GPIO48
High   <internal>  SD_CLK_RSD_CLK_RR48R48
GPIO49
High   <internal>  SD_CMD_RSD_CMD_RR47R47
GPIO50
High   <internal>  SD_DATA0_RSD_DATA0_RR49R49
GPIO51
High   <internal>  SD_DATA1_RSD_DATA1_RR50R50
GPIO52
High   <internal>  SD_DATA2_RSD_DATA2_RR45R45
GPIO53
High   <internal>  SD_DATA3_RSD_DATA3_RR46R46
 PullALT0ALT1ALT2ALT3ALT4ALT5RPi Rev1.0 signal nameRPi Rev2.0 signal nameRPi Rev1.0connectionRPi Rev2.0connection


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:

NameFunctionDatasheet sectionGPIOs
SDA0
BSC master 0 data lineBSCGPIO0 GPIO28 GPIO44
SCL0
BSC master 0 clock lineBSCGPIO1 GPIO29 GPIO45
SDA1
BSC master 1 data lineBSCGPIO2 GPIO44
SCL1
BSC master 1 clock lineBSCGPIO3 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 1SPIGPIO7 GPIO35
SPI0_CE0_N
SPI0 Chip select 0SPIGPIO8 GPIO36
SPI0_MISO
SPI0 MISOSPIGPIO9 GPIO37
SPI0_MOSI
SPI0 MOSISPIGPIO10 GPIO38
SPI0_SCLK
SPI0 Serial clockSPIGPIO11 GPIO39
PWMx
Pulse Width Modulator 0..1Pulse Width ModulatorPWM0: GPIO12 GPIO18 GPIO40
PWM1: GPIO13 GPIO19 GPIO41 GPIO45
TXD0
UART 0 Transmit DataUARTGPIO14 GPIO32 GPIO36
RXD0
UART 0 Receive DataUARTGPIO15 GPIO33 GPIO37
CTS0
UART 0 Clear To SendUARTGPIO16 GPIO30 GPIO39
RTS0
UART 0 Request To SendUARTGPIO17 GPIO31 GPIO38
PCM_CLK
PCM clockPCM AudioGPIO18 GPIO28
PCM_FS
PCM Frame SyncPCM AudioGPIO19 GPIO29
PCM_DIN
PCM Data inPCM AudioGPIO20 GPIO30
PCM_DOUT
PCM data outPCM AudioGPIO21 GPIO31
SAx
Secondary mem Address busSecondary Memory Interfacemany
SOE_N / SE
Secondary mem. ControlsSecondary Memory InterfaceGPIO6 GPIO34
SWE_N / SRW_N
Secondary mem. ControlsSecondary Memory InterfaceGPIO7 GPIO35
SDx
Secondary mem. data busSecondary Memory Interfacemany
BSCSL SDA / MOSI
BSC slave Data, SPI slave MOSIBSC/SPI slaveGPIO18
BSCSL SCL / SCLK
BSC slave Clock, SPI slave clockBSC/SPI slaveGPIO19
BSCSL - / MISO
BSC <not used>, SPI MISOBSC/SPI slaveGPIO20
BSCSL - / CE_N
BSC <not used>, SPI CSnBSC/SPI slaveGPIO21
SPI1_CEx_N
SPI1 Chip select 0-2Auxiliary I/OSPI1_CE0_N: GPIO18
SPI1_CE1_N: GPIO17
SPI1_CE2_N: GPIO16
SPI1_MISO
SPI1 MISOAuxiliary I/OGPIO19
SPI1_MOSI
SPI1 MOSIAuxiliary I/OGPIO20
SPI1_SCLK
SPI1 Serial clockAuxiliary I/OGPIO21
TXD1
UART 1 Transmit DataAuxiliary I/OGPIO14 GPIO32 GPIO40
RXD1
UART 1 Receive DataAuxiliary I/OGPIO15 GPIO33 GPIO41
CTS1
UART 1 Clear To SendAuxiliary I/OGPIO16 GPIO30 GPIO43
RTS1
UART 1 Request To SendAuxiliary I/OGPIO17 GPIO31 GPIO42
SPI2_CEx_N
SPI2 Chip select 0-2Auxiliary I/OSPI2_CE0_N: GPIO43
SPI2_CE1_N: GPIO44
SPI2_CE2_N: GPIO45
SPI2_MISO
SPI2 MISOAuxiliary I/OGPIO40
SPI2_MOSI
SPI2 MOSIAuxiliary I/OGPIO41
SPI2_SCLK
SPI2 Serial clockAuxiliary I/OGPIO42
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
NameFunctionDatasheet sectionGPIOs

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值