configuration of serial fifo

From: Peter Münster (look_at_signature.invalid)
Date: 11/02/05


Date: Wed, 2 Nov 2005 18:05:08 +0100

Hello,

after receiving a special character on a UART, I would like to send out
another character in less than 2ms. I can have good latencies of about some
50µs, but often I get 3ms, which is too long. I think, this is because
of the fifo. How could I configure the fifo, to get triggered at every
character?
Here is my setup:

struct termios options;
struct serial_struct serial;
int fd = open("/dev/ttyS0", O_RDWR | O_NOCTTY);

ioctl(fd, TIOCGSERIAL, &serial);
serial.flags |= ASYNC_LOW_LATENCY;
serial.xmit_fifo_size = ???; // a value of 1 here does not change a lot
ioctl(fd, TIOCSSERIAL, &serial);

tcgetattr(fd, &options);
cfsetispeed(&options, B19200);
cfsetospeed(&options, B19200);
options.c_cflag &= ~(CSIZE | PARODD | CSTOPB | CRTSCTS);
options.c_cflag |= CLOCAL | CREAD | CS8 | PARENB;
options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
options.c_iflag |= INPCK | ISTRIP;
options.c_oflag &= ~OPOST;
options.c_cc[VTIME] = 0;
options.c_cc[VMIN] = 1;
tcsetattr(fd, TCSANOW, &options);

I've discovered the file linux/serial_reg.h with a lot of definitions,
for example:
#define UART_FCR_TRIGGER_1 0x00 /* Mask for trigger set at 1 */

But I don't know where I could find some documentation how to use these
defines...

I only know the "Serial Programming Guide for POSIX" but perhaps I need
something more specific to Linux...

Thanks in advance for any help!
Cheers, Peter

-- 
email: pmrb at free.fr
http://pmrb.free.fr/contact/


Relevant Pages

  • Request for comments - kgets()
    ... macro and a function-like macro macros below) ... pointers, dereferencing pointers, pointer arithmetic, and how (at ... character by character I can discuss a conceptual model of the ... FIFO Model - A block of memory having two pointers. ...
    (comp.lang.c)
  • Re: reading on serial port slow...
    ... FIFO has some characters waiting but no new ones have arrived ... IIRC "a while" is a few character times. ... the port to signal an interrupt after each character. ...
    (comp.os.linux.development.system)
  • Re: mscomm in vc++ - parity error
    ... ClearCommError reports the possible error condition before ... family UARTs can be problematic if the Rx FIFO is enabled. ... are several unprocessed bytes in the FIFO when the parity error ... represent the status of the current received character. ...
    (comp.arch.embedded)
  • Re: reading on serial port slow...
    ... the FIFO has reached a certain fullness or the FIFO has some characters ... waiting but no new ones have arrived for a while. ... to signal an interrupt after each character. ...
    (comp.os.linux.development.system)
  • Re: 25 microseconds?
    ... Draining the serial FIFO in the ISR is by better ... than sipping one character at a time since each character in the FIFO is ... > Both ISR and DPC execution can kill performance. ... > ISR - 10 microseconds ...
    (microsoft.public.development.device.drivers)