Some good references
The physical connection
You’ll be using 3-wire TTL RS-232. You connect ground to ground and RX to TX in both directions. If you have 5v on your serial connector, you could use that to power the Raspberry Pi; but then you must disconnect your USB power supply.
Here’s how it should look if you are using a
FTDI TTL-232R-3V3 USB to serial cable.
Ignore all the green wires and LED’s. They are for
Raspberry Pi GPIO.
The RS-232 connection
Use the following parameters to connect to the Pi.
- Baud: 115200
- Data: 8-bit
- Parity: none
- Stop bits: 1
- Flow control: none
Be sure flow is set correctly. You can’t do hardware flow control using RTS/CTS because the CTS pin is used to turn on an LED near the Raspberry Pi’s SD card.
However, the default for many serial connection programs is software flow control using XOFF/XON. If an XOFF (CTRL+S) is sent, then the transmission is paused until it is resumed with XON (CTRL+Q). This works in both directions and can lead to unexpected hangs.
Just choose no for flow control.
When connecting to a Raspberry Pi there is the additional problem of terminal emulation. While character-based terminals are not video displays, they do have facilities for moving the cursor around the screen, changing the color of characters and their backgrounds, and displaying “graphical” characters. This is done with special escape sequences. The ANSI escape code, popularized on the VT100, is the best known terminal standard.
Terminal emulators are programs which emulate the escape sequences of ancient terminals on windows-based computers. Every modern operating system supports these for times when you want to use the command line. If the terminal emulator and the Rasperry Pi don’t agree on the escape sequence standard, terminal sessions quickly become garbled.
If you connect to a Raspberry Pi with a program, such as CoolTerm, which is not a terminal emulator, the session immediately disintegrates.
What seems to work
Use PuTTY with the following settings.
These are not the same as those used with the XBee, because
the XBee did not echo typed characters.
It’s not hard to use screen.
First, determine the name of the serial device that is connected
to the Pi. It is probably something like
Then connect to it with the following command.
screen /dev/ttyUSBN 115200
Hit Enter a couple of times and hopefully the Pi to give you a login prompt. Use the two-character sequence CTRL+A k to exit from screen.
Mac OS X
This is almost as easy as Linux.
Again, determine the name of the serial device connected
to the Pi. This time it will be longer, probably something like
Then connect using the following command.
screen /dev/tty.usbserialXXX 115200
As soon are log in you must set the
TERM environment variable
so that you won’t get lot of funny characters designed
for drawing boxes.
Again use the two-character sequence CTRL+A k to exit.
It may be necessary to “declare” vt100 terminal emulation when starting the Mac Terminal program. In that case, use the menu choices Terminal ⇒ Preferences... followed with Advanced ⇒ Declare terminal as: where you can then choose vt100 as your terminal.