Data Logging Via A Remote UART Connection

If you've ever had to debug a hard to reproduce issue you know the value of having a UART console attached to your device. Having a dedicated debug UART is a very lightweight way for you to run your device in a realistic test setting while still capturing lots of data that will hopefully allow you to catch your bug. The downside is that you need a desktop or laptop hooked up to your device so that you can capture the serial stream. This can often limit the type of environments you're able to test your device in.

Lager makes it easy to remotely capture serial data from any computer. The Lager Gateway is a small portable device that connects to your Device Under Test (DUT) via any number of interfaces, including UART.  You can also plug in USB-Serial modules, like the TTL-232R from FTDI, into any of the Gateway's USB ports as an alternative to using the Gateway's built-in UART port. To see what serial-ports you have available for connecting to your DUT you can run {% c-line %}lager gateway serial-ports{% c-line-end %}.

{% c-block language="console" %}
% lager gateway serial-ports
/dev/ttyS0 - Lager Gateway serial port
/dev/ttyUSB0 - Future Technology Devices International, Ltd FT232 Serial (UART) IC; serial number FTAJM7JE
{% c-block-end %}

{% c-line %}/dev/ttyS0{% c-line-end %} - Gateway's built-in UART

{% c-line %}/dev/ttyUSB0{% c-line-end %} - Externally plugged in TTL-2232R UART device

Both of the above can be used for communicating with the DUT via UART

Now to start capturing data simply run the below command from your host computer:

{% c-block language="console" %}
% lager uart --serial-device /dev/ttyS0 --baudrate 115200 > data.logs
{% c-block-end %}

This will connect to your default Gateway and start writing serial data to a file called {% c-line %}data.logs{% c-line-end %}.

That's it!

Want to stay up to date on the future of firmware? Join our mailing list.

Section
Chapter
Published