I can see your problem: You have used the wrong pins. You should use A/B/I for A/B/Z. The U/V/W pins are for a different function (Hall sensor emulation mode)
However, I would strongly recommend that you try out the absolute SPI mode of this encoder, using the latest 0.5.1 firmware. Having an absolute encoder allows you to do the calibration only once. You won’t need to re-calibrate anything on start-up.
As per another thread, these encoders can come with different CPR configured for the incremental (ABI) output.
Try setting encoder.config.cpr to 2048, 4096, 4000, 8192, 8000 and see if any of those settings work.
If you run encoder.set_linear_count(0) and then turn the motor by hand exactly one turn, you should be able to see the correct CPR in encoder.shadow_count
I set the current position to 0 with encoder.set_linear_count(0).
Save, reboot.
After the reboot says “no error”.
I run the odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE
The device is beeping and starts to turn LEFT faster, then RIGHT slower and finally STOP.
AND every time the final standing the… (It’s good.)
Ok, It’s so cool. I run a dump_errors(odrv0, True).
Firstly, it says: oh no, there is error but secound run, it says everythings alright…
No, you are still getting a cpr out of range error, even though it almost passed calibration. You reset the error with the ‘True’ argument, but you still need to re-run the calibration until there is no error immediately afterwards.
Did you try setting encoder.config.cpr to 2048 instead of 2000?
Yes, I tried. I tried with 1000, 1500, 2000, 2048, 4000, 4096, but it doesn’t work with 4000+.
The datasheet of the Encoder says that the max PPR is 500 (it is the default value), so the CPR is max 2000.
So, Finally.
I succefully calibrated the ODrive.
I need 3 important settings.
CPR is 2007 (factory maximum is 2000 so it’s very interesting…)
calibration_current is 30
pole_pairs is 11 (same, I counted 24db so it’s 12 pairs but ok…)
glad you got it working. This thread was very helpful for me also. Mine came set to 2000 cpr out of the packet. i think it was probably the pole pairs that was the issue for u.