Logic Machine Forum
Modbus RTU over TCP - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10)
+--- Thread: Modbus RTU over TCP (/showthread.php?tid=1677)



Modbus RTU over TCP - lpala - 25.10.2018

Hi All,
is there any way to get luamodbus working with device using RTU over TCP?

Thanks
Luca


RE: Modubus RTU over TCP - admin - 26.10.2018

Which LM version are you using? This has not been tested but it's possible to install and run socat which can create a virtual serial port and proxy data to/from TCP.


RE: Modubus RTU over TCP - lpala - 26.10.2018

(26.10.2018, 07:29)admin Wrote: Which LM version are you using? This has not been tested but it's possible to install and run socat which can create a virtual serial port and proxy data to/from TCP.

Hi Edgars, i'm using LM 2 reactor with latest stable fw. I've thought to socat too .
How can i install and launch it?

Thanks
Luca


RE: Modbus RTU over TCP - admin - 29.10.2018

Here's socat package for older LMs: https://dl.openrb.com/pkg/socat_1.7.3.2-1_mxs.ipk

Create a resident script with sleep time of at least 1 second, change TCP settings (192.168.1.100:502) as needed. Then use /dev/ttyVIRT0 as ModBus serial port. Resident script is needed to restart socat in case connection is dropped.
Code:
os.execute('socat pty,link=/dev/ttyVIRT0,raw tcp:192.168.1.100:502')