Re: Interrupt-driven serial comm for Linux ?



Hi,

Thank you for your response!

"Jens Thoms Toerring" <jt@xxxxxxxxxxx> schreef in bericht
news:6aafsvF35lebrU1@xxxxxxxxxxxxxxxxxxxx
mpv <nospam@xxxxxxxxxxx> wrote:

All Linux libraries and tutorials / How To's that I have seen (and that
is
dozens by now!) use unbuffered communication. That means that at this
baudrate and without handshaking, all incoming data beyond the UART's
FIFO
is lost!

How that? I have read lots of data (definitely more that the
FIFOs buffer size) from the serial port without losing bits.
The existing driver for the serial port should take care of
buffering the data coming in until you read them. So did you
actually try to read from the device file for the serial port
or is this only a theoretical conclusion?

I have actually tried this (of course), and I am consistently only reading
15 bytes of data. This seems very close to the 16 bytes that is the size of
the FIFO. There is linux serial port support for an earlier device that we
sell, but that device uses hardware handshaking. The serial port driver will
then signal the device to wait before sending the next bytes. I do not
believe I am doing anything wrong, as the 15 first bytes that I get are the
correct ones.

Please note that some of the howto's you will find on the
net seem to be of dubious quality. If I remember correctly,
the "Serial Programming Guide for POSIX Operating Systems"
was the one one had to look out for, it's at

http://www.easysw.com/~mike/serial/serial.html

I had found this one, and also thought it was the best one. Nothing on event
driven stuff, however.

The only thing I guess you will be mising is some
kind of callback mechanism. But that shouldn't be a problem if
your GUI framework allows you to e.g. install a handler that
always gets called when there's nothing to do and in which you
can check if there's something to read from the serial port
(use the select(2) function) and read the available data with
read(2) if there are.

I will look into this, I have worked with idle handlers before (with Delphi)

regards, Matt


.



Relevant Pages

  • Re: Make serial data available over TCP
    ... > port to the fifo. ... > connection is made would read from the fifo and write to the network ... Run this program with stdin redirected from the serial port. ... You also need to decide what to do if a client is too slow to keep up. ...
    (comp.unix.programmer)
  • setserial -> serial_core / 8250 interaction
    ... The result is that fifo_size remains 0 and the fifo is disabled. ... autoconfig is used) will have very poor serial port performance (I did, ... privileged, proprietary, or otherwise private information. ... please notify the sender immediately and delete ...
    (Linux-Kernel)
  • DeviceSerial1 was really a serial port, fifo detected
    ... wiped hard drive and reloaded winxp pro. ... Event Type: Information ... While validating that \Device\Serial1 was really a serial port, ... The fifo will be used. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: Serial IR receiver problem
    ... is preventing the serial port driver from emptying the 16550A FIFO ... before it wraps, resulting in lost characters. ... the serial port driver's interrupt handler is ...
    (comp.home.automation)
  • Re: Monitor RS232 Line Communication - PC hookup
    ... >> the amount of data coming into the serial port. ... > I should have specified more explicitly it is the instrument that is ... > I'm just sending data at 2400baud without any handshaking using SCPI ... One way that we use an old PC for monitoring serial comms is using a special ...
    (comp.arch.embedded)