Replies: 9 comments 11 replies
-
Hello. Unfortunately, ModbusLib does not have direct support for devices like the MAX485. It relies on the Linux OS layer to work with each serial device using a standard set of functions (read/write) in a unified way. To work with the MAX485, you need to create a separate program (in C/C++/Python) directly using the Raspbian interface for GPIO. |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot for a quick answer. |
Beta Was this translation helpful? Give feedback.
-
If you think that problem is with timings on server (slave, simulator) side, you can download latest release for Windows and test it on existing hardware. ModbusTools server has parameter |
Beta Was this translation helpful? Give feedback.
-
The problem I have with PC/USB/Windows is that the roundtrip delay from request to respons I can see on the oscilloscope is more than 30ms. This severely limits the posssible throughput on the bus... |
Beta Was this translation helpful? Give feedback.
-
Now up and running. So for future reference I can confirm that the library works well on a Raspberry Pi with an RS485 driver with auto TX/RX connected to one of the UARTs. However, also with this solution there is around 50ms delay between RX and TX from this device on the physical bus. Looking at the ModbusTool log below the response is within 1ms why I believe the actual delay is related to Linux output buffering. Not sure if that can be resolved, maybe it is possible to flush the buffer after each modbus message is sent?
The server I have configured is given Address 0x01. @serhmarch Do you have any idea why the traffic to and from the other server on the bus (address 0x0B) is generating an error? It's good to have all traffic in the log but I would rather expect the actual content to be ignored. Is this a bug maybe? |
Beta Was this translation helpful? Give feedback.
-
What is the value of the setting referring to - is it milliseconds or characters? The 3.5T should be fixed to 1.75ms for speeds >19200kbps so to follow the standard should that settiing be 1.75 then as my bus speed is 115200kbps? I was a bit puzzled by the default value of 50 when I created the port. I now found out that I can revert to the standard 1750us inter frame silence for the other nodes if I set the Inter-byte timeout to 1 (the GUI does not allow me to set it to 1.75). It's good that all traffic is analyzed and logged, that is just perfect for debugging. But the actual error that was reported I beleive should not really be there as the respons as far as I can understand is correct.
|
Beta Was this translation helpful? Give feedback.
-
Of course, as a "sniffer" there is no way to distinguish between TX and RX - did not think about that... For a better understanding I would appreciate if you can also comment on the the Timeout (inter byte) settings questions:
|
Beta Was this translation helpful? Give feedback.
-
You can try new version. Unnecessary error messages should disappear. |
Beta Was this translation helpful? Give feedback.
-
Great, thanks a lot. I will for sure try the new version but it will take a few weeks until I have access to that lab setup again. |
Beta Was this translation helpful? Give feedback.
-
I have been using a modbus simulator for Windows PC via an USB RS485 interface. This is not working very well as the delay in those interfaces are too long. I was then thinking to use a Raspberry PI with a RS485 chip like MAX485 conneced directly to the UART as it would have much less delay.
When I was looking for a Simulator tool that could run on Linux I found this repo that looks nice. But using such an interface it's also necessary to control the TX/RX direction using a dedicated GPIO. Do you have support for that? I have not found anyting being mentioned in the documentation.
Beta Was this translation helpful? Give feedback.
All reactions