Hall Polarity Calibration Illegal Hall State

I am following the “Getting started” instructions (THANK YOU!), and the hoverboard instructions in particular. I have successfully calibrated the motor, with no motor errors produced.

odrv0.axis0.requested_state = AXIS_STATE_MOTOR_CALIBRATION
odrv0.axis0.motor.config.pre_calibrated = True

Now i’m attempting Hall Encoder polarity calibration, but it consistently produces error code 0x0010 - ILLEGAL_HALL_STATE. I do have Hall Sensors. They are connected correctly. I’ve added filter caps to them. Now i have been reading through the firmware code looking for better clues.

The hub motor rotates about 1.25 turns during the calibration. With 15 pole-pairs, that should visit each of the 6 legal Hall states (of the 3-bit digital binary input) about 15*1.25 =~ 19 times. The Encoder::run_hall_polarity_calibration() code in encoder.cpp flags an error unless any Hall state it sees is seen at least 50 times. I believe that is why i’m getting the error.

The method seems to rely upon the default lockin config for the test, which is supposed to last 3 seconds. My calibration lasts about 3 seconds. That default config specifies a 40 radians/sec velocity, which is about 380 RPM. My motor is not turning anywhere near that fast. (That seems much faster than i expected). So i think i should expect about 18 wheel rotations, at a much faster rate ? That would be 108 occurrences of each Hall State, thus would pass the >50 test.

I tried upping odrv0.axis0.controller.config.vel_limit = 40, but that seemed to have no effect.

Am i correct to expect the wheel to turn faster ? Any clue why it isn’t ?

Hi Stephen, you can try setting encoder.config.hall_polarity_calibrated = True, or even ignore_illegal_hall_state = True, if there are no safety concerns.