This is the mail archive of the ecos-discuss@sourceware.cygnus.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: serial driver questions



> > We (Red Hat) are shortly about to start some significant
> > development work, part of which will include non-blocking I/O.
> > We're a bit short on implementation details right now, but
> > fully intend to develop this in the open. We would of course
> > greatly appreciate any input you could give once we start, but
> > as announced elsewhere, just now we're pushing towards the
> > upcoming new eCos net release.
> 
> I'd suggest a "semi-blocking" mode where a configurable timeout
> (typically a few character times) would allow a read request to
> return when the line remained idle for longer than the timeout.
> (The better UARTs with FIFOs have this kind of logic wired to
> the receive interrupt.)

Most of the buffered UARTs I've looked at only provide you with
an rx-timeout interrupt if there is data in the FIFO.  If the
gap occured just as you empty the FIFO, you get no timeout
interrupt from the UART so you still have to have some sort of
an inter-byte timer in the driver.  What a pain.

> Making the timeout dynamically configurable is important, as
> some protocols (eg. SEMI-E4, AKA SECS-I) require different
> timeouts in different parts of a packet. For example, SECS-I
> specifies one timeout for the first "wake-up" character in its
> protocol, but a smaller timeout for intercharacter time in the
> data part of a packet.

Yup.  Did something using SECS a few years ago, and that type
of thing is quite common for industrial protocols.  For the
protocols I've dealt with, the best solution I've found is to
have two timeouts: first-byte and inter-byte.  In Modbus for
example, when you call read() to get a reply from a slave you
want to be able to wait a configurable time (up to a couple
seconds) for the first byte, but then you want a timeout if
there is a gap between bytes of more than 3 byte times.

All of the protocols I know of are pretty happy with timer
resolutions of 1 byte-time, though the two timeouts are often
spec'ed in different units: the initial byte timeout in
absolute time (i.e. 200 milliseconds), and the inter-byte time
in baud-relative times (i.e. 3 byte-times).

-- 
Grant Edwards
grante@visi.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]