Friday, March 26, 2010

Hyperterminal Replacement For Linux

This is a little gem I found recently when I needed to communicate with my OpenLog board. A lot of tutorials want you to pull up HyperTerminal in Windows to talk to OpenLog over the USB->UART bridge. My biggest problem with this is that I'm primarily a Linux user, where HyperTerminal is unavailable. That's all well and good, however, I'll just boot into my Windows 7 install and do it, right? Wrong. Windows 7 no longer ships with HyperTerminal. I jumped back to my Ubuntu Linux install and started hunting for a HyperTerminal replacement. The best solution I ended up finding was a command-line application called minicom. This handy little app is a bit to get the hang of, but once you're using it, it works like a charm. Here's a quick rundown of connecting to a serial device over USB using Minicom.

First, let's figure out the path to our serial device. Ubuntu typically places these devices at /dev/ttyUSB#. Use the following command to determine the appropriate number of your device.

[code gutter="0"]$ ls /dev/ttyUSB*[/code]

Now we'll install Minicom to get started.

[code gutter="0"]$ sudo apt-get install minicom[/code]

Once that's complete, we'll need to configure Minicom so that it's using the correct port. To do this, run the command below.

[code gutter="0"]$ minicom -s[/code]

You'll be prompted with a configuration menu. Arrow down to "Serial port setup" and press enter.
[code gutter="0"]+--------------------------------------------------------+
| A -    Serial Device      : /dev/ttyUSB0               |
| B - Lockfile Location     : /var/lock                  |
| C -   Callin Program      :                           |
| D -  Callout Program      :                            |
| E -    Bps/Par/Bits       : 115200 8N1                |
| F - Hardware Flow Control : Yes                        |
| G - Software Flow Control : No                         |
|                                                       |
|    Change which setting?                              |
+--------------------------------------------------------+[/code]


The first line will give you the path to the serial port Minicom is going to talk to. If this doesn't match the /dev/ttyUSB# path you found above, hit "A" on your keyboard and enter in the correct path and press enter. Now double check your Bps/Par/Bits settings. The default 9600 8N1 is pretty standard, but you may need to hit "E" and provide a different Speed setting depending on the device you're talking to. In my case, OpenLog is running at 115200bps, so I went through and made the appropriate changes. Hit enter again to exit the serial port settings menu. The other settings can usually be left to their default values, so arrow down to "Save setup as dfl" to save this configuration as default. This way you don't have to configure Minicom every time you use it. Now arrow down to "Exit" and hit enter. Minicom will now start up using the settings you specified. If all goes well, you should now be connected to your device and ready to send/receive. From now on, you can start minicom without the -s switch.

[code gutter="0"]$ minicom[/code]

Got a better HyperTerminal replacement that you use in Linux? Let me know about it in the comments.

1 comment:

  1. I jump between minicom and GNU screen often. They are both slightly different takes on the same problem.

    I use it to communicate with my Bus Pirate. Handy little tool, that.

    ReplyDelete