2

On a Rpi2, gpio readall output:

ASCII graphic of gpio readall program output

Seems completely different from this image (on elinux.org):

Diagram of RPi B+ and 2 GPIO pinout

What am I missing?

  • GPIO notation in 2nd image translates to BCM column in the first image. While Name column is same as Wiring pi numbering. – dhruvvyas90 Dec 29 '15 at 12:42
  • I am totally confused. – hendry Dec 29 '15 at 13:48
  • I've edited (cropped and reposted) the original first image - so it is now much more readable IMHO. – SlySven Dec 30 '15 at 0:20
  • The image and the gpio output do correspond. Look at the two sides, which in the gpio chart are divided dead center (the "physical" column breaks the chart in half). At the top you have 3.3 V, 5 V. Next you have SDA 1, 5V, and so on down to 0V, GPIO 21. Here "0V" and ground (GND) are synonymous, and some of the pins have multiple functions and thus two names. SDA 1 is also GPIO 2, GPIO 21 is also a serial clock line (SCLK) for a SPI interface (which requires three pins, MOSI, MISO, SCLK). – goldilocks Dec 30 '15 at 20:28
4

The table from gpio readall all is very complete and accurate. The interpretation is as follows.
Looking from the top, connector on your right, numbers are odd on the left, even on the right, the square on the PCB is pin '1'.

column 'physical'  40 pin connector position.
column 'v'         current value
column 'mode'      current mode In/Out GPIO.setup(n, GPIO.OUT)
column 'name'      human description/function 
column 'wPI'       Wiring Pi (*) pin id, GPIO.setmode(GPIO.BOARD)
column 'BCM'       BCM pin Id. GPIO.setmode(GPIO.BCM)

* Wiring PI

3

I am not sure if this is what you are getting at but compare the elinux image with the name and physical columns in the GPIO readall output. The readall output also includes the BCM numbering scheme (the actual chip that runs the Pi) and the wiringpi (a library used to access the GPIO pins) numbering scheme. The readall output also includes the pin mode (input or output) and its current value (high 1 or low 0). This thread https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=101926 contains more info on the various pin naming schemes.exactly

  • For example GPIO7 seems in COMPLETELY different places. – hendry Dec 29 '15 at 13:47
  • Because of the numbering scheme. – Steve Robillard Dec 29 '15 at 14:07
  • I don't quite understand how the numbering scheme maps... – hendry Dec 29 '15 at 14:31
  • 1
    @hendry Hold the board so that the SD card end is at the top. Then look at the read all output, each row corresponds to one row of 2 pins. If you divide the table in to down the center. the left half of the table corresponds to the left column of pins on the board and the right side of the table the right column of pins. So looking at the first row of the table you have pins (physical) 1 and 2, and so on down the board until pin 26 or 40 (depending on the board you have). – Steve Robillard Dec 29 '15 at 21:11
  • 1
    @hendry If you look at row 6 (physical pins 11 and 12 on the board) that corresponds to (BCM calls this) pin 17 and 18 (as indicated by the first and last columns). Likewise, the wiringpi library calls these pins 0 and 1. Think about it like a foreign language in English we have one and two, in French we call it uno and deux, and in Spanish uno and dos. They all mean the same thing, – Steve Robillard Dec 29 '15 at 21:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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