Low latency serial communication on Linux

后端 未结 7 2051
清歌不尽
清歌不尽 2020-12-13 07:46

I\'m implementing a protocol over serial ports on Linux. The protocol is based on a request answer scheme so the throughput is limited by the time it takes to send a packet

7条回答
  •  旧巷少年郎
    2020-12-13 08:44

    At those line speeds you should not be seeing latencies that large, regardless of how you check for readiness.

    You need to make sure the serial port is in raw mode (so you do "noncanonical reads") and that VMIN and VTIME are set correctly. You want to make sure that VTIME is zero so that an inter-character timer never kicks in. I would probably start with setting VMIN to 1 and tune from there.

    The syscall overhead is nothing compared to the time on the wire, so select() vs. poll(), etc. is unlikely to make a difference.

提交回复
热议问题