Low latency serial communication on Linux

后端 未结 7 2065
清歌不尽
清歌不尽 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:25

    Serial ports on linux are "wrapped" into unix-style terminal constructs, which hits you with 1 tick lag, i.e. 10ms. Try if stty -F /dev/ttySx raw low_latency helps, no guarantees though.

    On a PC, you can go hardcore and talk to standard serial ports directly, issue setserial /dev/ttySx uart none to unbind linux driver from serial port hw and control the port via inb/outb to port registers. I've tried that, it works great.

    The downside is you don't get interrupts when data arrives and you have to poll the register. often.

    You should be able to do same on the arm device side, may be much harder on exotic serial port hw.

提交回复
热议问题