@Janmiguel@AndzejJ sorry for tagging you but is there a way to see modbus_server internal logs? I would like to understand what’s going on. From what I can see the logread does not show this kind of info
The fact that service modbus_server restart does not solve the problem and only a full reboot brings back the modbus is really painful.
I tried doing a simple test based on your configuration, I run a Modbus client simulator which periodically collects certain data on a RUTX50 running the 7.05.4 firmware version and I never had any errors.
May I know first what Modbus parameters are you periodically collecting?
Since the availability of the data depends on certain scenarios such as having a mobile connection, etc.
For example, If I wanted to collect RSSI (mobile signal strength) without having to put a SIM card in it, I would have some errors since no data was available due to the lack of mobile connectivity. (as shown below)
Based on the first provided error in your case Error: Modbus exception 2: Illegal data address (register not supported by device)
→ It seems like there’s an error in the register address configuration on the Modbus client side.
For the Error: Modbus exception 4: Slave device failure (device reports internal error)
→ As I have mentioned above, this may be due to a collection of modbus parameters related to mobile connection or GPS.
Lastly, kindly download the troubleshoot file of the device and send it to me via private message for me to check further.
You can do this by navigating to System → Maintenance ->Troubleshoot, then scroll in the Troubleshoot section,
If I wanted to collect RSSI (mobile signal strength) without having to put a SIM card in it, I would have some errors since no data was available due to the lack of mobile connectivity.
Yep, this is kind of the idea. I want to continuously collect the data and, if something looks weird, take an appropriate action.
Question to you: Do you think that it’s correct to throw a Modbus exception 4 because of missing data? Why not return some constant value (e.g, -1) if there’s no RSSI? I mean, the -1 is much more informative than the exception. From the client point-of-view, exception implies that there was an internal error when in reality there was none, it’s just the SIM card that’s missing.
Error: Modbus exception 2: Illegal data address (register not supported by device)
→ It seems like there’s an error in the register address configuration on the Modbus client side.
Yep, that what I thought initially. However, the error disappears when I reboot the router.
What’s the proper way to restart the modbus_server? The service modbus_server restart does not work.
Also, can you explain what’s the rs_modbus? What does it do?
Can you confirm that /etc/init.d/modbus_server restart doesn’t fix the issue and reboot is still required?
For the rs_modbus, it is a different service on Teltonika devices use for serial utilities. ‘rs_modbus’ is for the Modbus TCP over Serial Gateway functionality. Therefore, to properly restart the Modbus TCP Server service, restart the ‘modbus_server’ instead of the rs_modbus.
Upon rechecking the Modbus parameters you were collecting, it seems like you were using the Register Address per parameter. Note that if you wanted to collect Modbus parameters from the Teltonika device, you need to use the Register Number instead (basically +1 from the Register Address)
Here’s a link for more details - RUTX50 Monitoring via Modbus - Teltonika Networks Wiki
Can you confirm that /etc/init.d/modbus_server restart doesn’t fix the issue and reboot is still required?
Ok. I’ll give it a try next time that it fails.
Upon rechecking the Modbus parameters you were collecting, it seems like you were using the Register Address per parameter. Note that if you wanted to collect Modbus parameters from the Teltonika device, you need to use the Register Number instead (basically +1 from the Register Address)
Here’s a link for more details - RUTX50 Monitoring via Modbus - Teltonika Networks Wiki
I guess that under the hood my modbus client does the +1 because the data that I’m getting is good.
BTW can you tag any firmware devs in here? I want to ask them to add the -h/--help option to the modbus_server. Also, would be good to hear their input on the static value instead of Error: Modbus exception 4: Slave device failure before bothering Sales Manager.