Motor + odrive will not turn

Hello, thank you all for taking the time to read this.
As of now I have the following parts to my setup.
Turnigy-Aerodive 5045-500kv
I have the latest odrive.
A 12v lipo battery/
The resistor that came with the odrive.
The CUI AMT102-V from the odrive store.
For some reason my motor will not turn when i type in the command odrv0.axis0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL.
It beeps and then just does nothing.
I did dump errors and it said the encoder failed.
Then i completely rebooted everything and got no errors. I ran the motor again with the same command and it beeped and nothing happened. I then did dump_errors(odrv0, True).
And it showed that axis0
axis: Error(s):
ERROR_INVALID_STATE
motor: no error
encoder: no error
controller: no error
axis1
axis: no error
motor: no error
encoder: no error
controller: no error
I think my encoder completely failed?
The gpio pins i put the encoder in were. Black into ground. green = z. red = b. white = a. yellow = 5v.
What should i do?

Now i tried odrv0.axis0.requested_state = AXIS_STATE_MOTOR_CALIBRATION. Because it seems like my encoder failed. The motor moved a little and then failed. It shows this
axis: Error(s):
ERROR_MOTOR_FAILED
motor: Error(s):
ERROR_PHASE_RESISTANCE_OUT_OF_RANGE

Internal resistance: **0.022 Ohm**
This is a very low resistance motor (is it a motor at all? :stuck_out_tongue: )

You may need to increase (or decrease??) motor.config.resistance_calib_max_voltage

I increased it and decreased it but nothing happened. It showed the same errors. I think the problem is that I used 4mm bullet connectors on a 3.5mm gauge wire and forgot to solder it. :crazy_face:. I will update later.

Oh, also try increasing (by a lot) calibration_current. Duh. I was obviously too tired to think of that yesterday.

I will try that. Thank you!

It didn’t even beep. Here is the following code.
In [26]: odrv0.axis0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL

In [27]: dump_errors(odrv0)
axis0
axis: Error(s):
ERROR_INVALID_STATE
motor: no error
encoder: no error
controller: no error
axis1
axis: no error
motor: no error
encoder: no error
controller: no error

In [28]: odrv0.axis0.motor.config.calibration_current = 100

In [29]: odrv0.axis0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL

In [30]: dump_errors(odrv0)
axis0
axis: Error(s):
ERROR_INVALID_STATE
motor: no error
encoder: no error
controller: no error
axis1
axis: no error
motor: no error
encoder: no error
controller: no error

In [31]: odrv0.axis0.motor.config.calibration_current = 1000

In [32]: odrv0.axis0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL

In [33]: dump_errors(odrv0)
axis0
axis: Error(s):
ERROR_INVALID_STATE
motor: no error
encoder: no error
controller: no error
axis1
axis: no error
motor: no error
encoder: no error
controller: no error
What should I do now?
I thought this would help.
In [7]: odrv0.axis0.encoder.config.use_index
Out[7]: False

I then did this.

In [8]: odrv0.axis0.motor.is_calibrated
Out[8]: False

In [9]: odrv0.axis0.requested_state = AXIS_STATE_STARTUP_SEQUENCE

In [10]: dump_errors(odrv0)
axis0
axis: no error
motor: no error
encoder: no error
controller: no error
axis1
axis: no error
motor: no error
encoder: no error
controller: no error

In [11]: odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE

In [12]: dump_errors(odrv0)
axis0
axis: Error(s):
ERROR_MOTOR_FAILED
motor: Error(s):
ERROR_PHASE_RESISTANCE_OUT_OF_RANGE
encoder: no error
controller: no error
axis1
axis: no error
motor: no error
encoder: no error
controller: no error

You need to reset errors, not just display them. Use
dump_errors(odrv0, True) or else you will get invalid state.

That’s why it didn’t try to calibrate the first time.
Go back to your initial steps where you increased calibration_current, but remember to clear the errors before you try to change state.

I reset the errors.
Here is the following code.

In [11]: dump_errors(odrv0)
axis0
axis: Error(s):
ERROR_INVALID_STATE
motor: no error
encoder: no error
controller: no error
axis1
axis: no error
motor: no error
encoder: no error
controller: no error

In [12]: dump_errors(odrv0, True)
axis0
axis: Error(s):
ERROR_INVALID_STATE
motor: no error
encoder: no error
controller: no error
axis1
axis: no error
motor: no error
encoder: no error
controller: no error

In [13]: dump_errors(odrv0, True)
axis0
axis: no error
motor: no error
encoder: no error
controller: no error
axis1
axis: no error
motor: no error
encoder: no error
controller: no error

In [14]: odrv0.axis0.motor.config.calibration_current = 2000

In [15]: odrv0.axis0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL

In [16]: dump_errors(odrv0)
axis0
axis: Error(s):
ERROR_INVALID_STATE
motor: no error
encoder: no error
controller: no error
axis1
axis: no error
motor: no error
encoder: no error
controller: no error

It did not move or beep.
All my connection are fine, thank you for helping me so far!

Ok, so I think the invalid_state is because the motor is not calibrated yet (or the ODrive thinks so). If you did calibration first, perhaps it would work then?
If it works after calibration, then you need to set up the index pulse properly.
set encoder.config.use_index=True, then run encoder_offset_calibration, then set encoder.config.pre_calibrated=True.
Also (optionally) set axis.config.startup_index_search
save_config then reboot.

If it worked, then the motor should turn by itself on boot until it finds the index pulse, after which it will enter closed loop.
If you didn’t set startup_index_search, then you need to turn the motor by hand by at least 1/2 rotation before you try to enter closed loop.

All of this is because the CUI encoder is incremental, so the ODrive can’t properly commutate until it has an absolute position reference (an index pulse). If you need to have it start up immediately on boot without any calibration or index search, then I’d recommend an absolute encoder such as AS5047P or AS5048A

1 Like

i have not been able to work with electronics so i may do that later.