I was recently contacted with an issue in which a Modbus RTU device would stop receiving measurements randomly. Examining the code, there seemed to be two possibilities:
1) A CRC failure would result in Typica no longer sending commands, but it would be possible to re-start communications by sending a new SV if the device was configured to allow that.
2) If the response is for any reason not receieved in full, it would wait for that response forever with no hope of recovery.
I was able to replicate the described issue by introducing a temporary short on the RS-485 connection. The solution is to change the behavior in both of the above scenarios.
In the event of a CRC failure, Typica should re-send the previous command. There should also be a timer that is set whenever a command is sent and stopped only when a complete response has been received. If this timer times out, the response buffer should be cleared and Typica should re-send the previous command.
I was recently contacted with an issue in which a Modbus RTU device would stop receiving measurements randomly. Examining the code, there seemed to be two possibilities:
1) A CRC failure would result in Typica no longer sending commands, but it would be possible to re-start communications by sending a new SV if the device was configured to allow that. 2) If the response is for any reason not receieved in full, it would wait for that response forever with no hope of recovery.
I was able to replicate the described issue by introducing a temporary short on the RS-485 connection. The solution is to change the behavior in both of the above scenarios.
In the event of a CRC failure, Typica should re-send the previous command. There should also be a timer that is set whenever a command is sent and stopped only when a complete response has been received. If this timer times out, the response buffer should be cleared and Typica should re-send the previous command.