Hi Guys,
I’m getting consistent errors when trying to read the encoders attached to a single motor on a RoboClaw 10A. I’m using packet serial mode, and I’m fairly sure everything’s wired up correctly.
My sequence of events is:
-
Transmit command 35(Decimal) to drive motor M1 forwards using the encoder at a velocity appropriate for the motor.
-
Transmit command 16(Decimal) to query the encoder register:
80 10
-
Receive response:
00 00 00 06 80 16
The first four bytes are my encoder value (this motor is rotating very slowly - only 6 pulses in this example). The status is OK since bit 7 of byte 5 is set. The CRC is returned as 16.
Is this correct?
From the RoboClaw documentation, the CRC should be:
0x00 + 0x00 + 0x00 + 0x06 + 0x80 = 0x86 & 0x7F = 0x06
I’m pretty good at missing the obvious, so it’s likely I’m doing just that. Is the above calculation correct?
Under what circumstances could I be getting a CRC error? My wiring is very short and I’d be very surprised if this was a legitimate noise-related error since the incorrect CRC is consistent (i.e. every query).
Guidance much appreciated!