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 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 TX2 Development Kit through UART 1 on the TX2 J21 GPIO header. UART 1 is the serial console on the Jetson TX2 which allows direct access to the serial and debug console. Quite a handy thing to have when the going gets hardcore.
Note: Because the Jetson TX1 and the Jetson TX2 use the same carrier board, the procedure is the same for both devices. There is a nearly identical version of this post for the TX1, basically because we could not afford any new jokes for this article.
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 TX2 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.
Here are the signals for the J21 header: Jetson TX2 J21 Header Pinout Note: There is a small white triangle pointing to Pin 1 of the J21 Header on the Jetson TX2 carrier board.
The wiring is straightforward. Make sure that the Jetson is off and wire:
Jetson TX2 J21 Pin 8 (UART 1 TXD) → Cable RXD (White Wire)
Jetson TX2 J21 Pin 10 (UART 1 RXD) → Cable TXD (Green Wire)
Jetson TX2 J21 Pin 9 (GND) → Cable GND (Black Wire)
Then plug the USB connector into the host machine.
Here’s what it should look like:
Once the Jetson is wired and connected, check to make sure that you can see it.
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 TX2.
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.
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.
The carrier board of the Jetson TX1 and Jetson TX2 are the same. You can take advantage of a good tutorial on the Jetson TX1 wiki labeled Serial Console Wiring. This is a useful tutorial if you plan on build your own cable attached to a header, which is useful for dedicated development.
For the most part, there are two sets of developers who use the serial console. The first set is the casual user, 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.