Error/Enable

The ERROR and ENABLE GPIOs on the ODrive provide a very simple interface to change and monitor the axis state with two digital signals. They are useful to complement other basic interfaces such as Step/Direction or PWM Input.

Note

ODrive Pro and S1 have a designated ERROR and ENABLE pins. If you need to use different GPIOs, or on ODrive Micro, you can manually assign any input GPIO to

Error Output

The ERROR output, when enabled, is high whenever there is any error condition or error status on the ODrive, that is, if any flags in active_errors or disarm_reason are set. It can be cleared by removing the error condition and calling clear_errors() through any interface or pulsing the ENABLE pin logic low (see below).

To use the ERROR output:

  1. Enable the GPIO: config.gpioX_mode = GpioMode.STATUS, where X is the ERROR GPIO number (see pinout). Needs a reboot to take effect.

  2. Set axis0.config.enable_error_gpio to True

Enable Input

When enabled, the ODrive’s ENABLE input allows to switch between IDLE and CLOSED_LOOP_CONTROL states.

Warning

The ENABLE input is not intended as an E-Stop. In particular, it can’t be used to abort calibration states, even the ones that move the motor.

To use the ENABLE input:

  1. Enable the GPIO: config.gpioX_mode = GpioMode.DIGITAL_PULL_DOWN or DIGITAL_PULL_UP or DIGITAL, where X is the ENABLE GPIO number (see pinout). Needs a reboot to take effect.

  2. If needed, change the polarity (axis0.enable_pin.config.is_active_high) and debounce delay (axis0.enable_pin.config.debounce_ms).

  3. Set axis0.enable_pin.config.enabled to true.

Functional description:

  • If the ODrive is in IDLE, a logical rising edge on ENABLE clears the errors and puts it into CLOSED_LOOP_CONTROL. This is equivalent to calling clear_errors() and then setting requested_state to CLOSED_LOOP_CONTROL.

  • If the ODrive is in CLOSED_LOOP_CONTROL, a logical “deasserted” state of ENABLE puts it into IDLE. This is equivalent to setting requested_state to IDLE.

This has the following implications:

  • When the ODrive boots or reboots while the ENABLE pin is already asserted, it will not immediately go into CLOSED_LOOP_CONTROL. In this case the ENABLE pin must be pulsed logic low first.

  • When the ODrive disarms the motor due to an error, the ENABLE pin must be pulsed logic low to clear the error and go back into CLOSED_LOOP_CONTROL.

  • In calibration states, the ENABLE input is ignored.

  • While the ENABLE input is held logic low, other interfaces (USB, CAN, UART, Web GUI) cannot be used to put the ODrive into CLOSED_LOOP_CONTROL.

  • If other interfaces are used to fetch more detailed error information, this must be done before deasserting ENABLE.