Hall polarity calibration returns INVALID_STATE

I’m attempting to set up an ODrive with a 250W eBike motor.

I’ve tried following several examples, including the ODrive documentation for hoverboard motors:

https://docs.odriverobotics.com/v/0.5.6/hoverboard.html#calibration-and-powering-the-motor

I’ve adjusted the numbers as appropriate based on the estimated specs of my motor. I’ve had some success, the motor calibration causes a beep and returns no errors, and if I type:

odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE

The motor turns slowly in both directions.

The encoder appears to be working too:

odrv0.axis0.encoder.hall_state returns a number from 1 to 6 as I turn the motor by hand.

odrv0.axis0.encoder.shadow_count returns an absolute position that goes up and down as expected as I rotate the motor.

So I believe the hall sensors are doing their job, and being read and counted by the ODrive.

However, when I run:

odrv0.axis0.requested_state = AXIS_STATE_ENCODER_HALL_POLARITY_CALIBRATION

I get an INVALID_STATE error. It returns immediately, with no attempt to move the motor. dump_errors(odrv0) returns:

system: not found
axis0
  axis: Error(s):
    AxisError.INVALID_STATE
  motor: no error
  DRV fault: not found
  sensorless_estimator: no error
  encoder: no error
  controller: no error
axis1
  axis: no error
  motor: no error
  DRV fault: not found
  sensorless_estimator: no error
  encoder: no error
  controller: no error

Full disclosure, I’m using a single channel ‘V4.2’ board, which I now understand to be a closed-source knockoff with who-knows-what firmware running on it. I bought it in good faith but accept this might be the reason for my troubles.

However if there’s some other cause of the above, I’d like to know. Thanks.

Usually this is due to EMI issues - the knockoff board probably has something to do with it :slight_smile: you could try enabling ignore_illegal_hall_state, but other than that there’s likely not much you can do.

Thanks for the suggestion, I’d actually already tried that following some earlier forum-browsing.

I’m doubtful of the EMI hypothesis because the encoder appears to work perfectly to the extent that I can probe it. If I run:

odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE

The motor rotates slowly in both directions, and while it is doing so I can repeatedly type: odrv0.axis0.encoder.shadow_count and see the count smoothly decease to -150 and back to 0.

But when I try to run the hall calibration as described above, it fails without even powering the motor. To me it seems more likely that there’s some parameter setting preventing it from entering the required state.

Ugh yeah no clue, unfortunately probably some fuckup with their board design. Or maybe their stock firmware is so damn old it just can’t do the hall calibration? I realize it says INVALID_STATE and not INVALID_HALL_STATE – I’m guessing their firmware version is 0.5.1 or something. Probably out of luck, maybe you could get it working but I honestly don’t know. I’d recommend getting an ODrive S1 :slight_smile:

It reports firmware version 0.0.0 so no help there!.. Hardware versions reports 3.6.56.

Another clue is that is doesn’t have config.enable_brake_resistor, which I think was introduced at introduced at FW 0.5.2.

Will definitely consider an S1 / Pro next time!