I am debugging Ruby code running on a Raspberry Pi under Ubuntu to send an SMS message from an RUT951 using ModBus. Following the instructions on the web page at https://wiki.teltonika-networks.com/view/RUT951_Monitoring_via_Modbus is not usable because the Ruby code hangs in an infinite loop after writing a 1 to ModBus register 396 to initiate the send. As far as I can see using irb, the router does not respond to the query sent to it, so the Ruby code hangs in a loop waiting for a response.
How to reproduce:
-
Write a telephone number and message text to ModBus registers 397 … 406 (I am doing this with a Ruby script, but it could be done with a modbus command as detailed in the above webpage (section Send SMS Message).
-
Issue the command:
modbus write -D -p 502 192.168.1.1 %MW396 1
exactly as given in the webpage. This succeeds in sending the SMS, but it does not return to the command prompt. And the debug output shows only the Tx data:
Tx (15 bytes): [00][01][00][00][00][09][01][10][01][8c][00][01][02][00][01]
- After recovering from the hang with a few Cntl-Cs, trying a similar write to the next register works OK:
modbus write -D -p 502 192.168.1.1 %MW397 123
Tx (15 bytes): [00][01][00][00][00][09][01][10][01][8d][00][01][02][00][7b]
Rx (12 bytes): [00][01][00][00][00][06][01][10][01][8d][00][01]
So, it seems to me that the write to register 396 fails to respond with an echo of the PDU, causing the Ruby code in rmodbus to sit in a loop waiting indefinitely.
Maybe register 396 is different, and cannot be accessed this way, but I am following the instructions given on a Teltonika web page. Any ideas or suggestions would be welcome.