Adding a serial console to the Raspberry Pi
By speakjava on May 29, 2012
I finally found some more time to do some more on the Raspberry Pi. As part of a much bigger project I'm working on for this it looked like I'd need to rebuild the kernel to include and modify some drivers (which will take me way, way back into my past doing UNIX development at AT&T). Knowing the way these things go I decided to prepare for the worst, i.e. a kernel that fails to boot properly. To get as much information as possible it's always good to be able to see the boot messages direct and, after a bit of searching, I found that the kernel boot messages are all output to the serial port on the Raspberry Pi.
Serial ports can be a bit misunderstood since some people tend to use RS-232 and serial communication interchangeably which can lead to some serious disappointment (and cost). RS-232 uses 12V whereas the UART (Universal Asynchronous Receive and Transmit) which generates the bits is either a 3.3V or 5V device (depending on the board design). To have the UART on the Pi communicate with the serial port on my PC I would need a conversion circuit. I've used this before when I did a demo using the WowWee RoboSapien where I had a Sun SPOT connected to the console of the robot via a serial connection. The necessary circuit is shown below:
Note that the 9-pin D-type connector is shown from the front, so you need to remember that when soldering the wires on.
The connections to the Raspberry Pi are made on the GPIO expansion header. A diagram showing which pins are which can be found here.
Having tested the configuration on a breadboard (always a good idea) I made a small veroboard implementation. The final result is shown here:
To communicate I use good old PuTTY. The necessary settings are:
- Speed: 115200 baud
- Data bits: 8
- Stop bits: 1
- Parity: None
- Flow control: None
Using this I can now see all of the boot messages (and won't lose them if the video were to stop for whatever reason) and I can login over this connection as an alternative to SSH.