9 bits uart emulation with /dev/tty*

孤街醉人 提交于 2020-01-02 15:45:54

问题


I have a uncommon protocol, which requires 9600 baud, 9 bits and one stop bit. I can't find any driver, which can implement this sending/receiving.

Can I send something to /dev/tty* for emulating these queries? What should I send? How can I emulate a 9600 baud rate?


回答1:


You can use sticky parity, which is also called MARK and SPACE parity. termios.h supports this. However, you need to change the parity settings before sending address or data bytes accordingly and depending on the hardware, this may introduce undesired delays between two types of bytes. I have experienced delays from 0.4 ms to 10 ms with FT232RL & FT232BL USB to serial converters. I'm not sure but I suspect that it's also affected by the motherboard and the USB port you use (USB2 or USB3). Also, you need to be sure that the transmit buffer is empty before attempting a parity mode change because it also affects the parity settings of the bytes that are already placed in the transmit buffer.



来源:https://stackoverflow.com/questions/29290866/9-bits-uart-emulation-with-dev-tty

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!