In the windows world we had the good old Hyperterminal program which was shipped with all windows distributions until recently. Now Hyperterminal is a payware utility and can be purchased separately. No free utility available out there for windows! But then in the linux world, things are friendlier. There is minicomm and many more free utilities that come with the operating system.
Well the point of this blog post is not to berate windows or anything. Just wanted to share a way you could look at the data coming in from a serial port without downloading/purchasing any software. This is very handy for troubleshooting, say if you are looking for any control characters or any noise in the serial line, etc.All this while an app is running using the serialport. This can be done outside the app space to monitor activity on a serial port.
To see the data from a serial port on command line as well as save it to a file here is what you can do.
The script command writes data from a terminal to the specified output file.
script -af serialOut.txt
hexdump reads from a serial port and prints out the bytes in hex and ASCII
hexdump -vC /dev/ttyS0
Here is what the whole thing looks like after executing the commands above...
The top window shows the output from the terminal and the bottom one shows the contents of the output file in real time.
You can do this and much more on a windows platform too! By installing cygwin and running linux commands within the cygwin environment.