Thom Nichols


Technology is evolution outside the gene pool

Serial Console Monitoring without HyperTerminal

Although I'm a software engineer, I do, occasionally *gasp* have to interact with hardware. Of course that's an oxymoron, but what I mean is there are of course, a large number of programmers work on mainly client-server software that runs on commodity hardware (i.e. UNIX,Linux/Windows) and their biggest worry is which direction the directory slash faces - windows\ or linux/ - Aah!

So, let me share with you my experience of hooking one of these guys up to my laptop via a serial cable. Crazy, I know. Now on Windows, standard procedure is to fire up HyperTerminal -- seemingly the only application in Windows that hasn't been updated since Windows 3.x. It makes Minesweeper look like a 3D interface out of 'Minority Report.'

Getting to the point -- I thought "there's got to be something better than the compuing equivalent of smashing rocks together." Now, I'm perfectly comfortable with a real console window, so I went about trying to see if good ol' Cygwin can help me out here.

I found this link, which isn't exactly a step-by-step tutorial, but it was enough to help me figure it out. Given the following settings in HyperTerminal:

  • Connect Using: COM1
  • Baud rate: 9600
  • Parity: none
  • Stop bits: 1
  • Flow Control: Hardware

This translates (roughly) to the following TTY settings:

$ stty -F /dev/ttyS0 9600 crtscts clocal

And after you've done that... Nothing happens! Now what? Ok, now I can do this:

$ cat /dev/ttyS0

and see the console output from the device in my local console! Sweet.

Now it's not perfect -- for some reason, 'less' didn't quite work; to get around it I did this:

$ cat /dev/ttyS0 >> ilon.console.log
$ less ilon.console.log
.. [ then press 'F' to tail that log ]

So this worked fairly well. I'm not sure if this would work if the console needed to accept input, but this is still an improvement over HyperTerminal :)

EDIT: More info on general Linux serial support.

(Comments are closed)


  1. avatar Serial Console in Linux and Mac OSX June 11, 2010 Thom

    Thanks to this handy tip, it's easy enough to do the same in Linux and Mac OSX using 'screen': 

    screen -U /dev/tty.PL2303-00002006 115200

    I'd be interested to see if this works in Cygwin as well...

    Of course, I'm not sure how to set the parity and stop bit settings using screen but luckily enough haven't needed to change it.  This seems to 'just work' so far.