Inability to home motor

Hi there,

I’m currently working on connecting a BLDC motor to a linear rail, and before I do this I’m ensuring that I can home the motor on the rail with a mechanical switch. I’m currently trying to home the motor but instead of the motor rotating the engage the switch, the function instantly throws a procedure 14 error (Not_Calibrated) instead.

I’m using the following equipment:
Controller - ODrive S1
Motor - BLDC Motor
Encoder - Absolute Encoder
and I’m programming the controller in Python.

I have repeatedly calibrated both the motor and the encoder and saved the configurations, using both the Full_Calibration_Sequence command, and individually calibrating the motor and encoder (using the Motor_Calibration and Encoder_Offset_Calibration commands). Running these calibration commands will consistently throw a procedure 5 error (Pole_Pair_CPR_Mismatch). Additionally, this error is only thrown after the encoder calibration and is not present during the motor calibration. I have a strong suspicion that this error is what is causing the procedure 14 error to be thrown during the homing function. Additionally, I have verified that the encoder seems to be reading the position of the motor correctly as I have been outputting the encoder position and it has lined up with the position of the rotor.

I’ve tried to chase down the procedure 5 error and I’m getting stuck. Since the encoder is an absolute encoder it seems like I can ignore the CPR value. I’ve also checked that I’m using the number of pole pairs, not poles, and this motor has 4 pole pairs.

Any advice on fixing the CPR Mismatch issue would be greatly appreciated. Thanks so much!

Hi!

the function instantly throws a procedure 14 error (Not_Calibrated) instead.

Yes, if the encoder calibration is failing / the ODrive doesn’t have a valid calibration, then it’ll refuse to operate. The question is definitely why the encoder calibration is failing here. You’re right that the CPR doesn’t matter here since it’s an absolute encoder, and I agree that’s definitely four pole pairs, so it comes down to either:

  • Encoder mounting/assembly issue
  • Too much load on / not enough current through the motor during calibration

First question – what does axis0.observed_encoder_scale_factor show after calibration fails? That’ll give you the mismatch between how much the ODrive expected the motor to move, versus how much it actually moved.

Encoder issue – those AMT21s can be a bit tricky to assemble. If there’s any slippage of the encoder on the shaft, then that could definitely be the cause.

Motor issue – what conditions are you doing calibration under? Does the motor have a load on it (gearbox, friction, some external force, etc), or is it completely free-spinning? What do you have for axis0.config.calibration_lockin.current? You may need to increase this to the motor’s maximum continuous current (looks like 0.8A for that motor, but you can push it higher to around 1A just for calibration). Increasing the current can help overcome any external load that’s throwing calibration off.

Last thing – feel free to share all the setup commands you’re running, and/or run odrivetool backup-config config.json to dump the full config and paste it here.