On Thursday, February 14, 2013 11:25:28 PM UTC+2, Ossi Syri wrote:
Hello, and thanks for handy Modbus_tk software!
I have tried rtumaster and rtuslave configuration through RS485 Bus. I have got a "Invalid CRC in request" problem when using rtuslave. What can be root cause of problem? And can anybody see something to be corrected when looking at partly received response seen below?
I am able to use rtumaster with other rtu device without problem:
/ # python2.7 examples/rtumaster_example.py
2008-01-08 22:15:36,463 INFO modbus_rtu.__init__ MainThread RtuMaster /dev/ttyS3 is opened
2008-01-08 22:15:36,508 INFO rtumaster_example.<module> MainThread connected
2008-01-08 22:15:36,540 DEBUG modbus.execute MainThread -> 2-3-0-53-0-3-21-246
2008-01-08 22:15:36,624 DEBUG modbus.execute MainThread <- 2-3-6-0-0-9-226-0-0-150-47
2008-01-08 22:15:36,647 INFO rtumaster_example.<module> MainThread (0, 2530, 0)
But when I set up modbus_tk as rtuslave, I get "Invalid CRC in request".
/ # python2.7 examples/rtumaster_example.py
2013-02-15 00:13:14,900 INFO modbus_rtu.__init__ MainThread RtuMaster /dev/ttyS2 is opened
2013-02-15 00:13:14,920 INFO rtumaster_example.<module> MainThread connected
2013-02-15 00:13:14,934 DEBUG modbus.execute MainThread -> 2-3-0-100-0-1-197-230
2013-02-15 00:13:20,038 DEBUG modbus.execute MainThread <- 238-255
Traceback (most recent call last):
File "examples/rtumaster_example.py", line 32, in <module>
logger.info(master.execute(2, cst.READ_HOLDING_REGISTERS, 100, 1))
File "/build/lib/modbus_tk/utils.py", line 26, in new
raise excpt
modbus_tk.modbus.ModbusInvalidResponseError: Response length is invalid 2
On a slave:
handle request failed: Invalid CRC in request
RS485 bus itself receives something corrupted data as seen above. When I shutdown rtuslave, response seems empty:
/ # python2.7 examples/rtumaster_example.py
2013-02-15 00:17:20,406 INFO modbus_rtu.__init__ MainThread RtuMaster /dev/ttyS2 is opened
2013-02-15 00:17:20,425 INFO rtumaster_example.<module> MainThread connected
2013-02-15 00:17:20,440 DEBUG modbus.execute MainThread -> 2-3-0-100-0-1-197-230
2013-02-15 00:17:25,464 DEBUG modbus.execute MainThread <-
Traceback (most recent call last):
File "examples/rtumaster_example.py", line 32, in <module>
logger.info(master.execute(2, cst.READ_HOLDING_REGISTERS, 100, 1))
File "/build/lib/modbus_tk/utils.py", line 26, in new
raise excpt
modbus_tk.modbus.ModbusInvalidResponseError: Response length is invalid 0
I do reply again. I tried also modbus_tk RTU slave with standard RTU master, and CRC exception arised.
So conclusion of my tests is:
Standard RTU master Modbus_tk RTU master
Standard RTU slave | OK | OK
Modbus_tk RTU slave | CRC | CRC
So, my device with Modbus_tk RTU slave arises CRC exception. I think that partly responsed data seen below is very strange allthough CRC exception has arised. I guess problem is something concerning to RTS levels or delays. Does anybody have a experiences? Boards are Atmel at91's and has mostly vanilla 2.6.38 linux kernel.
BR ossi