- com0com and com2tcp must be installed on the Windows machine (https://sourceforge.net/projects/com0com/)
- socat must be installed on the linux box.
- Optional, to log the communication (on windows) install hub4com (part of the com0com project).
-
On Windown use com0com to create a pair of virtual serial ports. One port will be used to connect to the com2tcp, the other will be the forwarded serial port from linux.
-
Add a virtual COM-pair (eg. COM10 <-> COM50) on the Windows machine with the help of com0com.
-
Execute following command on the linux box, to create a background process that forwards /dev/ttyAMA0 over tcp (modify the device, baudrate, and port as needed):
socat file:/dev/ttyAMA0,raw,echo=0,b115200 tcp-l:3000,fork&
- Start com2tcp on the Windows PC with following command:
com2tcp --baud 115200 --ignore-dsr \\.\COM50 10.0.0.53 3000
- Now you can communicate via COM0 with the device attached to /dev/ttyAMA0
- To use hub4com instead of com2tcp, use something like this:
com4hub --baudrate=115200 --ignore-dsr=true --log=both --logfile=com4hub_log.txt --serial=\\.\COM50 --tcp=10.0.0.53:3000