Gamble, Murray - Kan AV HFE (gamblem++at++kan.marconi.ca)
Wed, 29 Sep 1999 16:54:00 -0700 (PDT)
Yep, that did it. Or should I say that the problem has turned out to be
an incorrect baud rate setting. For some reason ports ttyd1 & ttyd2
seemed to "autosense" the correct baud rate and change from their default
setting of 9600 to 19200 whereas ports ttyd3 & ttyd4 would not. I don't
mean to sound like I'm passing the buck - I was trying to get off easy in
the software and it came back and bit me in the "you-know-where". Once I
setup a termio structure with the appropriate baud rate the device worked
fine on the ONYX2 and OCTANE systems.
Thank you for the "checkport" program - it was instrumental in helping me
diagnose the problem.
Thank you to all info-performer subscribers for you helpful suggestions.
What a great bunch!
Cheers,
Murray.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Murray G. Gamble, B.Eng
Human Factors Engineering - Aerospace
Marconi Canada
Kanata, Ontario, CANADA
-----Original Message-----
From: guest [SMTP:guest++at++holodeck.engr.sgi.com]
Sent: 29-Sep-99 12:19 PM
To: Gamble, Murray - Kan AV HFE; Info-Performer (E-mail)
Subject: Re: ONYX2 Serial Port Question
On Sep 29, 1:28pm, Gamble, Murray - Kan AV HFE wrote:
> Subject: RE: ONYX2 Serial Port Question
>
> Hi Mark,
>
> Thank you for your suggestions. I have checked the serial device
manager
> on both the ONYX2 and the Octane and there are no devices configured on
> any of the ports. I am using the serial ports in the simplest manner
> possible. That is I'm using "open, read, write and close" commands to
> send/receive data from the serial ports. As I stated in my original
> post, ports 1 & 2 on our ONYX2 work fine, ports 3 & 4 on the ONYX2 do
> not. With that in mind, I don't think that it is a problem with the
> termio structure.
>
> Any other ideas?
>
> Thanks again,
>
> Murray.
>
Hi Murray,
Yes, it is all clear now.
You cannot use the serial devices reliably in the manner stated.
You must use the ioctl command to set the state of the
serial port. If you don't, the port will be in an unknown
state. Could be wrong baud rate, wrong data bits, wrong
flow control, etc.
I put together a program that will let you check the state
of a serial port. This will reveal why some ports work and
some don't.
http://reality.sgi.com/aubin/checkport.c
Here's an example of how to set the port for a B&G flybox:
int fd;
struct termio tio;
if ((fd = open("/dev/ttyd2", O_RDWR|O_NDELAY)) == -1) {
fprintf(stderr, "Failed to open port.\n");
exit(-1);
}
tio.c_iflag = IGNBRK|IXON|IXOFF;
tio.c_oflag = 0;
tio.c_cflag = CS8|CREAD|CLOCAL;
tio.c_lflag = ICANON;
tio.c_ospeed = B19200;
if ((ioctl(fd, TCSETAF, &tio)) < 0) {
fprintf(stderr, "Failed to initialize port.\n");
exit(-1);
}
--Mark Aubin
aubin++at++sgi.com
-----------------------------------------------------------------------
List Archives, FAQ, FTP: http://www.sgi.com/software/performer/
Submissions: info-performer++at++sgi.com
Admin. requests: info-performer-request++at++sgi.com
This archive was generated by hypermail 2.0b2 on Wed Sep 29 1999 - 13:55:53 PDT