The BeagleBone Black has a built-in debug header allowing you to connect via a serial terminal emulator. Not only does it allow you to view low-level firmware pre-boot and post-shutdown/reboot messages, but it also acts as a fully interactive Linux console once the operating system has started. This post demonstrates with pictures and software links how to quickly setup such a connection.
First of all you need a TTL-UART serial adapter/cable to connect the device to your PC, where you’ll run a serial terminal emulator program to view messages and enter commands. There are many available so make sure you get the right type. For debugging hardware we need an old fashioned “TTL” style chipset, which is not the same as a more modern RS232 serial adapter! They have up to six cables but only three will be used, GND (Ground) RXD (Receive Data) and TXD (Transmit Data).
Also they come in different voltages, 5v or 3.3v and with varying cable to pin mapping. Basically you need an adapter with a USB port and serial pins/cable with a small chip inside to do the conversion. The TTL standard compatible adapters are commonly based on the CP210x (e.g. CP2101 or newer CP2102) or a popular chipset known as “FTDI” made by “Future Technology Devices International”. If like me you wish to buy an adapter to use with other devices, then you’ll also want to find one with jumper wires at the end rather than a fixed connector. This allows you to easily re-map the pins from the adapter to your device as required.
The device I have was a cheap CP2102 mini adapter with jumper wires included. In addition I purchased a USB extension cable to make it easier to work with. It has seven pins, the extra pin is a choice between a 5v or 3.3v supply. But in this case we don’t need power, just ground. So you can ignore (or disconnect) cables from all pins of the adapter shown in the photo other than GND, RXD and TXD. By the way if we did need power it’s important to mention again that these small devices often need the lower powered 3.3v connectors not 5v. Accidentally connecting the higher voltage pin to a lower powered device would most likely damage it. So be careful and double-check all wiring, board and adapter documentation before powering on or connecting the USB cable!
First of all locate the debug header pins on the BeagleBone Black. They’re on the right side (looking towards the Ethernet port) the middle just inside of the long cape connector on that side. You can see this near the top of the photo below, the six pins sticking up with the upside-down letters “J1” below the first pin.
Take note of where J1 is located, the other pins are J2, J3, J4, J5 and J6 going from right to left on the photo above. As documented in the BeagleBone Black Serial support wiki, the pins numbers we need to connect are as follows:
- J1 = GND (Ground)
- J4 = RXD (Receive Data)
- J5 = TXD (Transmit Data)
Shutdown and disconnect all power (DC and USB) from the BeagleBone Black before starting to connect the wires!
Depending on your USB to Serial adapter, you may or may not have to cross-over the RX and TX connections. The original wiki documentation from BeagleBone suggests it is not necessary because the board handles this itself, which worked for me. Also you should ignore the cable colours mentioned in the Wiki because it is likely that your specific adapter/cable bundle is different.
When ready, you can connect the adapter to your PC.
If you are lucky your version of Windows or other operating system will already have detected a USB Serial Port device and configured it. However in my case on 64bit Windows 8.1 it was not detected. To check open “Device Manager”. Unknown hardware will usually be listed under “Other devices”, successfully installed devices will be under “Ports (COM & LPT)”. To open Device Manager on Windows 8.1 right click the desktop start button then choose the “Device Manager” menu option, or on Windows 7 and earlier versions look for advanced hardware settings in the Control Panel.
This can be a pain sometimes because these cheap OEM devices commonly have no drivers or support web site. However by searching the web for “CP2102 Windows Drivers” I came across the Silicon Labs CP210x USB to UART Bridge VCP Drivers page with signed drivers for all major operating systems and processors. This download came not only with the signed drivers but a convenient installation executable.
By the way if you didn’t have an installer you would have to right click the device in Device Manager, choose upgrade then browse for the “.inf” file in the downloaded driver directory.
Luckily this driver worked perfectly with my device. Maybe it is from Silicon Labs, maybe it’s a copy. Anyway it works 🙂 Open Device Manager again to check the device is now recognized and working. When it is running you’ll see the communications (COM) port number next to it in brackets. Make a note of this number as you’ll need it later when connecting with a terminal program, e.g. mine is COM4 as shown below.
Now we have to check the settings to make sure they are compatible. Open the properties of the device and edit the port settings so that the speed is 115200 baud, with 8 data bits, no parity, 1 stop bit and no flow control:
Click OK to save the settings and close Device Manager.
Now we have all the hardware connected and drivers installed, we just need to run any serial capable terminal program to get access to the debug console of the BeagleBone Black. There are many available but I chose one of the most popular free programs called PuTTY. The latest version can be downloaded here. Just download and run PUTTY.EXE.
In the start-up “Session” category, choose the “Serial” connection type (not the default SSH or Telnet) then enter the communications port number and set the speed to 115200:
Click the “Connection-Serial” category then check the settings are the same as the serial port: “bits=8”, “parity=none”, “stop bits=1” and “handshake=none”.
Finally click “Open” to launch the terminal window. You are now ready and waiting for data on the serial cable! Power-on the BeagleBone Black to see the first console messages appear during BIOS/firmware start-up, or hit ENTER if it is already running to see a command prompt response.
The operating system (in my case the default Angstrom distribution booting off the eMMC) will continue to load until the usual Linux terminal login prompt appears.
You’re now connected to a debug console via serial cable, without any network, SSH server or USB cable required! You can continue to logon and enter console commands or just leave it running to see firmware debug messages as they are generated.
The serial connector of the BeagleBone Black is fairly straightforward to connect with a generic TTL-UART adapter, or easy if you find the right hard-wired connector. Although you may not normally need it (with the default SSH/network management capability already available via USB) it’s certainly useful to know how to connect it and have the cable ready in case you do need it.
It can also be used to correct HDMI settings in case your monitor is not compatible with the standard EDID data detection mechanism, to diagnose the detection phase and tweak the resolutions. It may also be useful in locations where you don’t have or don’t want wired or wireless network connectivity but still wish to monitor or issue commands. In theory it could also be used to transmit small amounts of data.
Many (maybe even most) people with BeagleBone Black devices like to tinker with hardware and settings. If you’re one of those people I’d recommend completing this exercise in case you need it in the future and so you know your toolbox includes the right debug adapter/cable.