Re: Invalid CRC in request

1,406 views
Skip to first unread message

Ossi Syri

unread,
Feb 15, 2013, 5:08:33 AM2/15/13
to modb...@googlegroups.com



I have tried to modify RTS delay (http://www.spinics.net/lists/linux-serial/msg08458.html) with no success. What is wrong in my setup?

BR ossi

I mean I have managed to bodify  RTS delay with success but it has not affected on a Modbus RTU and CRC problem.

BR ossi

Ossi Syri

unread,
Feb 15, 2013, 5:49:09 AM2/15/13
to modb...@googlegroups.com

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 have tried to modify RTS delay (http://www.spinics.net/lists/linux-serial/msg08458.html) with no success. What is wrong in my setup?

BR ossi


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

Luc JEAN

unread,
Feb 15, 2013, 8:09:49 AM2/15/13
to modb...@googlegroups.com
Hello Ossi,

Unfortunately I don't have ideas about this issue. I would recommend to look at PySerial. modbus_tk relies on it for serial communication.

Best
luc

2013/2/15 Ossi Syri <ossi...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "modbus-tk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modbus-tk+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ossi Syri

unread,
Feb 19, 2013, 3:07:25 PM2/19/13
to modb...@googlegroups.com
Problem solved. It was stupid easy. Cable was connected with crossed way. I took a mistake because line responsed something when requesting.

-ossi
Reply all
Reply to author
Forward
0 new messages