Answered

`Checksum error in rtu mode` reading from Rover on Rpi4

Hello!  Following some of the other threads I was able to get some communication with my Rover via a Raspberry Pi, but I can't seem to get past the python error `minimalmodbus.InvalidResponseError: Checksum error in rtu mode:`


I get this using the solarshed module, or just a simple script directly with the minimalmodbus module (which solarshed uses).  Reading any register does some variation on this error (differ hex(?) output etc):


I found that solarshed is pinned to an earlier version of minimalmodbus.  I forced pip to upgrade to the newest of it (which now has the debug functionality) but still no change.


Here is one full example:

root@raspberrypi:~# python solar3.py 

MinimalModbus debug mode. Create serial port /dev/ttyUSB0

MinimalModbus debug mode. Will write to instrument (expecting 7 bytes back): '\x01\x03\x01\x01\x00\x01\xd46' (01 03 01 01 00 01 D4 36)

MinimalModbus debug mode. Clearing serial buffers for port /dev/ttyUSB0

MinimalModbus debug mode. No sleep required before write. Time since previous read: 1590615347279.03 ms, minimum silent period: 4.01 ms.

MinimalModbus debug mode. Response from instrument: '\x01\x03\x01\x01\x00\x01\xd4' (01 03 01 01 00 01 D4) (7 bytes), roundtrip time: 7.6 ms. Timeout for reading: 50.0 ms.


Traceback (most recent call last):

 File "solar3.py", line 12, in <module>

 test = instrument.read_register(257, 1)

 File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line 447, in read_register

 payloadformat=_PAYLOADFORMAT_REGISTER,

 File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line 1170, in _generic_command

 payload_from_slave = self._perform_command(functioncode, payload_to_slave)

 File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line 1244, in _perform_command

 response, self.address, self.mode, functioncode

 File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line 1756, in _extract_payload

 raise InvalidResponseError(text)

minimalmodbus.InvalidResponseError: Checksum error in rtu mode: '\x01\xd4' instead of 'I\xd4' . The response is: '\x01\x03\x01\x01\x00\x01\xd4' (plain response: '\x01\x03\x01\x01\x00\x01\xd4')

  • @Josh Gray, Great thank you for sharing this!


    Thank you,


  • This question is not answered
  • I take that back, I'm good now :)


  •  Josh, I am hitting a similar error.  Can you please share the fix and/or sample code?

    Thanks

  • I was able to read data by switching to the other data port and using a different python library.   I'll post a summary soon.


    1 person likes this
  • When you say 'other port' are you talking about hooking the USB cable up to the RS485 instead of the RS232?

  • Yeah, the one on the left.   Sorry I haven't gotten a chance to get my code off the pi.  Hopefully soon.

Login or Signup to post a comment