A Serial Console is a useful tool for embedded development, remote access, and those times when the development kit has issues that you need to sneak around to observe. Here’s a simple approach for adding a serial console.
Looky here:
Serial Console Background
The story of serial data transfer over wires goes back almost a hundred years. I’ve heard stories that Ferdinand Magellan first discovered a serial cable on his journeys, but lost it to a tangle in the battle of Mactan in 1521. Apparently it was later rediscovered in America where teletypewriters used serial communication technology over telegraph wires, the first patents around stop/start method of synchronization over wires being granted around 1916.
Serial communication in the computer industry is ubiquitous, in this case we are going to connect an Ubuntu PC up to the Jetson TX1 Development Kit through UART 1 on the GPIO headers. UART 1 is the serial console on the Jetson TX1 which allows direct access to the serial and debug console. Quite a handy thing to have when the going gets hardcore.
Installation
Because the Jetson communicates over a basic serial cable, almost any computer with serial terminal software can communicate with the Jetson. There are a wide range and variety of software terminal emulators out there, for this particular case the program Minicom was chosen. Other platforms and software programs can be used including Windows and Macintosh boxen.
One of the nice things about the Jetson TX1 is that it uses 2.54mm headers, which make interfacing easy with the Raspberry Pi and Arduino ecosystems. In this video, we use an Adafruit USB to TTL Serial Cable – Debug / Console Cable for Raspberry Pi. It’s also available from Amazon.
There are a wide variety of offerings for these types of cable. The products fall in two camps. The first camp uses FTDI chips for TTL to USB conversion, the second camp uses PL2303HX chips. The Adafruit cable is in the latter camp. One thing to keep in mind is that a driver for the appropriate chip may be required for the cable to work correctly with your particular operating system. The driver for the PL2303HX was already installed on the machine being used in the demonstration.
Wiring
Here are the signals for the J21 header: Jetson TX1 J21 Header Pinout Note: There is a small white triangle pointing to Pin 1 of the J21 Header on the Jetson TX1 carrier board.
The wiring is straightforward. Make sure that the Jetson is off and wire:
Jetson TX1 J21 Pin 8 (UART 1 TXD) -> Cable RXD (White Wire)
Jetson TX1 J21 Pin 10 (UART 1 RXD) -> Cable TXD (Green Wire)
Jetson TX1 J21 Pin 9 (GND) -> Cable GND (Black Wire)
Then plug the USB connector into the host machine.
Here’s what it should look like:
Software
Once the Jetson is wired and connected, check to make sure that you can see it.
$ lsusb
Should list the device, the name is dependent on the chip being used by the USB-TTL cable. In the video, the device was listed as a PL2303 Serial Port.
You will then need to find the USB port to which the device is mapped.
$ ls /dev/ttyUSB*
This will list out the USB ports. On the machine in the video, there is only one device. Other machines may have more, you’ll have to figure out which is which. In this case, remember /dev/ttyUSB0 is the device to be later entered into the terminal emulator later.
You are then ready to install Minicom:
$ sudo apt-get install minicom
To start Minicom:
$ sudo minicom
The ‘sudo’ is used because of the serial port permissions. You’re then ready to configure the Settings to communicate with the Jetson TX1.
Settings
An important part of serial communication is settings that are used to communicate between the devices. Rather than go through a lengthy discussion of each setting and it’s meaning, let’s distill it into the settings themselves.
First set the device, in the video the device was ‘/dev/ttyUSB0‘.
Connection speed is 115200, with 8 bits, no parity, and 1 stop bit (115200 8N1). For these three wire cables, the correct setting is software control, no hardware control. If you choose a 5 wire setup with RTS and CTS lines, then select hardware control, and no software control.
In Minicom, Ctrl A Z brings up the main menu. Select the ‘cOnfigure Minicom’ menu item, enter the settings, and make sure that you save the configuration as described in the video. After that task is complete, exit Minicom and restart to have the settings take effect.
$ sudo minicom
You may then start the Jetson, at which point you will see the kernel log starting to scroll on the Minicom window on the host.
There are a wide variety of ways to interact with the Jetson through the serial console, one of the more useful tips is to interrupt the startup process with a keystroke to be able to interact with Uboot.
Warning
I did notice that on this installation if the serial cable is hooked up to the Jetson but is not plugged into the PC, then the display connected to the Jetson remains dark. I could not tell if the machine booted or not. Connecting the cable to the PC, or removing the cable from the Jetson solved that issue.
More Information
There’s a good tutorial on the Jetson TX1 wiki labeled Serial Console Wiring. This is a useful tutorial if you plan on making a dedicated cable attached to a header, which is useful for dedicated development.
Conclusion
For the most part, there are two sets of developers who use the serial console. The first set is the casual users, people who only need access through the serial port occasionally. Hopefully this article helps, connect a couple of wires and be done with it. For the more hardcore developers, they will probably build their own cable with connector for a reliable connection.
6 Responses
It didn’t boot most likely. There is a blurb in the documentation that you might need to ground pin 8 during boot up or it can cause it to fail. I managed to free up uart1 for another use but if anything is connected booting is iffy. I think for it to be reliable you would have to use a relay to ground it until the machine is up. So I gave up on using that one and have a 4 port pcie card now. Actually I like the 4 port card better. Its full power rs232 so I don’t need to bother with level shifters. Found out about this when I was testing to see if I’d configured the kernel correctly. All of a sudden my TX1 wouldn’t boot. Wasn’t until I’d taken it out of the enclosure and removed all the wiring that it started booting again no problem.
Hi,
Thanks for the awesome post. Everything is working for me except that after the TX1 boots it keeps spamming the serial port with “need at least a destination address”. Anyone ever seen anything like that before?
Nick,
For me killing the /home/ubuntu/report_ip_to_host.sh script stopped the spamming. I think it also fixes the “RTNETLINK answers: Network is unreachable” spam I get on the first power on before setting up a network.
I managed to break the kernel. I made a backup of the functioning kernel in /boot just called Image2 but is there a way to invoke it from U-boot? Or did I need to set up an additional record in the bootconf file? Maybe I could boot from USB, mount it and then change the Image file back to the good one.
Hi Jan,
That’s what I usually do, have a known good configuration in the config file that I can boot from from the serial console just in case. If you have a SD card boot disk, you can go in and switch it. For other variations like booting from USB, it depends on how badly the kernel is mangled as to whether it works or not. You can always ask in the Jetson TX1 forum: https://devtalk.nvidia.com/default/board/164/jetson-tx1/ where a wider group of developers may have some good advice and tips.