ODrive Firmware Deployment System

Warning

The DFU system described on this page is currently under beta testing and not intended for production use yet. During the beta phase, physical access to the ODrive may be required to recover from unexpected issues.

Feedback

Running into issues? Instructions unclear? Or everything working smoothly? We’re happy to hear your feedback on Discord or this form!

Note

The new DFU system described on this page cannot be used to install firmware older than v0.6.5. If you need to install older firmware, you need to uninstall the new bootloader and use the legacy DFU system.

Overview

The new ODrive DFU system described on this page replaces the legacy system that was the default on ODrives sold up to now. Once the beta phase is over, this new system will be the default way to upgrade firmware on ODrives.

To use this new system, you will need to perform a per-ODrive one-time installation of the new bootloader. This one-time setup is performed using the legacy DFU system. The one-time setup thus requires using the command line, requires that Python is installed, may require driver setup, and requires access to the DFU switch. However once set up, you can take full advantage of the new system.

Features

  • Supports ODrive Pro, ODrive S1 and future ODrive products

  • Supports both CAN and USB

  • Run updates from the ODrive Web GUI

  • Alternatively, run updates from the command line with a standalone tool

  • Requires no driver setup, no Zadig, no libusb installation, no Python

  • Recoverable even without physical access, regardless of DFU interruptions or firmware bugs

    • In a small number of scenarios, recovery might require power cycling the ODrive while the update host remains powered.

  • Faster and safer than the legacy system

How to install the bootloader

This procedure sets up your ODrive for the new DFU system. It is only required once per device.

  1. Ensure you have firmware version 0.6.5 or newer installed. If unsure, follow the legacy DFU instructions to install the latest firmware.

  2. Download the latest bootloader binary from this page.

    Then, follow the legacy DFU instructions to install the downloaded bootloader. To do so, substitute the command odrivetool dfu from the instructions with:

    odrivetool dfu --no-erase-all /path/to/downloaded/bootloader.elf
    
  3. In odrivetool, activate the bootloader by running: odrv0.enter_dfu_mode2(). The ODrive will disconnect from odrivetool and a purple pulsating status LED indicates that the ODrive is now in bootloader mode. You can power cycle the ODrive to return to the main firmware.

    Running this command sets the bootloader as the first thing that runs on ODrive power-up, and ensures that you can install new firmware even when there is a problem with the installed firmware.

Note

After installing the custom bootloader, the legacy DFU method still works if you pass it the option --no-erase-all (e.g. odrivetool dfu --no-erase-all) or run odrv0.disable_bootloader() beforehand. The “DFU” DIP switch still forces the legacy DFU mode.

Updating firmware over USB

See also

Looking to install firmware via CAN instead of USB? See below.

Warning

Currently, the user configuration is erased during a firmware update.

  1. (optional) If you want to run updates from the command line, download ODrive Updater. Otherwise, if you’re going to use the GUI, you can skip this step.

  2. Obtain the firmware that you want to install from the firmware release page.

  3. Make sure your ODrive is connected to your host computer via USB.

  4. If the ODrive’s LED isn’t already pulsating purple, put it into DFU mode using any of the following methods:

    In the Inspector tab, search for enter_dfu_mode2 and drag the item into the Controls section. Then press Call.

    ../_images/gui-enter-dfu-mode.png
  5. Install the new firmware via USB.

    Go to https://gui.odriverobotics.com/dfu. Press “Select file…” to open the firmware file that you previously downloaded and press “Select Device” to connect to a device. Then, press “Connect” and “Install” to perform the firmware update.

    ../_images/gui-select-firmware.png
    ../_images/gui-run-dfu.gif

    Note

    The “+” button in the bottom bar cannot be used to select an ODrive in DFU mode.

After successful completion, the status LED will go back to the normal pattern (blue / cyan), indicating that the main firmware is running.

Updating firmware over CAN

See also

Looking to install firmware via USB instead of CAN? See above.

Warning

Currently, the user configuration is erased during a firmware update. Instructions to restore the configuration over CAN will be added soon.

You will need a Linux device with a CAN interface for this.

We assume that your CAN interface is called can0, but this may differ on your system.

  1. Download ODrive Updater. (The GUI can only perform firmware updates via USB.)

  2. Obtain the firmware that you want to install from the firmware release page.

  3. If you have set a custom baudrate on the ODrive before, make sure to revert to the firmware default of 250k on all devices on the bus.

    odrv0.can.config.baud_rate = 250000

    If you haven’t touched this value before, you can ignore this step.

    Note

    While the DFU process itself supports other baudrates too, we recommend a baudrate of 250kbps because the user configuration is currently not preserved during the firmware update. That means when the update completes, the ODrive will default to a baudrate of 250kbps, which would crash the CAN bus if any devices (including the update host) use a different baudrate.

  4. Configure and enable the host computer’s CAN interface.

    sudo ip link set dev can0 type can bitrate 250000
    sudo ip link set dev can0 txqueuelen 256
    sudo ip link set dev can0 up
    
  5. Make sure your host computer and ODrive are connected via CAN.

  6. If the ODrive’s LED isn’t already pulsating purple, put it into DFU mode using any of the following methods:

    This method requires that the ODrive’s firmware boots normally and the default CAN Protocol is enabled with a known node_id.

    In this case, you can send a CAN message with the message ID (node_id << 5 | 0x16) and payload 0x03 to enter DFU mode (see Reboot).

    For example using Python:

    import can
    node_id = 0 # change if needed
    with can.interface.Bus("can0", bustype="socketcan") as bus:
      bus.send(can.Message(arbitration_id=(node_id << 5 | 0x16), data=[0x03], is_extended_id=False))
    

    The status LED should now be pulsating purple.

  7. Install the new firmware via CAN.

    The following command will update the first ODrive in DFU mode that’s found on the bus (see odriveupdater --help for more options):

    /path/to/odriveupdater --can can0 firmware.elf
    

After successful completion, the status LED will go back to the normal pattern (blue / cyan), indicating that the main firmware is running.

Note

The odriveupdater utility does currently not terminate when the update is done. Press Ctrl+C to exit.

ODrive Updater

Firmware can be installed either with the GUI or with the standalone command line utility odriveupdater.

odriveupdater is intended for situations where the GUI cannot be used (when using CAN, on headless systems or for automation).

Unpack the downloaded zip file, and then run:

chmod +x /path/to/odriveupdater

Run ./path/to/odriveupdater --help for general usage hints or proceed with the instructions on this page.

Specifications

  • Supported interfaces: USB, CAN

  • CAN specifications:

    • The DFU-over-CAN protocol uses extended (29-bit) IDs. It is not currently guaranteed to work with other 29bit ID CAN messages on the bus. If you wish to use other vendor’s 29bit CAN protocols on the same bus, please contact us and let us know what vendor and messages you are looking to use, so we can work towards ensuring compatibility.

    • Up to 62 devices (ODrives in bootloader mode + updater hosts) are allowed on one bus.

    • Supported baudrates (autodetected): 1Mbps, 500kbps, 250kbps, 125kbps, 40kbps, 10kbps

    • The ODrive bootloader can coexist with CAN-FD devices on the same bus but does not use CAN-FD messages.

Known issues

  • When updating firmware over CAN, odriveupdater will not exit automatically once complete or when the device is disconnected. Press Ctrl+C to exit.

  • When updating firmware over CAN, the device does currently not recognize when the host disconnects after enumeration or during the update. That means in case of a failed/cancelled DFU attempt, or if the device was interrogated while updating another device, it needs to be restarted to correctly handle a new DFU attempt.

  • The bootloader does not reject simultaneous update attempts from two separate hosts. The result of such a situation is undefined.

How to uninstall the bootloader

This is only required if you wish to install legacy firmware (<0.6.5) or use the legacy DFU system.

  1. If your ODrive doesn’t have bootable firmware (purple pulsating LED when turning it on), first install recent firmware.

    • Either via the normal DFU-over-CAN or DFU-over-USB process.

    • Or via the legacy method:

      1. Flick the DFU switch to “DFU”.

      2. Power cycle the board.

      3. Run odrivetool dfu --no-erase-all --channel devel

  2. In odrivetool, run odrv0.disable_bootloader().

The custom ODrive bootloader is now disabled and you can use the legacy DFU method as usual.