ODrive Documentation

High performance motor control

View the Project on GitHub madcowswe/ODrive

Help improve these docs: submit edits using the link in the top right.

If you need help, please search or ask the ODrive Community.


Table of Contents:

Error codes

If your ODrive is not working as expected, run odrivetool and type dump_errors(odrv0) Enter. This will dump a list of all the errors that are present. To also clear all the errors, you can run dump_errors(odrv0, True).

The following sections will give some guidance on the most common errors. You may also check the code for the full list of errors:

Common Axis Errors

You tried to run a state before you are allowed to. Typically you tried to run encoder calibration or closed loop control before the motor was calibrated, or you tried to run closed loop control before the encoder was calibrated.

Confirm that your power leads are connected securely. For initial testing a 12V PSU which can supply a couple of amps should be sufficient while the use of low current ‘wall wart’ plug packs may lead to inconsistent behaviour and is not recommended.

You can monitor your PUS voltage using liveplotter in odrive tool by entering start_liveplotter(lambda: [odrv0.vbus_voltage]). If you see your votlage drop below ~ 8V then you will trip this error. Even a relatively small motor can draw multiple kW momentary and so unless you have a very large PSU or are running of a battery you may encounter this error when executing high speed movements with a high current limit. To limit your PSU power draw you can limit your motor current and/or velocity limit odrv0.axis0.controller.config.vel_limit and odrv0.axis0.motor.config.current_lim.

Confirm that you have a brake resistor of the correct value connected securly and that odrv0.config.brake_resistance is set to the value of your brake resistor.

You can monitor your PUS voltage using liveplotter in odrive tool by entering start_liveplotter(lambda: [odrv0.vbus_voltage]). If during a move you see the voltage rise above your PSU’s nominal set voltage then you have your brake resistance set too low. This may happen if you are using long wires or small gauge wires to connect your brake resistor to your odrive which will added extra resistance. This extra resistance needs to be accounted for to prevent this voltage spike. If you have checked all your connections you can also try increasing your brake resistance by ~ 0.01 Ohm at a time to a maximum of 0.05 greater than your brake resistor value.

Common Motor Errors

During calibration the motor resistance and inductance is measured. If the measured motor resistance or inductance falls outside a set range this error will be returned. Check that all motor leads are connected securely.

The measured values can be viewed using odrivetool as is shown below:

In [2]: odrv0.axis0.motor.config.phase_inductance
Out[2]: 1.408751450071577e-05

In [3]: odrv0.axis0.motor.config.phase_resistance
Out[3]: 0.029788672924041748

Some motors will have a considerably different phase resistance and inductance than this. For example, gimbal motors, some small motors (e.g. < 10A peak current). If you think this applies to you try increasing odrv0.axis0.motor.config.resistance_calib_max_voltage from its default value of 1 using odrivetool and repeat the motor calibration process. If your motor has a small peak current draw (e.g. < 20A) you can also try decreasing odrv0.axis0.motor.config.calibration_current from its default value of 10A.

In general, you need

resistance_calib_max_voltage > calibration_current * phase_resistance
resistance_calib_max_voltage < 0.5 * vbus_voltage

The ODrive v3.4 is known to have a hardware issue whereby the motors would stop operating when applying high currents to M0. The reported error of both motors in this case is ERROR_DRV_FAULT.

The conjecture is that the high switching current creates large ripples in the power supply of the DRV8301 gate driver chips, thus tripping its under-voltage fault detection.

To resolve this issue you can limit the M0 current to 40A. The lowest current at which the DRV fault was observed is 45A on one test motor and 50A on another test motor. Refer to this post for instructions for a hardware fix.

The bus voltage was insufficent to push the requested current through the motor. If you are getting this during motor calibration, make sure that motor.config.resistance_calib_max_voltage is no more than half your bus voltage.

For gimbal motors, it is recommended to set the motor.config.calibration_current and motor.config.current_lim to half your bus voltage, or less.

Common Encoder Errors

Confirm you have entered the correct count per rotation (CPR) for your encoder. Note that the AMT encoders are configurable using the micro-switches on the encoder PCB and so you may need to check that these are in the right positions. If your encoder lists its pulse per rotation (PPR) multiply that number by four to get CPR.

Confirm that your encoder is plugged into the right pins on the odrive board.

Check that your encoder is a model that has an index pulse. If your encoder does not have a wire connected to pin Z on your odrive then it does not output an index pulse.

USB Connectivity Issues

Firmware Issues

Failure to build the firmware when running make

Failure to flash the firmware when running make flash

Other issues that may not produce an error code

Motor cuts off or spins uncontrollably at high rotational speeds (ie: > 5000 RPM)

Motor vibrates when stationary or makes constant noise

Motor overshoots target position or oscillates back and forth

Motor slowly starts to increase in speed

Motor feels like it has less torque than it should and/or gets hot sitting still while under no load.

False steps or direction changes when using step/dir