
Viewing output from devices connected via a serial port is a fundamental task when debugging embedded systems, microcontrollers, or other hardware. While many terminal programs exist, a simple and effective tool for this purpose is yeTTY. This guide walks you through using it to capture and review that vital data stream.
Understanding Serial Communication
Devices communicate serially by sending data bit by bit over a single line. This is common for diagnostics and simple data transfer because it requires minimal hardware. To see this data on your computer, you need a way to listen to that port. Often, this involves a USB-to-serial adapter or built-in serial ports on older machines.
Getting Started with yeTTY
yeTTY is a lightweight, command-line utility designed specifically for this task. It’s available for Linux and macOS. Depending on your distribution, you might need to install it via your package manager (e.g., sudo apt install yetty
on Debian/Ubuntu, or perhaps available through Homebrew on macOS). Once installed, it’s ready to use directly from your terminal.
Identifying Your Serial Port
Before connecting, you need to know which port your device is connected to. On Linux and macOS, serial ports are typically represented as files in the /dev/
directory.
- USB-to-serial adapters often show up as
/dev/ttyUSB0
,/dev/ttyUSB1
, etc. - Built-in or other types might appear as
/dev/ttyS0
,/dev/ttyACM0
, etc.
You can often figure out the correct port by connecting your device and then checking recent kernel messages using the dmesg
command (e.g., dmesg | tail
) or listing devices in /dev
before and after connecting (e.g., ls /dev/tty*
). Identifying the correct port is a crucial first step.
Connecting and Viewing Data
Once you know the port, connecting with yeTTY is straightforward. You need to specify the port path and the communication baud rate. The baud rate is the speed of communication (bits per second) and must match the setting on the device you are connecting to. Common baud rates include 9600, 115200, etc.
The basic command format is:
yetty <port_path> <baud_rate>
For example, if your device is on /dev/ttyUSB0
and uses a baud rate of 115200, you would run:
yetty /dev/ttyUSB0 115200
After running the command, yeTTY will open the specified port and begin displaying any data received directly in your terminal window. You will see the output from your device in real-time.
Logging Output to a File
Often, you don’t just want to view the output, but save it for later analysis. You can easily log the serial data to a file using standard shell redirection:
yetty /dev/ttyUSB0 115200 > serial_log.txt
This command does the same thing as before but redirects all the data that would normally print to your screen into a file named serial_log.txt
. You can then open this file with any text editor to review the complete serial port logs.
Disconnecting
To stop yeTTY and close the serial connection, simply press Ctrl+C in the terminal where yeTTY is running.
Troubleshooting
If you don’t see any output:
- Check the baud rate: This is the most common issue. Ensure the rate matches your device’s configuration exactly.
- Verify the port path: Make sure you’ve selected the correct
/dev/
entry for your device. - Permissions: On Linux, you might need appropriate permissions to access serial ports (often achieved by being in groups like
dialout
oruucp
). Running withsudo
might temporarily fix this, but adding your user to the group is a better permanent solution. - Check connections: Ensure your cables are secure and the device is powered on and transmitting data.
Using yeTTY provides a clean, no-frills way to interact with and capture data from serial devices, making it an invaluable tool for development and debugging.
Source: https://www.linuxlinks.com/yetty-view-logs-serial-ports/