BeagleBone Black Serial Debug Connection

Connector 5 - Connected

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.

Hardware

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).

Connector 1 - USB to UART Adapter

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!

Serial Connection

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.

Connector 2 - BeagleBone Debug Header

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!

Connector 3 - Jumper Wire Pins 1

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.

Connector 4 - Jumper Wire Pins 2

When ready, you can connect the adapter to your PC.

Driver Installation

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.

Driver 1 - Unknown Device

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.

Driver 2 - Install Driver

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.

Driver 3 - Installed Successfully

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.

Driver 4 - COM Port Number Visible

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:

Driver 5 - Port Settings

Click OK to save the settings and close Device Manager.

Terminal Connection

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:

Terminal 1 - PuTTY Connect

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”.

Terminal 2 - PuTTY Connect Serial Settings

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.

Terminal 2 - Open Then Power On BeagleBone

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.

Terminal 3 - Booted To Logon Prompt

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.

Conclusion

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.

13 thoughts on “BeagleBone Black Serial Debug Connection”

  1. Hello ,

    First of all , Thank you very much for such a nice article.

    Description – Actually i am using Beaglebone Black and i want to enable
    minicom support to see bootup msg for linux booting.

    Point to verify – check whether step 3 is correct or need some modification.
    -> Tx -Tx i need to connect or TX – Rx.

    Steps I followed :

    1) For building kernel & ROOTFS i used the steps given in
    http://wiki.beyondlogic.org/index.php/BeagleBoneBlack_Building_Kernel

    2) I placed it in the hierarchy given below –
    Boot partition – MLO, uboot-img, bbb uimage
    Rootfs partition – rootfs

    3)QUERY:
    I purchased FTDI to TTL cable with 3.3V version and
    connected in the following fashion –

    J1 —— BLACK ( GND )
    J4 —— Yellow ( Rx )
    J5 —— Orange ( Tx )

    4) Then i pressed power switch button to boot from sd-card but
    no message is getting displayed on minicom.
    Thanks –
    Ankit

    1. Step 3 is correct, as stated there “Do not swap/cross-over RX-TX and TX-RX between the adapter and board because it handles this itself” and also the cable colours will be totally different depending on who you bought your cable from. Look for the descriptions of each wire which may be on the board when visible else must be documented somewhere on the manufacturer’s web site.

      If the status lights of the BBB are solid at power-on the image is bad (only good time they are solid is after successfully flashing the eMMC, after about 15 minutes not immediately). Be careful when creating your own bootable media that the correct file is copied first. The boot file must occupy the first location on the disk. You can also change it when overwriting. So a re-format and one-by-one copy in the correct order may be necessary.

      Assuming the BBB is not bricked completely, first try to achieve a working baseline by taking a known easy way to get some successful boot. Such as taking the official BBB eMMC flasher image and putting it on a <=16GB SD card (larger can cause problems on the PC side depending on what adapter you used) and using Win32DiskImager to write it correctly. Hold down the difficult boot button too before and up to 5 seconds after re-connecting the power.

      If you really get no activity at all and have done everything correct, the BBB may be bricked. Only a JTAG could tell you more but that's beyond me currently and more effort than trying to send it in for replacement/buy a new one.

    1. I think I know what you mean. The serial data will be messed up if you have any issue with difference between the speed/baud and handshake settings. Double-check your port-settings in the PC serial console and if Windows also in the operating system. I had a similar problem on a router (see my blog post about de-bricking a buffalo router with an Arduino) when the ground cable was not properly connected.

      The quality of the signal has nothing to do with the Linux kernel/build. Because it’s sent from the firmware, really low level. You should see messages even before the system starts booting. One other issue I remember is that the BeagleBone will just output junk when the onbord eMMC has a corrupt image. Then you would need to fully refresh it by holding the BOOT microswitch down with a eMMC flasher image in the SD card slot.

      1. I tried every method that you recommond. Finally I find the problem,It’s because of the serial
        port I am using is USB2RS232. They have different electrical level. Sorry for troubling you.
        You really help a lot for the next step.

  2. Hi,
    There are couple of question:
    1.) TTL USB 6 pin- to connect to the beagle board it can be connected as TX(ttl)-TX(beagle) and RX-RX.

    2.) New beagle bone does not come with SD card? Is this SD card is neccessary to boot from eMMC memory? Is there a way that we can boot from eMMc(NAND) memory?

    Please correct me if my understanding is wrong.
    Thanks
    Niraj

    1. 1) Yes as it says in the post “Do not swap/cross-over RX-TX and TX-RX between the adapter and board because it handles this itself”.
      2) All the current BeagleBone variants have SD cards but you don’t need one to boot. That’s why there’s an eMMC, to make it easier (and cheaper) to get started. You can also boot from USB and update the eMMC if it fits. As soon as you have more data than fits onto the eMMC you have to boot from SD or USB.
      This article was written for the latest (currently generally available) BeagleBone Black. If you’re using another BB then you need to double-check the wiring pins in their documentation/Wiki.

  3. Hi,
    I am using beagle bone black the one shown in your article.

    My setup:

    window 7 (USBX0)—–>Beagle bone black TTL
    Window 7(USBX1)—–>Beagle bone black power supply.

    My steps:
    I connect as follows:
    1.) window 7 (USBX0)—–>Beagle bone black TTL (adds COMXXX)
    2.) Connect the teraterm to capture log on newly added com port COMXXX parameters are
    serial port: “bits=8″, “parity=none”, “stop bits=1″ and “handshake=none”.
    Baudrates:115200
    3.) Window 7(USBX1)—–>Beagle bone black power supply.(COMYYY)

    I should get serial logs from UBOOT by now but I am not getting log here.
    I am getting logs at COMYYY that to only kernel logs.

    I should get the UBOOT log but I am not getting, please help me identify the issue.
    I am using the UBOOT and kernel(angstrom version) which came along with the board.

    Warm Regards,
    Nkumar

  4. I just got a BB black and CP2102. Installed the drivers as mentioned above and Windows 8.1 detected the virtual COM port. I am using Teraterm. After connecting, no messages on serial console. I tried multiple reboots and restart Windows etc, but no luck. Then I swapped the Rx and Tx and lo.. console messages were visible. So I guess, this behavior depends on the CP2102 you have.

  5. Thanks for the article with nice pictures.

    Re: “Do not swap/cross-over RX-TX and TX-RX between the adapter and board”. I am using a cheap TTL adapter and to make it work I had to swap/cross over the TX-RX pins. That is, hooking it up like your picture (with TX-TX and RX-RX) did not work for me, I had to cross them.

    Having worked on many different hardware boards, I have always had to cross them over and I find it strange that you recommend against it.

  6. In the above tutorial everything is mentioned correctly but following those steps especially the step where it’s been said that “DON’T SWAP TX-RX & RX-TX , THE BOARD WILL HANDLE IT ITSELF” is not correct in every case . Recently i buyed a BBB and CP2102 chipset USB-TTL 3V3 adapter , installed the driver on LINUX(UBUNTU 13.10) system ,used both PUTTY & MINICOM but going through this tutorial get me into a huge tension ,
    I also tried with PL2303 & FT232RL adapter also but nothing was being displayed on my screen but when i cross-connected TX-RX and RX-TX (WHICH IS THE NORMAL CONNECTION)it worked.

  7. Thank you Very much for the Tutorial. Was able to Connect . I had Debian but I had to alternate TX and RX! may be issue with my Serial to USB!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s