Linux serial port monitor program

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

A Linux serial port application that shows the time between received bytes in milliseconds and nanoseconds.

chipkin/Linux-HighSpeedSerialMonitor

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Linux High Speed Serial Monitor

A Linux serial port application that shows the time between received bytes in milliseconds and nanoseconds.

This tool was orginally designed to test and validate the callback functions for the CAS BACnet MSTP Stack on custom hardware. We have found the tool to be useful for detecting interbyte timeouts in serial protocol communications.

serialMonitor   - The TTY serial port that this application will monitor. Default: /dev/ttyS1 - The baud rate of the TTY serial port. Default: 38400 Examples: serialMonitor /dev/ttyS1 38400 serialMonitor /dev/ttyS2 serialMonitor /dev/ttyS3 9600

Below is an example output from the serialMonitor application

./serialMonitor /dev/ttyS5 38400 FYI: High speed serail monitor. Version: 0.0.0.1 FYI: Connecting to serial port. SerialPort=/dev/ttyS5, BaudRate=38400 FYI: Connected to serial port | Time (ms) | CHAR | HEX | * ---------- * -------- * -------- * | 3172.003 | 0 | 00 | | 0.489 | a | 0a | | 10.226 | b | 0b | | 10.379 | c | 0c | | 10.926 | d | 0d | | 20.361 | e | 0e | | 30.979 | f | 0f | | 41.015 | g | 0g | | 50.169 | h | 0h |

A included makefile can be built with GCC

Читайте также:  Linux наследование прав при копировании

This project also auto built using Gitlab CI on every commit.

A compiled version of the serial monitor is included in this repo. serialMonitor

  • 0.0.2 Added CI build number. Updated make file to include «all», and «Clean» steps. Added Gitlab CI auto builds.
  • 0.0.1 Initial version

About

A Linux serial port application that shows the time between received bytes in milliseconds and nanoseconds.

Источник

How can I monitor data on a serial port in Linux?

I’m debugging communications with a serial device, and I need to see all the data flowing both directions. It seems like this should be easy on Linux, where the serial port is represented by a file. Is there some way that I can do a sort of «bi-directional tee», where I tell my program to connect to a pipe that copies the data to a file and also shuffles it to/from the actual serial port device? I think I might even know how to write such a beast, but it seems non-trivial, especially to get all of the ioctls passed through for port configuration, etc. Has anyone already built such a thing? It seems too useful (for people debugging serial device drivers) not to exist already.

This might be of interest to those that struggled with the given answer: unix.stackexchange.com/questions/12359/…

5 Answers 5

strace is very useful for this. You have a visualisation of all ioctl calls, with the corresponding structure decoded. The following options seems particularly useful in your case:

-e read=set

Perform a full hexadecimal and ASCII dump of all the data read from file descriptors listed in the specified set. For example, to see all input activity on file descriptors 3 and 5 use -e read=3,5. Note that this is independent from the normal tracing of the read(2) system call which is controlled by the option -e trace=read.

-e write=set

Perform a full hexadecimal and ASCII dump of all the data written to file descriptors listed in the specified set. For example, to see all output activity on file descriptors 3 and 5 use -e write=3,5. Note that this is independent from the normal tracing of the write(2) system call which is controlled by the option -e trace=write.

Источник

Serial Port Monitor (Sniffer)

Serial Port Monitor (Sniffer)

Monitoring serial communications is often the only way of troubleshooting connection issues or reverse-engineering a custom protocol. The Serial Monitor plugin lets you monitor and inspect all the serial port activity initiated by other applications, including opens/closes, serial settings changes, control line changes ( CTS / RTS / DSR / DTR ), and of course, the actual TX / RX data flowing through the port.

Читайте также:  Запуск a windows в linux через виртуальны

The key component of our Serial Monitor is the Device Monitor (aka tdevmon ) service. This service consists of a kernel-mode module intercepting requests from applications to the specified devices and a user-mode configuration utility.

Installation and proper configuration of the Device Monitor service are sometimes stumbling points for users. Please follow these knowledge base articles for more information:

The Serial Monitor in IO Ninja is the most advanced serial sniffer. Wonder why? Here are some of the killer features of our tool that make it stand out above the competition.

«True» Serial Monitoring on Linux

Unlike many other so-called serial sniffers for Linux (that usually require you to redirect the IO streams of an application in order to monitor), our serial monitor actually intercepts calls between an application and the serial TTY kernel module, thus allowing direct monitoring of serial communications performed by applications on your Linux box.

Serial Monitor for Linux Screencast

Plain Text vs Binary

Some serial protocols are text-based (e.g., Modbus ASCII ), and some are binary (e.g., Modbus RTU ). As a truly versatile serial monitor, IO Ninja doesn’t limit you to one or the other and lets you choose the representation that works best in each particular case. If you need to, you can switch between the two kinds of data views at any time.

Data vs Serial Events

Serial communications do not only consist of incoming and outgoing data. There are control line changes ( CTS / RTS / DSR / DTR ), serial setting adjustments (baud/data/stop/parity), and so on — you get the idea. IO Ninja records everything in a single continuous log sheet interleaving data bytes and informational messages — you have a clear and easy-to-follow timeline of events.

If you don’t need these extra pieces of information — filter them out of the log to enjoy a clean and readable data view. However, nothing gets lost — all the serial event records can be brought back whenever you need them.

Regex Colorizer

Having too much information before your eyes can be counterproductive. IO Ninja helps you focus on what’s important by automatically highlighting data in the log based on regular expression (regex) patterns. If you need to, you can define multiple regex patterns and assign different visual attributes to each of those — and this does not introduce any additional performance penalty. Yes, finding and colorizing many patterns is just as fast as colorizing one — how cool is that?!

Читайте также:  Postgresql основные команды linux

Checksums, Throughputs, Time Differences

Many serial protocols use one of the standard checksums ( CRC-8 , CRC-16 , SUM-8 , XOR-8 , etc.) to verify the integrity of data transmitted over an inherently lossy serial interface. IO Ninja calculates all standard checksums on the fly as you select data in the log; then, it conveniently displays the results in a table. Besides checksums, you also get local throughputs, time differences, byte offsets, data block lengths, etc.

Multiple Copy Modes

Сopy data from the log any way you want — as text, hex, C-array, etc. IO Ninja is smart and can guess what you want from the selection pattern — Ctrl+C always yields intuitive results. Of course, you can also explicitly state your intentions for how to copy the data via the context menu. You can save chunks of data directly into a file, too.

View As X-Term

Serial Monitor is a non-intrusive sniffer and hence, doesn’t allow transmission. However, you may want to know how the captured data looks in a terminal console.

IO Ninja features a fully compatible X-Term terminal view that allows you to render any portion of the captured data. Just select a range of bytes and Play Selection In Terminal .

Modbus RTU

Modbus RTU (especially over RS-485) is widely used in industrial automation, so it’s no wonder that IO Ninja features the Modbus Analyzer plugin for decoding Modbus frames. Attach it as a layer to your Serial Monitor session and enjoy the human-readable representation of Modbus commands and replies. The original data is complemented, not replaced — so nothing is lost.

Monitor Remote Serial Ports

You can connect over SSH and monitor serial ports on remote machines. Typically, those machines will be Linux boxes, but it’s possible to monitor remote ports in Windows, too.

First, make sure the SSH server and the Device Monitor ( tdevmon ) service on the target machine are up and running. Now, you can monitor serial ports on this remote machine over SSH just like you do with local ports!

Monitor At Hardware Level

If software monitoring doesn’t cut it (e.g., you need to troubleshoot the link between a PLC and an RS-485 stepper motor) — we’ve got you covered! Meet the Serial Tap — an affordable hardware sniffer for monitoring RS232 , RS485 , and TTL -level UART communications. The sniffer taps into the data and control lines of serial links and sends the recorded data to IO Ninja software in real time.

Now you know why we call IO Ninja the most advanced serial monitor program out there!

Источник

Оцените статью
Adblock
detector