Modbus RTU to/over TCP is the feature which can achieve the transmission beteween TCP client/Modbus TCP client to RS485 Modbus RTU devices. For settings please refer to article How to Achieve Modbus RTU to/over TCP between Milesight Gateways and Controllers.
This article will describe how to trouble shooting when you fail to receive the RS485 device data from TCP client or Modbus TCP client.
Part 1: Milesight Controller Check
- Ensure RS485 serial setting is correct and Modbus RS485 Bridge LoRaWAN is enabled.
- Ensure the Milesight controller can fetch RS485 device data via ToolBox. If failed, refer to article Fail to Fetch RS485 Data from ToolBox.
- Change the Milesight controller class type to Class C and ensure saved. Only UC502/UC11-N1-DC/UC1152 supports class C type.
- Expand the reporting interval of controller to avoid data jam.
Part 2: Milesight Gateway Check
- Ensure the Milesight Controller has joined the network of Milesight gateway. (See How to Connect LoRaWAN Node/Sensor to Milesight Gateway)
- Go to Network Server > Packets page, put in controller Device EUI and Modbus RS485 Bridge LoRaWAN Port, select type as hex, then click Send to send Modbus RTU command to controller. If you can see Modbus reply, the controller and gateway transmission is no problem.
- Ensure you select the correct Modbus RTU Data Tranmission type and configure correct ports. After changing the settings, reboot the gateway.
- Modbus RTU Data Tranmission:
Modbus RTU over TCP: connect TCP client to gateway and send Modbus RTU commands remotely
Modbus RTU to TCP: connect Modbus TCP client to gateway and send Modbus TCP commands remotely
- Fport: the same as controller Modbus RS485 Bridge LoRaWAN Port
- TCP Port: TCP client or Modbus TCP client port
- Ensure the TCP client or Modbus TCP client can ping gateway IP address, and you can also ping TCP client/Modbus TCP client IP address in gateway Maintenance -> Tool -> Ping page.
- Send Modbus commands from TCP client or Modbus TCP client, then go to Network Server > Packets page to check if there is any downlinks and replys. If not, download gateway log files and unzip it, you can find one lora-modbus-bridge.log file to check transmission information.
- If the log shows timeout in gateway as below, it means the gateway close the session before RS485 reply comes to gateway. Default timeout for gateway is 10 seconds. The solution is shortening the RS485 reply time or increase the gateway timeout. If you needto increase the gateway timeout, please contact Milesight support about it.
time="2021-04-14T21:02:19-04:00" level=info msg="new tcp client 192.168.1.101:56171 connected"
time="2021-04-14T21:02:20-04:00" level=info msg="tcp message received [0 1 0 0 0 6 1 3 0 211 0 1]"
time="2021-04-14T21:02:20-04:00" level=info msg="[REQ] modbus-rtu [0 1 0 0 0 6 1 3 0 211 0 1], and push into lora-gateway mqtt"
time="2021-04-14T21:02:30-04:00" level=info msg="[RESP] timeout, modbus without response"
If you need any help for deeper trouble-shooting, feel free to contact Milesight Technical Support.