Low latency serial communication on Linux

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

    In short: Use a USB adapter and ASYNC_LOW_LATENCY.

    I've used a FT232RL based USB adapter on Modbus at 115.2 kbs.

    I get about 5 transactions (to 4 devices) in about 20 mS total with ASYNC_LOW_LATENCY. This includes two transactions to a slow-poke device (4 mS response time).

    Without ASYNC_LOW_LATENCY the total time is about 60 mS.

    With FTDI USB adapters ASYNC_LOW_LATENCY sets the inter-character timer on the chip itself to 1 mS (instead of the default 16 mS).

    I'm currently using a home-brewed USB adapter and I can set the latency for the adapter itself to whatever value I want. Setting it at 200 µS shaves another mS off that 20 mS.

提交回复
热议问题