Failed to flash firmware using odrivetool from latest devel

towen:~/GitHub/ODrive$ tools/odrivetool dfu Firmware/build/ODriveFirmware.hex 
ODrive control utility v0.5.1.dev
Waiting for ODrive...
22:32:04.483635569 [USB] Could not open USB device: -3
22:32:04.483681058 [USB] Could not open USB device: -3
22:32:04.483889970 [USB] Could not claim interface  on USB device: -6
22:32:04.483936210 [USB] Could not claim interface  on USB device: -6
22:32:04.484126302 [USB] Could not open USB device: -3
22:32:04.484211534 [USB] Could not open USB device: -3
Traceback (most recent call last):
  File "/home/towen/GitHub/ODrive/tools/odrivetool", line 148, in <module>
    odrive.dfu.launch_dfu(args, logger, app_shutdown_token)
  File "/home/towen/GitHub/ODrive/tools/odrive/dfu.py", line 465, in launch_dfu
    update_device(device, firmware, logger, cancellation_token)
  File "/home/towen/GitHub/ODrive/tools/odrive/dfu.py", line 284, in update_device
    serial_number = device.__channel__.usb_device.serial_number
AttributeError: 'anonymous_interface_139891111454624' object has no attribute '__channel__'

This is using the latest devel (5babe7e4)

I have successfully flashed using the odrivetool from pip, but trying to use the one from the repo fails.
It’s not a permissions or a USB issue: running as root gives the same error, while unplugging USB causes it to wait, and then gives the same error when I plug it in.

Thanks for noting this! It was indeed broken after merging libfibre.

I pushed a fix to devel (fix DFU · odriverobotics/ODrive@b178357 · GitHub). Works for me now.

There are still a bunch of [USB] error messages which I have yet to fix but they can be ignored.

1 Like

Thanks Samuel! :slight_smile:

It appears to work now since pulling your latest devel (b178357 - fix DFU).
Although it does exit with another backtrace:

towen:~/GitHub/ODrive$ tools/odrivetool dfu Firmware/build/ODriveFirmware.hex 
ODrive control utility v0.5.1.dev
Waiting for ODrive...
22:16:37.86599134 [USB] Could not open USB device: -3
22:16:37.87095455 [USB] Could not claim interface  on USB device: -6
22:16:37.87165179 [USB] Could not claim interface  on USB device: -6
22:16:37.87509617 [USB] Could not open USB device: -3
... [some lines omitted]
22:16:37.89644333 [USB] Could not open USB device: -3
Found ODrive 205639994D4D (v3.6-56V) with firmware v0.5.1-dev

Warning: you are about to flash firmware [unknown version] which is older than the firmware on the device (v0.5.1-dev).
Do you want to flash this firmware anyway? [y/N] y
Saving configuration to /tmp/odrive-config-205639994D4D.json...
The file /tmp/odrive-config-205639994D4D.json already exists. Do you want to override it? [Y/n] 
Configuration saved.
Putting device 205639994D4D into DFU mode...
Erasing... done            
Flashing... done            
Verifying... done            
Waiting for the device to reappear...
22:17:01.605846893 [USB] Could not open USB device: -3
... [ a few more lines omitted] 
22:17:01.608797440 [USB] Could not open USB device: -3
22:17:03.880847691 [USB] Could not claim interface  on USB device: -6
22:17:03.881003484 [USB] Could not claim interface  on USB device: -6
Restoring configuration from /tmp/odrive-config-205639994D4D.json...
Could not restore axis0.controller.config.anticogging.calib_anticogging: 'anonymous_interface_140527438462672' object has no attribute 'exchange'
Could not restore axis0.controller.config.anticogging.cogging_ratio: 'anonymous_interface_140527438457568' object has no attribute 'exchange'
Could not restore axis0.controller.config.anticogging.index: 'anonymous_interface_140527438464960' object has no attribute 'exchange'
Could not restore axis1.controller.config.anticogging.calib_anticogging: 'anonymous_interface_140527438462672' object has no attribute 'exchange'
Could not restore axis1.controller.config.anticogging.cogging_ratio: 'anonymous_interface_140527438457568' object has no attribute 'exchange'
Could not restore axis1.controller.config.anticogging.index: 'anonymous_interface_140527438464960' object has no attribute 'exchange'
Some of the configuration could not be restored.
Traceback (most recent call last):
  File "/home/towen/GitHub/ODrive/tools/odrivetool", line 148, in <module>
    odrive.dfu.launch_dfu(args, logger, app_shutdown_token)
  File "/home/towen/GitHub/ODrive/tools/odrive/dfu.py", line 465, in launch_dfu
    update_device(device, firmware, logger, cancellation_token)
  File "/home/towen/GitHub/ODrive/tools/odrive/dfu.py", line 429, in update_device
    odrive.configuration.restore_config(device, None, logger)
  File "/home/towen/GitHub/ODrive/tools/odrive/configuration.py", line 100, in restore_config
    device.save_configuration()
  File "/home/towen/GitHub/ODrive/tools/odrive/pyfibre/fibre/libfibre.py", line 573, in __call__
    return run_coroutine_threadsafe(self._libfibre.loop, lambda: self.__call__(*args))
  File "/home/towen/GitHub/ODrive/tools/odrive/pyfibre/fibre/libfibre.py", line 288, in run_coroutine_threadsafe
    return future.result()
  File "/usr/lib/python3.9/concurrent/futures/_base.py", line 440, in result
    return self.__get_result()
  File "/usr/lib/python3.9/concurrent/futures/_base.py", line 389, in __get_result
    raise self._exception
  File "/home/towen/GitHub/ODrive/tools/odrive/pyfibre/fibre/libfibre.py", line 283, in func_async
    result = await result
  File "/home/towen/GitHub/ODrive/tools/odrive/pyfibre/fibre/libfibre.py", line 540, in async_call
    tx_buf, rx_chunk, is_closed = await agen.asend((tx_buf, self._rx_size - len(rx_buf), True))
  File "/home/towen/GitHub/ODrive/tools/odrive/pyfibre/fibre/libfibre.py", line 462, in asend
    return await self.__anext__()
  File "/home/towen/GitHub/ODrive/tools/odrive/pyfibre/fibre/libfibre.py", line 491, in __anext__
    raise _get_exception(status)
fibre.libfibre.ObjectLostError: the object disappeared
towen:~/GitHub/ODrive$ 

(and apparently the version I had when I did the encoder tests was 0.5.1-dev, although I was sure I had flashed it with a newer one - I will try the encoder again now)

Ah this crash is because newer firmware reboots after save_configuration(). This is the very last DFU step so your update most likely actually completed successfully. I pushed a fix to devel.

1 Like

How to turn off USB messages? It’s too noisy

Change your driver for the ODrive in zadig. If it’s currently libusb0, change it to WinUSB. If it’s WinUSB, change it to libusb0.

Thank you. :+1: :+1: :+1: