2

I have two boards and they are connected using a UART connection (TX, RX, CTS, RTS). The problem is that I have 2 processes that needs to use the same serial port. Graphically, the problem looks like this:

Process A1 (Host) --- | Physical Serial Connection |--- Process A2 (Controller)
Process B1 (Host) --- | Physical Serial Connection |--- Process B2 (Controller)

Basically, Process A1 from Board 1 communicates with Process A2 from Board 2. Similar for B1 and B2. Same Physical Serial Connection is used.

How could I share the same physical serial connection between the two processes? I don't want to modify the code on the application side, so everything should be transparent to the application. I was thinking of using a protocol similar to GSM 07.10 (https://www.kernel.org/doc/html/latest/driver-api/serial/n_gsm.html) that creates several virtual tty for the same serial connection then it takes care of multiplexing/demultiplexing. However, it looks that GSM 07.10 is not maintained anymore in the Linux Kernel so I was thinking of alternatives. Could you advise?

Doru
  • 21
  • 2
  • Consider the idea of using a Serial to Ethernet converter to replace a serial cable with a network. – kunif Jul 01 '20 at 09:28
  • Title of this topic clearly states that I am looking for a "software" solution. – Doru Jul 01 '20 at 10:03
  • There seems to be an experimental protocol specification called [RFC2217](https://tools.ietf.org/html/rfc2217). There is a program called [hub4com](https://sourceforge.net/projects/com0com/files/hub4com/) on Windows. I don't know if anything exists for Linux. Maybe it can be applied. – kunif Jul 01 '20 at 10:39
  • 2
    Using tools at hand, a PPP link could be established over the serial link, and the "socat" utility could be used to link virtual TTYs across TCP/IP connections across the PPP link. Another option using PPP would be to implement RFC 1963 "PPP Serial Data Transport Protocol (SDTP)" in the kernel, but that seems like a lot of work. – Ian Abbott Jul 01 '20 at 12:09
  • Do you really use `CTS, RTS` for flow control? – meuh Jul 01 '20 at 14:26
  • Searching for RFC 2217 compliant products reveals a large number of products, including the hardware that was first commented, so it seems to be a major usage. You may already have software that you can use without writing it yourself. These may be helpful. [Serial port to network proxy](https://sourceforge.net/projects/ser2net/), [sercd](https://sourceforge.net/projects/sercd/), [Is there a Java client that supports Telnet RFC2217 (to communicate with COM ports over a network connection)?](https://stackoverflow.com/q/3167821/9014308), [archiecobbs/jvser](https://github.com/archiecobbs/jvser) – kunif Jul 02 '20 at 03:21

0 Answers0