Two more small questions

bridged with qdn.public.qnxrtp.applications
Post Reply
Kevin Weisser

Two more small questions

Post by Kevin Weisser » Thu Jun 06, 2002 3:25 pm

First:
It seems as if my serial port buffer has stuff in in because if I type I
don't recieve the character I am typing till later, so is there a way to
flush the buffer or just send it immediately? I have tried fflush and also
have tried the option O_NDELAY.

Second:
Once connected to another computer over a NULL modem line, both sides
are recieved info but they are recieved it in garbled characters so is there
any type of cast or conversion that must be done before sending characters
over a line?

Thoma

Re: Two more small questions

Post by Thoma » Thu Jun 06, 2002 3:25 pm

Kevin Weisser <kweisser@udel.edu> wrote:
First: It seems as if my serial port buffer has stuff in in
because if I type I don't recieve the character I am typing
till later, so is there a way to flush the buffer or just send
it immediately? I have tried fflush and also have tried the
option O_NDELAY.

Second: Once connected to another computer over a NULL modem
line, both sides are recieved info but they are recieved it in
garbled characters so is there any type of cast or conversion
that must be done before sending characters over a line?
Basic steps, reboot both machines. Hook up serial 1 to serial 2
on one of the computers, then try and see what you get there.
From that point you can start to try to change things to reach
your final configuration.

Usually when you see garbled characters is would signify either
a bad/lossy cable or connection or a small difference in the
settings of the 2 UARTS.

t.

Richard Kramer

Re: Two more small questions

Post by Richard Kramer » Thu Jun 06, 2002 9:24 pm

Thomas wrote:
Kevin Weisser <kweisser@udel.edu> wrote:
First: It seems as if my serial port buffer has stuff in in
because if I type I don't recieve the character I am typing
till later, so is there a way to flush the buffer or just send
it immediately? I have tried fflush and also have tried the
option O_NDELAY.
Your earlier messages implied you weren't familiar with the behaviors
associated with "raw" and "cooked" modes (See Kris Warketin's comments
re "raw() and unraw()"). If that isn't the problem, look at the "tc"
functions. If you have a scope or breakout box or RS232 mini-tester
and can slow the baud way down, you can watch the blinky lights to
maybe give an idea of what's happening.
Second: Once connected to another computer over a NULL modem
line, both sides are recieved info but they are recieved it in
garbled characters so is there any type of cast or conversion
that must be done before sending characters over a line?

Basic steps, reboot both machines. Hook up serial 1 to serial 2
on one of the computers, then try and see what you get there.
From that point you can start to try to change things to reach
your final configuration.

Usually when you see garbled characters is would signify either
a bad/lossy cable or connection or a small difference in the
settings of the 2 UARTS.
Baud rates need to be the same on both machines, as does the format,
e.g. 8N1 or whatever.

Richard
t.

David Gibbs

Re: Two more small questions

Post by David Gibbs » Fri Jun 07, 2002 2:19 pm

Kevin Weisser <kweisser@udel.edu> wrote:
First:
It seems as if my serial port buffer has stuff in in because if I type I
don't recieve the character I am typing till later, so is there a way to
flush the buffer or just send it immediately? I have tried fflush and also
have tried the option O_NDELAY.
First step: if you can avoid it, don't use the FILE * functions (e.g.
fopen(), fwrite(), printf(), fprintf(), etc.). They introduce extra
buffering on the client side that can complicate things further.

Use open(), read(), write(), close() to keep things simple.
Second:
Once connected to another computer over a NULL modem line, both sides
are recieved info but they are recieved it in garbled characters so is there
any type of cast or conversion that must be done before sending characters
over a line?
Most common cause for this is baud rate -- but any other mismatched
settings can do it. You need to match baud rate, number of bits,
number of stopbits. If you do an "stty < /dev/ser1" (or appropriate
serial port), it will report these pieces of information in its last
line. Make sure they match up on both sides.

-David
--
QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Post Reply

Return to “qdn.public.qnxrtp.applications”