# Motor will not spin after calibration attempts

**URL:** <https://discourse.odriverobotics.com/t/motor-will-not-spin-after-calibration-attempts/9275>\
**Category:** Support\
**Created:** [June 6, 2022, 4:10am UTC](https://discourse.odriverobotics.com/t/motor-will-not-spin-after-calibration-attempts/9275 "2022-06-06T04:10:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ampere](https://discourse.odriverobotics.com/letter_avatar_proxy/v4/letter/a/bb73d2/32.png) [@Ampere](https://discourse.odriverobotics.com/u/Ampere)\
**Post date:** [June 6, 2022, 4:10am UTC](https://discourse.odriverobotics.com/t/motor-will-not-spin-after-calibration-attempts/9275/1 "2022-06-06T04:10:42Z")

</div>

Hello, I am having some trouble using setting the velocity of a motor connected to an ODrive Pro.

The motor I am using, the [GARTT ML5210](https://www.amazon.com/GARTT-Brushless-Multirotor-Quadcopter-Hexacopter/dp/B072KN2KNW), does work during the initial calibration – it does one full rotation clockwise, then stops – however, the ODrive Pro seems to refuse to service any commands that control the motor after this calibration sequence completes.

Here is the Python script I wrote:

```nohighlight
import odrive
from odrive.enums import *
from time import sleep
from fibre.libfibre import ObjectLostError

class ODrive_Control:
    def __init__ (self, motor_kv):
        self.odrive = odrive.find_any()
        self.motor_kv = motor_kv
    
    def perform_calibration(self):
        # Erase configuration, reboot.
        try:
            self.odrive.erase_configuration()
        except ObjectLostError:
            pass
        
        self.odrive = odrive.find_any()

        # This is where the manually defined parameters will go.
        self.odrive.axis0.motor.config.motor_type = MOTOR_TYPE_HIGH_CURRENT
        self.odrive.axis0.motor.config.torque_constant = 8.27 / self.motor_kv
        self.odrive.axis0.controller.config.vel_limit = 20
        self.odrive.axis0.controller.input_torque = 0.1
        self.odrive.axis0.motor.config.requested_current_range = 100
        self.odrive.axis0.controller.config.vel_gain = 0.02 * self.odrive.axis0.motor.config.torque_constant
        self.odrive.axis0.controller.config.input_mode = INPUT_MODE_PASSTHROUGH

        # Perform automatic motor calibration.
        self.odrive.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE

        while self.odrive.axis0.current_state != AXIS_STATE_IDLE:
            pass
        
        # Save, reboot.
        try:
            self.odrive.save_configuration()
        except ObjectLostError:
            pass

        self.odrive = odrive.find_any()

    def set_axis_state(self, axis, state):
        if axis.requested_state is not state:
            axis.requested_state = state
    
    def set_axis_control_mode(self, axis, mode):
        if axis.controller.config.control_mode is not mode:
            axis.controller.config.control_mode = mode

    def set_position(self, newPosition=0):
        self.set_axis_state(self.odrive.axis0, AXIS_STATE_CLOSED_LOOP_CONTROL)
        self.set_axis_control_mode(self.odrive.axis0, INPUT_MODE_POS_FILTER)
        self.odrive.axis0.controller.input_pos = newPosition

    def set_velocity(self, newVelocity=0):
        self.set_axis_state(self.odrive.axis0, AXIS_STATE_CLOSED_LOOP_CONTROL)
        self.set_axis_control_mode(self.odrive.axis0, CONTROL_MODE_VELOCITY_CONTROL)
        self.odrive.axis0.controller.input_vel = newVelocity

    def reboot(self):
        self.__do_safe_call(self.odrive.reboot())
        self.odrive = odrive.find_any()

m = ODrive_Control(340)
print(f'Performing calibration on {m}...')
m.perform_calibration()
m.set_velocity(5)

```

Checking the error state via `odrivetool` shows the following:

```auto
In [1]: dump_errors(odrv0)
system: no error
axis0
  axis: no error
  motor: Error(s):
    MOTOR_ERROR_UNKNOWN_TORQUE
    MOTOR_ERROR_UNKNOWN_VOLTAGE_COMMAND
  sensorless_estimator: no error
  encoder: not found
  controller: not found

```

For reference, I am powering it with a 24VDC power supply that can supply up to a maximum of 1 Ampere (for testing purposes).

So, yeah. I am at a loss. If anyone could possibly steer me in the right direction, I would extremely appreciate it. If not, hopefully someone may stumble across this in the future and find an answer they’re looking for.

---

<div class="post-metadata">

**Author:** ![TeunD](https://discourse.odriverobotics.com/letter_avatar_proxy/v4/letter/t/dfb087/32.png) [@TeunD](https://discourse.odriverobotics.com/u/TeunD)\
**Post date:** [June 7, 2022, 3:35pm UTC](https://discourse.odriverobotics.com/t/motor-will-not-spin-after-calibration-attempts/9275/2 "2022-06-07T15:35:21Z")

</div>

I had a similar problem (torque mode not working) the solution that I found, witch some help, can be found here: [No torque in torque mode - #49 by TeunD](https://discourse.odriverobotics.com/t/no-torque-in-torque-mode/5696/49). Maybe it gives you some ideas or things to try.

---

<div class="post-metadata">

**Author:** ![Ampere](https://discourse.odriverobotics.com/letter_avatar_proxy/v4/letter/a/bb73d2/32.png) [@Ampere](https://discourse.odriverobotics.com/u/Ampere)\
**Post date:** [June 7, 2022, 6:30pm UTC](https://discourse.odriverobotics.com/t/motor-will-not-spin-after-calibration-attempts/9275/3 "2022-06-07T18:30:56Z")

</div>

Thank you for your response! Unfortunately this didn’t seem to do the trick.

However, I did a deeper dive and found that the motor actually returns the following error in `odrivetool` (after updating to the dev branch):

```auto
In [1]: dump_errors(odrv0)
system: no error
axis0
  error: no error
  procedure_result: ProcedureResult.NO_RESPONSE
  last_drv_fault: none

```

I went to read the documentation and didn’t find any indication of what this means, however, so I’m a bit confused. But, since the motor should turn in both directions, it seems as if the calibration failed and then threw this error.

---

<div class="post-metadata">

**Author:** ![Wetmelon](https://discourse.odriverobotics.com/user_avatar/discourse.odriverobotics.com/wetmelon/32/10_2.png) [@Wetmelon](https://discourse.odriverobotics.com/u/Wetmelon)\
**Post date:** [June 13, 2022, 1:57am UTC](https://discourse.odriverobotics.com/t/motor-will-not-spin-after-calibration-attempts/9275/4 "2022-06-13T01:57:33Z")

</div>

No response means the encoder is not sending any data to the ODrive. Please make sure it’s plugged in correctly, has power, and the ODrive is in the correct mode.

---

<div class="post-metadata">

**Author:** ![Ampere](https://discourse.odriverobotics.com/letter_avatar_proxy/v4/letter/a/bb73d2/32.png) [@Ampere](https://discourse.odriverobotics.com/u/Ampere)\
**Post date:** [June 13, 2022, 9:51pm UTC](https://discourse.odriverobotics.com/t/motor-will-not-spin-after-calibration-attempts/9275/5 "2022-06-13T21:51:54Z")

</div>

Thank you for the response! I solved the issue a few days ago and forgot to respond here, but it was indeed due to the encoder. Once I fixed it and calibrated it, the motor worked like a charm.
