12

My Pi 2 kit came with the following GPIO pin reference card.

Pi GPIO Header Quick Reference

In addition to showing all of the 5V, 3.3V, GND, and GPIO pin numbers, it has additional information on some of the GPIO pins like TXD, RXD, UART, CLK, PCM, DE0, CE1, SPI, DIN, DOUT, PCM, SDA, SCL, I2C, MOSI, MISO, SCLK, SPI, PCM, FS along with various colors on these.

What does all of this mean? I am assuming these are special pins for something. Are not all of the GPIOs usable in the same way?

12

The Broadcom datasheet linked from raspberrypi.org in Boštjan Jerko answer is a great reference; for example, section 6.2 describes the various functions that can be assigned to each pin as per joan's answer. To summarize the meaning of the ones indicated on your card:

  • I2C, SDA & SCL: In the Broadcom datasheet these are only mentioned directly in that section 6.2 table, but they are for an I2C bus, which is discussed in the section on the BSC (Broadcom serial controller). The 'DA' in SDA stands for data, the 'CL' in SCL stands for clock; the S stands for serial. You can do more reading about the significance of the clock line for various types of computer bus, but you do not have to understand it on that level to use it -- as joan says, there are programming libraries that abstract that away. You will probably find I2C devices that come with their own userspace drivers and the linux kernel includes some as well. Most computers have an I2C bus, presumably for some of the purposes listed by wikipedia, such as interfacing with the RTC (real time clock) and configuring memory. However, it is not exposed, meaning you can't attach anything else to it, and there are a lot of interesting things that could be attached -- pretty much any kind of common sensor (barometers, accelerometers, gyroscopes, luminometers, etc.) as well as output devices and displays. You can buy a USB to I2C adapter for a normal computer, but they cost a few hundred dollars. You can attach multiple devices to the exposed bus on the pi.

  • UART, TXD & RXD: This is a traditional serial line; for decades most computers have had a port for this and a port for parallel.1 Some pi oriented OS distros such as Raspbian by default boot with this serial line active as a console, and you can plug the other end into another computer and use some appropriate software to communicate with it. Note this interface does not have a clock line; the two pins may be used for full duplex communication (simultaneous transmit and receive).

  • PCM, CLK/DIN/DOUT/FS: PCM is is how uncompressed digital audio is encoded. The data stream is serial, but interpreting this correctly is best done with a separate clock line (more lowest level stuff).

  • SPI, MOSI/MISO/CE0/CE1: SPI is a serial bus protocol serving many of the same purposes as I2C, but because there are more wires, it can operate in full duplex which makes it faster and more flexible.


1. The pi actually does not have any particular style of parallel bus exposed, but presumably you could implement one with the some of the pins.

  • a usb i2c interface costs a couple hundred dollars? woah – ACarter Aug 1 '17 at 10:11
4

Not all the gpios are usable in the same way.

A gpio may be configured to be in one of eight different modes named

INPUT, OUTPUT, ALT0, ALT1, ALT2, ALT3, ALT4, and ALT5.

They can all be used in INPUT and OUTPUT modes.

The use of the other modes varies according to the gpio. Some modes may switch one gpio to be a clock and and the same mode may switch a different gpio to be a UART RXD line.

This is probably irrelevant to 99% of users. They'll use a library to manipulate the gpios and the library will set the needed mode.

See BCM2835 ARM Peripherals page 102 for the gpio modes and meanings (only gpios 2-27 are relevant on recent Pis).

2

Each of the pins have their own special purpose. All of them cannot be used for input and output. You may refer to makezine's tutorial to learn more about GPIOs. To learn the special functions of individual pins you may visit this website.

1

The pin data you get on the reference card refers to the micro controller used on the board. Found a good document explaining the pins.

In short: you can use pins to communicate with outside world. For example SPI means Serial Peripheral bus Interface, I2C is another protocol...

1

It should be noted that the Broadcom controller numbers pins differently than the Raspberry Pi does. Don't get confused when referencing the above link and then looking at the quick reference card from CanaKit.

CanaKit does a great job with their kits, I have several.

FWIW, the UART pins are for serial communication and I have used them a lot.

This site has a LOT of information on the Pi hardware

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.