Raspberry Pi serial interfacing

2nd Friday, 2012  |  Engineering News, Life at LAVA  |  no comments

The Raspberry Pi, the single-board computer that has been causing so much excitement lately, has actually got two serial ports. One is a “mini-uart” with interfacing built into the Raspberry Pi’s GPIO (General Purpose Input-Output) interface.

The GPIO interface is a pin header, and the relevant serial port pins are as shown:

Raspberry Pi mini UART GPIO pins

Raspberry Pi mini UART GPIO pins

 

The Raspberry Pi Quick Start Guide from element 14 describes the process in simple terms:

Serial connection
The Serial Port is a simple and uncomplicated method to connect to the Raspberry Pi. The communication depends on byte wise data transmission, is easy to setup and is generally available even before boot time.

First interaction with the board
Connect the serial cable to the COM port in the Raspberry Pi, and connect the other end to the COM port or USB Serial Adapter in the computer.

Serial Parameters

The following parameters are needed to connect to the Raspberry. All parameters except Port_Name and Speed are default values and may not need to be set.
Port_Name: Linux automatically assigns different names for different types of serial connectors. Choose your option:
Standard Serial Port: ttyS0 … ttySn
USB Serial Port Adapter: ttyUSB0 … ttyUSBn
Speed: 115200
Bits: 8
Parity: None
Stop Bits: 1
Flow Control: None

The Serial Port is generally usable by the users in the group dialout. To add oneself to the group dialout the the following command needs to be executed with root privileges:
$useradd -G {dialout} your_name

The implementation of the serial port on the Raspberry Pi GPIO is not a full implementation; it has only the pins available on the pin header, for example (GND, TX, RX).

The second UART is a more fully implemented UART that is part of the internal ARM architecture of the Broadcom BCM2835 chip, the core of the Raspberry Pi. Details on this UART will be forthcoming in another blog post.