CRC-7 usage on Maestro and Python 2.x

Hi People
I am new to this forum. I fiddling with a maestro 12 (Firmware 1.03) using Python 2.7 on Windows, Mac and Linux. The controller works perfectly with Python as long as I don’t activate the CRC check. I modified the python code provided here. When I activate CRC on the controller (via control panel) and try to send the message with the additional CRC attached, the maestro gets red.

Example 1 (no CRC activated) asking for the position of servo 0 on board 01:
I send the sequence AAh/01h/10h/00h … thats works perfectly
Example 2: Then I try to do the same with activated CRC: AAh/01h/10h/00h/0Dh 0Dh being the CRC-7 of the command 10h/00h. The controller shows me a red LED :frowning:

My question: The CRC is only calculated for the command itself, not for servo-address, board Nr or even the AAh sync? Right? I think I got the CRC-7 implementation on Python right, at least it gives the same results as the C code you provide on your homepage.
What could be the problem? I want the CRC because that gives me more robustness of the communication…
Thanks a lot
Bruno

Hello, Bruno.

Welcome to our forum!

The CRC byte should be calculated for the entire command packet (e.g. [0xAA, 0x01, 0x10, 0x00]), so the 8-bit CRC-7 byte should be 0x6B. (You might find it easier to use our Pololu Serial Transmitter Utility to verify that you’re sending the correct 8-bit CRC-7 byte for your command packet.) Which C code are you referring to? Can you provide a link to it? Can you post your modified version of maestro.py?

- Amanda

Dear Amanda
Now it works! Thanks a lot for your fast response! The example in the user manual 5.d. misled me to add a CRC to the actual command only (without AA and Device Nr). I did try the whole command too, but at that time my CRC code was probably buggy. Now it works.
The C-Code I was referring to was this one (the simple one). I am a lousy coder, but my version with optional CRC-checking of maestro.py and an example is here (The now working code)

2 Likes