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