This is the mail archive of the
mailing list for the Cygwin project.
RE: Looking for basic documentation on Cygwin and Serial Ports
- From: Nefastor <nefastor at hotmail dot com>
- To: cygwin at cygwin dot com
- Date: Thu, 1 May 2008 16:04:37 -0700 (PDT)
- Subject: RE: Looking for basic documentation on Cygwin and Serial Ports
- References: <email@example.com> <480F02EA.AF265921@dessent.net> <firstname.lastname@example.org> <28D25EB5A34E89408B73B6793C742171CAB6B4@nutmeg.CAM.ARTIMI.COM> <email@example.com>
> Thanks for all the info, everyone :-D. I'm gonna try a few things and get
> back to you.
So I've tried a few things, and obviously all hell broke loose, sort of.
I've written a very simple "Hello World" program, which I'll paste at the
end of this message. The program is based 90% on code copy-pasted directed
from the serial programming HOWTO. Here's what it does :
- Open COM3
- Get its attribute
- Modify them to my desired baudrate and such
- Send out the string "Hello World"
- Close COM3
Opening and closing COM3 works. The rest exhibits faulty but consistent
- The baudrate never changes and I can't seem to figure out what it is, but
the terminal I plugged on COM3 always gets the same garbled characters
instead of "Hello World". Also, the terminal flags me a buffer overrun. This
suggested that tcsetattr() didn't work.
- So I tested tcsetattr() by omitting the CRTSCTS flag in my parameters.
With it, the program would not send data until the terminal was ready to
receive, without it, the program would send the data no matter what. So
tcsetattr() appears to work.
My terminal is an ultra-reliable PSION Series 3A I've been using for almost
a decade. I've tested it again with Windows' Hyperterminal and COM3 to
verify that it wasn't a hardware problem.
My conclusion would be that either the FTDI drivers are broken or Cygwin has
trouble interfacing with them. Dave, since you're an FTDI user too, does any
of this sound familiar ?
Here's the program I've written :
int main (int argc, char* argv)
struct termios params;
tty = open ("/dev/ttyS2", O_RDWR | O_NOCTTY | O_NONBLOCK);
if (tty < 0)
printf ("Unable to open /dev/ttyS2\n");
tcgetattr (tty,¶ms); // get the current port settings
params.c_cflag = B19200 | CRTSCTS | CS8 | CLOCAL | CREAD;
params.c_iflag = IGNPAR;
params.c_oflag = 0;
params.c_lflag = ICANON;
tcflush (tty, TCIFLUSH);
write (tty,"Hello World",11);
View this message in context: http://www.nabble.com/Looking-for-basic-documentation-on-Cygwin-and-Serial-Ports-tp16827997p16995311.html
Sent from the Cygwin list mailing list archive at Nabble.com.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html