Take the 2-minute tour ×
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

I've found that many of the GPIO pins are not usable on a stock installation of Raspbian with gpio-admin.

For example, I wired up a relay to GPIO 21 only to find after some debugging that it didn't work as desired. Its neighbors GPIO 17 and GPIO 22 both work as expected. GPIO 21 is labeled as PCMD_OUT, so I'm guessing it's being used for another purpose.

So I'd like a few things explained in a straightforward way:

  1. Which pins are usable to read/write "out of the box?"
  2. Which pins can be used with some modifications (and how)?
  3. Which pins cannot be used at all?
share|improve this question

2 Answers 2

At reset only pins GPIO 14 & 15 are assigned to the alternate function UART, these two can be switched back to GPIO to provide a total of 17 GPIO pins

Do you have a Rev2 board? See here

R-Pi PCB Revision 2 UPDATE: According to Eben at [1] the R-Pi Rev.2 board being rolled out starting in September 2012 adds 4 more GPIO on a new connector called P5, and changes some of the existing P1 GPIO pinouts. On Rev2, GPIO_GEN2 [BCM2835/GPIO27] is routed to P1 pin 13, and changes what was SCL0/SDA0 to SCL1/SDA1: SCL1 [BCM2835/GPIO3] is routed to P1 pin 5, SDA1 [BCM2835/GPIO2] is routed to P1 pin 3. Also the power and ground connections previously marked "Do Not Connect" on P1 will remain as connected, specifically: P1-04:+5V0, P1-09:GND, P1-14:GND, P1-17:+3V3, P1-20:GND, P1-25:GND. According to this comment [2] (and confirmed in this post [3]) the P1 pinout is not expected to change in future beyond the current Rev.2 layout.

In that case you should try GPIO 27 instead of GPIO 21

share|improve this answer

Here is the layout of the P1 connector:

P1-02  5V      5V
P1-04  5V      5V
P1-06  GND     GND
P1-08  GPIO14  GPIO14
P1-10  GPIO15  GPIO15
P1-12  GPIO18  GPIO18
P1-14  GND     GND
P1-16  GPIO23  GPIO23       
P1-18  GPIO24  GPIO24       
P1-20  GND     GND
P1-22  GPIO25  GPIO25       
P1-24  GPIO8   GPIO8
P1-26  GPIO7   GPIO7

P1-01  3.3V    3.3V
P1-03  GPIO0   GPIO2   
P1-05  GPIO1   GPIO3   
P1-07  GPIO4   GPIO4       
P1-09  GND     GND
P1-11  GPIO17  GPIO17       
P1-13  GPIO21  GPIO27     
P1-15  GPIO22  GPIO22       
P1-17  3.3V    3.3V
P1-19  GPIO10  GPIO10    
P1-21  GPIO9   GPIO9    
P1-23  GPIO11  GPIO11    
P1-25  GND

This table shows both the Rev1 and Rev2 layouts. As you can see, in Rev2, the bin between GPIO17 and GPIO22 is GPIO27 instead of GPIO21. This is probably the source of your problem.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.