Serial Link - Setting Read Timeouts < 1/10 sec?

Using VMIN and VTIME parts of c_cc in termios I’m able to set up a blocking
read on a serial link to return when VMIN bytes are received or a gap of
VTIME tenths of a second occurs since receiving the previous byte.

My problem is that I’m receiving variable length serial input at up to 10 Hz
and therefore I cannot always separate the messages using this mechanism.

Is is possible to set the timeout to less than 100ms?

Alternatively I have to read a byte at a time…

Ian Macafee <imacafee@radamec.co.uk> wrote:
IM > Using VMIN and VTIME parts of c_cc in termios I’m able to set up a blocking
IM > read on a serial link to return when VMIN bytes are received or a gap of
IM > VTIME tenths of a second occurs since receiving the previous byte.

IM > My problem is that I’m receiving variable length serial input at up to 10 Hz
IM > and therefore I cannot always separate the messages using this mechanism.

IM > Is is possible to set the timeout to less than 100ms?

IM > Alternatively I have to read a byte at a time…

You’ll probibly have to create some kind of header on your
communications records. Then you’re receiving software can scan for
that header and ignore bytes that aren’t part og the last record up to
the beginning of the next record.

Keep a count of the bytes skipped and fragments skipped. If those
numbers ever get too high (like 1) then that’s a sign that there is
a comm problem.


Bill Caroselli – Q-TPS Consulting
1-(626) 824-7983
qtps@earthlink.net