ILLEGAL_HALL_STATE ODrive S1

Salutations!

I am attempting to get a motor working with the Odrive S1 and have run into the dreaded “Illegal Hall state” error.

Plotting the hall signals in “ODrive” I get the result:
|1|0001|
|3|0011|
|2|0010|
|6|0110|
|4|0100|
|5|0101|
Which looks like a valid hall signal to me. I have also looked at the signals on a scope and they are rock solid edges and look clean during calibration.

This is the motor I am attempting to use: (Model 539480)

odrv = odrv0
odrv.config.dc_bus_overvoltage_trip_level = 30
odrv.config.dc_bus_undervoltage_trip_level = 10.5
odrv.config.dc_max_positive_current = 5
odrv.config.brake_resistor0.enable = True
odrv.config.brake_resistor0.resistance = 2
odrv.axis0.config.motor.motor_type = MotorType.GIMBAL
odrv.axis0.config.motor.phase_resistance = 0.225
odrv.axis0.config.motor.phase_resistance_valid = True
odrv.axis0.config.motor.torque_constant = 0.011882183908045976
odrv.axis0.config.motor.pole_pairs = 4
odrv.axis0.config.motor.current_soft_max = 4
odrv.axis0.config.motor.current_hard_max = 7.2
odrv.axis0.config.motor.calibration_current = 1
odrv.axis0.config.motor.resistance_calib_max_voltage = 12
odrv.axis0.config.calibration_lockin.current = 0.5
odrv.axis0.controller.config.control_mode = ControlMode.VELOCITY_CONTROL
odrv.axis0.controller.config.input_mode = InputMode.VEL_RAMP
odrv.axis0.controller.config.vel_ramp_rate = 0.1
odrv.axis0.controller.config.vel_limit = 100
odrv.axis0.controller.config.vel_limit_tolerance = 20
odrv.axis0.config.torque_soft_min = -0.7
odrv.axis0.config.torque_soft_max = 0.7
odrv.axis0.config.encoder_bandwidth = 100
odrv.hall_encoder0.config.enabled = True
odrv.axis0.config.load_encoder = EncoderId.HALL_ENCODER0
odrv.axis0.config.commutation_encoder = EncoderId.HALL_ENCODER0

Hi,

The most common reason for your situation is when electrical noise makes a sample read 000 or 111. This will cause this error even if it’s only seen once.
Can you show a picture of how you have the motor phases and hall signals wired up?
Thanks!

I ended up solving it last night, but I didn’t see this solution anywhere online so I figured it may help other people out:

Calibration current was high enough to make it wiggle (and in my testing, enough to make it spin when manually driving it open loop) but was just slightly too low to cog the motor. This meant that the hall sensors (sometimes) never changed value during calibration.

But, if I set the current too high or the voltage too high, it faults out due to “Phase Inductance”. (I settled on 3A calibration current at 5V. 6V and 4V throw errors, 4A and 2A throw errors.)

Now I am dealing with tuning the motor. If the RPM goes above about 150rpm it suddenly goes to like 400rpm and gets stuck there. (Regardless of RPM limit.) but if I set the hard limit below 150rpm, then it nuisance faults.

TL:DR, If the hall sensors don’t change value, that can also cause this error apparently. (Might be worth adding to documentation? Maybe I missed it.) and I am now on to tuning the motor with some interesting behavior.

1 Like

Oh ok thank you for that, we’ll take a look on better reporting errors for the case when the hall calibration fails because the motor didn’t sufficiently move.

1 Like