I have:

  • Windows 7
  • CygWin
  • A development board connected to COM1 port.

I need:

  • Connect to its serial port from CygWin.

If I used Linux I would run a program like picocom or minicom. Also in Windows 7 I could install HyperTerminal and open COM1 port or use Putty for that. But I would like to do it from CygWin's mintty because I like its fonts and some other small joys. It seems mintty itself is not able to work with serial ports, so I wonder if there is a program like picocom or minicom in CygWin's repository.

up vote 6 down vote accepted

Having done some research on terminal emulators today, I feel the need to hail the virtues of xterm. This FAQ documents a lot of the bugs in other terminal emulators which aim to be xterm or VT-100 compatible. You can also use vttest to reveal a lot these issues for yourself. What puts a lot of people off of xterm though is the lack of a menu configuration. This leads a lot of people to think xterm is not configurable at all, however it is in fact highly configurable, it just has to be done via files like .Xresources or command line options.

More gripes include lack of clipboard support and so lack of copy/paste with Ctrl-Shift-C/Ctrl-Shift-V by default, however this can be overcome. Another is the lack of tabs, however many advanced Linux users prefer to use tmux or GNU screen which provide equivalent features.

This leads me to the real answer to your question - screen can be used to connect to serial port and should work on Cygwin despite /dev/ttySX not showing up with ls. With this you should be able to use any terminal emulator you like, be it xterm or mintty. xterm lacks many modern features and so may not be for everyone, but it is work noting that it is difficult to match what happens under the hood.

In case the link dies, here is the syntax for using screen as a serial terminal:

screen /dev/ttySX baud_rate,cs8|cs7,ixon|-ixon,ixoff|-ixoff,istrip|-istrip

To my great surprise, picocom worked out of the box for what i needed to do - talk to embedded devices. There is no cygwin package for some reason, but building it is as easy as

git clone https://github.com/npat-efault/picocom; cd picocom && make

Assuming your device shows as COM3 under windows, run with

./picocom -b 115200 /dev/ttyS2

I believe screen will do this, cygwin maps COM ports to /dev/stty* devices and screen will take a device to connect.

From man screen

If a tty (character special device) name (e.g. "/dev/ttya") is spec‐ ified as the first parameter, then the window is directly connected to this device. This window type is similar to "screen cu -l /dev/ttya". Read and write access is required on the device node, an exclusive open is attempted on the node to mark the connection line as busy. An optional parameter is allowed consisting of a comma separated list of flags in the notation used by stty(1):

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.