ODrive not completing calibration sequence & motor error 0x11

Motor: https://hobbyking.com/en_us/turnigy-c580l-580kv-brushless-inrunner-motor-4000w.html

Encoder: https://www.digikey.com/product-detail/en/cui-inc/AMT102-V/102-1307-ND/827015

Brake Resistor:

https://www.mouser.com/ProductDetail/ARCOL-Ohmite/HS50-1R-F?qs=bvCpHSZmQjnH%2bJp5QsKn8A%3D%3D

Odrive: 3.5 24V

I’ve looked up the motor error “0x11” on the forums, but nothing has really seemed to better the situation. The motor used to partially run when “odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE” was entered, but it was very inconsistent. Meaning it would maybe turn once out of every 3 times it was entered. Also it only ever turned in one direction, and then stop. Not both directions as it should have.

Then it stopped turning all together after trying to fix that issue.

All I’m getting now is a very small twitch at the beginning and then it stops and outputs error 0x40 & motor error 0x11 from which I understand is ERROR_CONTROL_DEADLINE_MISSED and ERROR_PHASE_RESISTANCE_OUT_OF_RANGE.

Any ideas on how to go about this, it would be greatly appreciated.

Most of my configs & errors are below.

Thank you!

In [208]: odrv0.vbus_voltage
Out[208]: 12.132494926452637

In [209]: odrv0.axis0.motor.config.current_lim
Out[209]: 75.0

In [210]: odrv0.axis0.motor.config.requested_current_range
Out[210]: 90.0

In [211]: odrv0.axis0.controller.config.vel_limit
Out[211]: 40000.0

In [212]: odrv0.axis0.motor.config.calibration_current
Out[212]: 50.0

In [213]: odrv0.config.brake_resistance
Out[213]: 1.0

In [214]: odrv0.axis0.motor.config.pole_pairs
Out[214]: 12

In [215]: odrv0.axis0.motor.config.motor_type
Out[215]: 0

In [216]: odrv0.axis0.encoder.config.cpr
Out[216]: 8192

In [217]: odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQENCE

In [218]: hex(odrv0.axis0.error)
Out[218]: ‘0x40’

In [219]: hex(odrv0.axis0.motor.error)
Out[219]: ‘0x11’

In [222]: hex(odrv0.axis0.encoder.error)
Out[222]: ‘0x0’

In [223]: odrv0.axis0.motor.config.phase_inductance
Out[223]: 0.0

In [224]: odrv0.axis0.motor.config.phase_resistance
Out[224]: 0.04754049703478813

In [225]: odrv0.axis0.motor.current_control.p_gain
Out[225]: 0.0

In [226]: odrv0.axis0.motor.current_control.i_gain
Out[226]: nan

In [228]: odrv0.axis0.motor.config.resistance_calib_max_voltage
Out[228]: 2.0

In [230]: odrv0.axis0.config
Out[230]:
startup_motor_calibration = False (bool)
startup_encoder_index_search = False (bool)
startup_encoder_offset_calibration = False (bool)
startup_closed_loop_control = False (bool)
startup_sensorless_control = False (bool)
enable_step_dir = False (bool)
counts_per_step = 2.0 (float)
ramp_up_time = 0.4000000059604645 (float)
ramp_up_distance = 12.566370964050293 (float)
spin_up_current = 10.0 (float)
spin_up_acceleration = 400.0 (float)
spin_up_target_vel = 400.0 (float)

In [231]: odrv0.axis0.motor.config
Out[231]:
pre_calibrated = False (bool)
pole_pairs = 12 (int)
calibration_current = 50.0 (float)
resistance_calib_max_voltage = 2.0 (float)
phase_inductance = 0.0 (float)
phase_resistance = 0.04754049703478813 (float)
direction = 1 (int)
motor_type = 0 (int)
current_lim = 75.0 (float)
requested_current_range = 90.0 (float)
current_control_bandwidth = 1000.0 (float)

In [232]: odrv0.axis0.encoder.config
Out[232]:
mode = 0 (int)
use_index = True (bool)
pre_calibrated = False (bool)
idx_search_speed = 10.0 (float)
cpr = 8192 (int)
offset = 0 (int)
offset_float = 0.0 (float)
bandwidth = 1000.0 (float)
calib_range = 0.019999999552965164 (float)

Hi,
did you try to calibrate the motor with lower values of current_lim, calibration_current?

The first time I connected my ODrive and motor I also had the problem it was turning in only one direction. It turned out to be a faulty encoder connection. One of the wires came loose of the connector.

@greenfield932 @Robin I followed your advice and rewired the encoder and lowered the current_lim to 20 and the calibration_current to 15, and now it spins!

Only problem is it only spins clockwise and doesn’t stop when the Z axis isn’t connected to the ODrive. When the Z axis is connected, it spins in one direction for a minute or two, stops, and then outputs the following errors:

In [8]: hex(odrv0.axis0.error)
Out[8]: ‘0x100’

In [9]: hex(odrv0.axis0.motor.error)
Out[9]: ‘0x0’

In [10]: hex(odrv0.axis0.encoder.error)
Out[10]: ‘0x4’

According to the error document:
ERROR_NO_RESPONSE = 0x04 (encoder)

Any ideas on what could be the problem with this?

@citrik,
It seems encoder is a problem.
Check voltage on encoder pins. My suggestion is to connect oscilloscope to the encoder A/B and check signal while rotating shaft manually. If you have no oscilloscope you can also try with frequency meter on cheap multimeter and check there is some frequency changes depending on rotating shaft speed, but I didn’t try it.

I suggest to try calibration without Z index first (set do not use Z in config). Calibration usually takes a few seconds, motor spins approximately one revolution to each direction.
Also make sure encoder connected properly and CPR value is correct.
There is useful information about encoders CPR (https://docs.odriverobotics.com/)
It seems your encoder is programmable, so check what is default CPR if you did not program the encoder.
Make sure you connected encoder to the axis0 and not axis1.

@greenfield932
We checked the voltage on the encoder pins and this is the waveform we got:

https://imgur.com/gp07AUh

This is with A on positive and B on negative.

So it seems to be working?
But still only spins in one direction endlessly. CPR values are correct and the encoder’s DIP switch is in the right positions for our values we put on the ODrive. It is connected to axis0 as well.

https://www.digikey.com/product-detail/en/cui-inc/AMT102-V/102-1307-ND/827015

We currently have the DIP switch all off (2048 PPR) and set the CPR to 8192 in ODrive.

Any ideas?
Thank you for your patience and help!

@citrik,
did you try with disabled Z index search in config?

@greenfield932 ,
Sorry for the late reply.

We disabled the Z index search, which changed the behavior. Now it is giving us two rotations clockwise and the it will just stop.
Encoder error is now “0x02”
Played around with the encoder numbers but nothing seemed to change.

Lost, yet again.

Encoder error 0x2 means that you have set the encoder.config.cpr, or motor.config.pole_pairs incorrectly. What value do you have for either? Do you know that they are correct?