2

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?

Alex Antonov
  • 14,134
  • 7
  • 65
  • 142
  • It is the kind of protocol that is used by vendors that also sell hardware. Picked because they know you'll have an almost impossible task to make it work with commodity hardware. It can only be done efficiently by a device driver, it needs to reconfigure the UART on-the-fly while transmitting, usually the FIFO needs to be disabled. Easy to do with a micro-controller, not on a protected mode operating system like Linux. Resistance is futile, buy the hardware. – Hans Passant Mar 27 '15 at 00:19
  • What part can I buy? – Alex Antonov Mar 27 '15 at 05:20
  • 1
    See http://stackoverflow.com/questions/26887468/9-bit-protocol-on-uart-in-embedded-linux and http://superuser.com/questions/411386/seeking-9-bit-serial-port-card-for-windows-pc/411438#411438. Some SoC microprocessors and microcontrollers have 9-bit capable USARTs, such as the Atmel uC on the Arduino Due. – sawdust Mar 27 '15 at 07:38

1 Answers1

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.

Tagli
  • 2,412
  • 2
  • 11
  • 14