Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save arberg/0378204852551950f4ecb809102df2fb to your computer and use it in GitHub Desktop.
Save arberg/0378204852551950f4ecb809102df2fb to your computer and use it in GitHub Desktop.
In windows redirect RS232 Serial Port traffic (in+out) to TCP port. Its possible to connect with telnet to tcp-port. Short circuit COM pin 2+3 (in+out) to do loop-back test of connection without device attached, see http://www.ni.com/tutorial/3450/en/
del log\*.log
rem Dependent on Hub4Com
rem Hub4Com Project page and download
rem https://sourceforge.net/projects/com0com/files/hub4com/
rem https://sourceforge.net/p/com0com/news/2012/06/hub4com-v2100-released/
rem Parent com0com project page (unused)
rem https://sourceforge.net/projects/com0com/
rem some trouble-shootting that helped me:
rem https://sourceforge.net/p/com0com/discussion/440109/thread/0bd5a118/
rem set TRACE_OPTIONS=--trace-file=log\com.log --create-filter=trace,com,com --trace-file=log\tcp.log --create-filter=trace,tcp,tcp --trace-file=log\telnet.log --create-filter=trace,telnet,telnet
rem One of the log-files is always empty so my trace lines are probably not correct, but I do get both ends
set TRACE_OPTIONS=--trace-file=log\com.log --trace-file=log\comEscParsed.log --create-filter=trace,com,com --trace-file=log\tcp.log --create-filter=trace,tcp,tcp --trace-file=log\telnet.log --create-filter=trace,telnet,telnet
set TRACE_OPTIONS2=--create-filter=trace,comEscParsed,com
rem Connect with 115200, 1 stop, no parity
hub4com %TRACE_OPTIONS% --create-filter=escparse,com,parse %TRACE_OPTIONS2%--create-filter=purge,com,purge --create-filter=pinmap,com,pinmap:"--rts=cts --dtr=dsr --break=break" --create-filter=linectl,com,lc:"--br=remote --lc=remote" --add-filters=0:com --create-filter=telnet,tcp,telnet:"--comport=server --suppress-echo=yes" --create-filter=lsrmap,tcp,lsrmap --create-filter=pinmap,tcp,pinmap:"--cts=cts --dsr=dsr --dcd=dcd --ring=ring" --create-filter=linectl,tcp,lc:" --br=local --lc=local" --add-filters=1:tcp --octs=off --baud=115200 "COM1" --use-driver=tcp "*7000"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment