Serial debug setup on BeagleBone Black
Last week I got a shiny new BeagleBone Black (BBB) delivered at my doorstep. Now that I had it lying on my study table, needed to figure out a way to talk to it over the serial port. In this post, I am going to show three different software based ways to communicate with your BBB (or other embedded devices, so long as those support serial communication) from your PC running some variant of Linux. Things you will need -
- A BeagleBone Black.
- PL2303, CP2102 or FTDI module to connect your BBB to your PC’s USB port. I am using a CP2102 module purchased from Amazon for this exercise.
- Download cables (usually comes with the serial-usb adapter) for Xfering bits from the board to your PC.
- Laptop/desktop running on some Linux distro. I have Ubuntu 18.04 LTS on my setup.
- A reliable Internet connection (needed for installing the s/w tools).
- [Optional] An USB hub, if you are planning on working with multiple serial-usb adapters.
Now, let’s get the hardware configuration out of the way first before we delve into software realm. Below table explains interconnection between BBB and the CP2102 serial-usb adapter.
Sr No | BBB Pin Configuration | CP2102 Module |
---|---|---|
1 | GND (Pin 1) | GND (module specific) |
2 | RX (Pin 4) | TXD (module specific) |
3 | TX (Pin 5) | RXD (module specific) |
Just remember to connect the TX of BBB to RX of the serial-usb adapter and vice versa. That’s all!
With the BBB powered down, connect the serial-usb adapter to your PC (or USB hub connected to your PC) and power it up. Time to talk to the BBB via serial-usb adapter!
Method 1: Using Minicom (most common)
Install minicom by running command sudo apt install minicom
. Platform specific instructions on installation may vary though; I shall leave that for you guys to figure out.
Upon installation, launch minicom
from the terminal. You may have to do so as root
. Now, it’s time to change the default configuration to shown as below -
In particular, I had to explicitly turn off Hardware Flow Control
because keyboard inputs were not being recognized. Software Flow Control
was turned off by default; so, guess that probably was not the issue.
With the aforementioned set of changes, I was able to get BBB configured to communicate over serial port. Voila!
Method 2: Using Picocom
Since I was not able to get keyboard inputs recognized on Minicom initially, I started looking for suitable alternatives. That is how I stumbled on Picocom. Instructions for installing Picocom is pretty similar to that of Minicom, just use apt
(or your platform specific package management utility) to get it installed. Once the installation is complete, run the command -
sudo picocom -b 115200 -r -l /dev/ttyUSB0
Notice that we are passing the configuration options as command line parameters here. And this is how the Picocom console should look like -
Unlike minicom though, I didn’t have to specifically tweak configurations to get it to work which is nice! Further details on picocom
can be found in the man pages
.
Method 3: Using Gtkterm
To install gtkterm
, simply run the command sudo apt install gtkterm
on your terminal.
For installing it on other platforms, please refer to platform specific documentation. Once installed, you may need to launch it as root
and configure it to select port as /dev/ttyUSB0
, baud rate as 115200
and flow control as none
. And there you have it!
And here is the Gtkterm console as shown above. You can interact with your embedded board through console now that you have necessary configurations taken care of. Kudos!
And that’s it! You have some high level pointers on how to debug your embedded device over serial port. For now I am sticking with minicom
since I am more familiar with its configuration options. But it may change in the near future depending on the platform needs and other restrictions. If you have any questions/tips/suggestions, please feel free to drop me a line.
Credits
[1] Beagleboard: BeagleBone Black Serial
[2] How to Connect the BeagleBone Black via Serial over USB
[3] AskUbuntu: Minicom doesn’t work