I’ve just brought a USB to TTL Serial Console Cable for my Raspberry Pi and I’m very pleased with it.
Since I was already using GPIO pins 2 and 6 to provide power for a MCP23017 I/O expander and SAA1064 display driver the first problem was where to connect it. After (very carefully) checking the Model B schematics I decided to connect the serial cable power supply to pins 4 and 6 (instead of pins 2 and 6 as shown above) and move my existing ground connection to the peripheral circuit board from pin 6 to pin 25.
I didn’t expect that my rather old laptop would be capable of providing enough current to power the Raspberry Pi without the mains adapter – so I was pleasantly surprised to find that not only could I run my Raspberry Pi from the USB port but the I/O expander and display driver as well !
The Raspberry Pi was already configured to use a serial console, using a default speed of 115200 baud. Unfortunately the default baud rate of the USB serial interface on my laptop was 9600 baud and I didn’t seem to be able to change it so I updated /etc/inittab and /boot/cmdline.txt as shown below to change the baud rate to 9600.
# vi /boot/cmdline.txt ... console=ttyAMA0,9600 kgdboc=ttyAMA0,9600 console=tty1 ...
# vi /etc/inittab # Example how to put a getty on a serial line (for a terminal) # T0:23:respawn:/sbin/getty -L ttyAMA0 9600 linux #T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100 #T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100
Note that the terminal type should correspond to the type of terminal device you are using, so because I'm connecting from a terminal window on another linux machine I've selected linux.
When you plug-in the USB cable to the host the Raspberry Pi starts to boot straight away, so I added a few seconds delay to the boot process to give me time to connect from a terminal window.
# vi /boot/config.txt boot_delay=3 arm_freq=900 core_freq=350 sdram_freq=500 temp_limit=65 boot_delay=1 gpu_mem=64 disable_overscan=1 hdmi_force_hotplug=1
You need to reboot for these changes to take effect.
I'm planning of writing a short script that waits for the USB serial device to become available before connecting, so I can start the script before I plug the USB adapter in and don't keep missing the initial output but that will have to wait for another day.
Update: I've posted details of the script here.
Raspberry Pi is a trademark of the Raspberry Pi Foundation