RUT951 ModBus SMS send register 396 code hangs on write

In a previous post, now closed, I reported problems with the ModBus SMS send function:

whereby writing to register 396 causes Ruby code to hang (apparently waiting to receive an acknowledgement packet from the RUT951.

I have now done some further experiments, using the same code to write to register 203 which turns the wifi on and off. Accessing register 203 works, without hanging.

Writing to register 396 (the SMS send register) does send an SMS correctly. The only problem is that the code then fails to return because of the acknowledgement packet not being received.

Significantly perhaps, if you write to the block of registers 396 upwards, an SMS is sent using the data already in 397 upwards (which is then overwritten with the new data from the block). But the whole block write hangs, apparently because of the inclusion of register 396 in the block.

Also significant, it doesn’t seem to matter whether you write a 0 or a 1 to register 396. The SMS is sent in either case.

The behaviour using modbus-cli is the same as with my own code. (Of course the rmodbus module is used in common).

I’m thinking this may be a firmware bug, or perhaps a problem with versions of the Ruby modules being used?


I’ve checked the behaviour, and I think the issue here is that it takes over 1 second to receive the confirmation that the message was sent:

This could cause some Modbus Servers to timeout. Is it possible to increase the timeout with the Modbus library used in your code?
There is not much that can be done from our side, as the response is sent when the modem provides a confirmation that the message was sent, which takes around 1 second, so I suggest changing this value in your code.
Let me know if any additional information is needed.

Best regards,

Problem resolved!

Indeed the default timeout in the Ruby library that I am using (Ruby gem rmodbus) is 1 second. There is an attribute called :read_retry_timeout, and setting this to 2 seconds solves the problem. Writing to register 396 now completes without a hang.

Thank you so much for finding out that the SMS send time is 1s, I would not have suspected that. It does make clear sense that the response is not sent from the router until the modem confirms that the SMS has been transmitted.

Best regards

Glad to hear that it’s working now!

Best regards,

This topic was automatically closed after 15 days. New replies are no longer allowed.