Modbus Serial datasource character spacing
-
Hi everyone,
I would like to point out one crucial bug we found with the Modbus Serial module which is troubling us because we need rapid speeds in the RS485 network and we need a fast solution for solving this issue.
Explanation:
Because our devices are using strict time values meaning that when baud rates are greater than 19200 bps then fixed values for the 2 timers should be used. The recommended use of values of 750 μs for the inter-character time-out (t1.5) and a value of 1.750 ms for inter-frame delay (t3.5).
We noticed that when we change the baud rate to 38400 bps the devices stopped responding so we did the following calculations for trying to solve the issue:
For 38400 bps: t1,5 < 1000000 / 38400 * 8 * 1,5 = 312 µs t3,5 > 728 µs
For 57600 bps: t1,5 < 1000000 / 57600 * 8 * 1,5 = 208 µs t3,5 > 486 µsWe noticed that there was an option to override timing for Modbus Serial communication so we thought that we were in luck with solving the issue.
The compute timing gave us the correct values according to Modbus Network theory but the override timing option does not function correctly.
The devices were still not answering despite the change when we applied the override so we measured the timings and data communication with an oscilloscope by using devices which do not use strict time values. We noticed that the real character spacing was actually around 830-850 µs despite setting the override to 750000 ns.
We then tried to change the character spacing value lower hoping that there was an calculation error for overriding but then the communication did not change and it still stayed around 800-850 µs despite the change in the character spacing.
At around 100000 ns the character spacing changed drastically and we lost data from the query and the network bugged out. In the oscilloscope we noticed that the data changed to gibberish and we could not understand the bits of data which was being transmitted. Some bits were lost in the communication but Mango could still communicate with the device.
Conclusion
The character spacing max value has to be <750 µs when changing to >19200 bps. Currently Mango is not using these standards and we had to use 19200 bps for our devices which is kind of small for the current project. We will see how the project goes but we need fast solution for this.
-
Hi Thomas,
Can you try to turn on the Override Timing option but leave both values as 0, I think this will bypass the timing done in software and let the hardware chip do the timing. We will definitely look into this more but I've noticed better results with some devices if I have the timing set to 0.
-
Hi Joel,
Sorry for taking so long for your response.
If I set the values to 0 then the device will answer.
-
Thanks for bringing this to our attention Thomas, I have added Troubleshooting article to our knowledge base mango-cannot-communicate-with-modbus-serial-devices-at-higher-baud-rates
-
Hi everyone,
The current solution in setting the module timing overrides to 0 works fine and the devices answer fine but one persistent problem still exists.
We noticed some odd things about the polling times before the fix and after... When starting or restarting the data source (disable/enable, saving etc...) then the polling time is around 950 ms which is fine but when the module has been running for a couple of hours then the time gets bigger and stays around 1.5-2 seconds.
If you are looking into the baud rate problem then maybe you could also look into that.
Sincerely,
Thomas -
Poll times generally indicate the time it takes for the device to respond to all the request for data. The information here probably isn't enough for us to look at especially since we never see this on any other systems so it is quite odd. Generally our modbus networks run at 19.2k baud.
You could capture the following system metrics during a time when the polls are slow just to see if something is going wrong on the MangoES:
logs/ma.log file
Screen shot from the Internal Metrics tab and work items tab
Download JSON from the Threads tab on logging console
Screenshot of running "top" in a ssh console
JSON export of your Modbus Serial Data source and data points so we can review all the settings.These items will help us see if any kind of performance in Mango is causing your poll times to slow down.
Thanks,