Can not connect to ODrives, or flash new firmware

Hi! My Name is Tucker, I am an MAE student at WVU. I bought 3 3.6 54v ODrive Motor controllers recently, and am having trouble communicating with them. I am using a Windows 10 machine.

I got two of them configured and working using odrivetool. I went to do further configuration a few days later, and I was not able to get odrivetool to connect. If i run odrivetool in anaconda prompt, I get this:

    (base) C:\Users\URC>odrivetool
    ODrive control utility v0.4.11
    C:\Users\URC\Anaconda3\lib\site-packages\fibre\shell.py:104: RuntimeWarning: coroutine 'InteractiveShell.run_code' was never awaited
      console.runcode('import sys')
    RuntimeWarning: Enable tracemalloc to get the object allocation traceback
    C:\Users\URC\Anaconda3\lib\site-packages\fibre\shell.py:105: RuntimeWarning: coroutine 'InteractiveShell.run_code' was never awaited
      console.runcode('superexcepthook = sys.excepthook')
    RuntimeWarning: Enable tracemalloc to get the object allocation traceback
    C:\Users\URC\Anaconda3\lib\site-packages\fibre\shell.py:106: RuntimeWarning: coroutine 'InteractiveShell.run_code' was never awaited
      console.runcode('def newexcepthook(ex_class,ex,trace):\n'
    RuntimeWarning: Enable tracemalloc to get the object allocation traceback
    C:\Users\URC\Anaconda3\lib\site-packages\fibre\shell.py:109: RuntimeWarning: coroutine 'InteractiveShell.run_code' was never awaited
      console.runcode('sys.excepthook=newexcepthook')
    RuntimeWarning: Enable tracemalloc to get the object allocation traceback
    Please connect your ODrive.
    You can also type help() or quit().

    In [1]:

ODrive #1 is recognized by the computer (and shows up in the device manager), but ODrive #2 does not. I messed with the drivers with zadig, but no dice on that route.

After googling, I figured it might be a firmware issue, and tried upgrading the firmware with

odrivetool dfu

This returned errors, which were the same as this topic. The topic says that this method of flashing firmware doesnt work, so I tried to use the DfuSeDemo route of upgrading firmware on the odrive that windows recognized. It refuses to show up in DfuSeDemo. (DFU switch, deleting drivers, changing drivers with zadig, and steps 9.1/9.2 in the link above)

Now, even when not in DFU mode(even after power cycling), the ODrive will not be recognized by windows. At this point I decided to pull my fresh, 3rd ODrive out of the box, and try connecting to it. I could, no problem. I then tried updating the firmware on it using DfuSeDemo, and now it refuses to connect to my laptop.

Other info:

  • ODrive #1 & #2 are connected to two motors and hall effect encoders, and have the brake resistors connected. ODrive #3 is not connected to any motors or encoders.
  • All ODrives have the heatsinks in place
  • ODrives #1 & #2 still work using the config that was placed on them before I lost the ability to change it.
  • I had these configured to receive PWM signals from a receiver/arduino on GPIO 3 and 4, following
    the guide on the ODrive documentation (I would link it, but I am limited to two links in a post)
  • My PC picks up the STM32 BOOTLOADER if i’m in the dfu dipswitch mode

TLDR: I have 3 ODrives that will not connect to my laptop. What should my next step be to debug?

I suggest getting an STLinkV2 to flash firmware since you’re having DFU issues. We need to get firmware back on the drive before addressing the anaconda errors.

Thanks for the response!

I just bought an STLinkV2, and it is on its way. I will update this post when it arrives.

I have a similar issue, my odrive version is 3.6-24V,and it does not show up on odrivetool. So I use STLinkV2 to flash the firmware, which I download from the official release and use the following command to flash firmware:

openocd -f interface/stlink-v2.cfg -f target/stm32f4x.cfg -c init -c “reset halt” -c “flash write_image erase ODriveFirmware_v3.6-24V.elf” -c “reset run” -c exit

The outputs:

GNU MCU Eclipse OpenOCD, 64-bitOpen On-Chip Debugger 0.10.0+dev-00593-g23ad80df4 (2019-04-22-20:18)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
WARNING: interface/stlink-v2.cfg is deprecated, please switch to interface/stlink.cfg
Info : auto-selecting first available session transport “hla_swd”. To override use 'transport select '.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 2000 kHz
adapter_nsrst_delay: 100
none separate
Info : clock speed 2000 kHz
Info : STLINK V2J34S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.198949
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
adapter speed: 1800 kHz
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0800b9ec msp: 0x20020000
auto erase enabled
Info : device id = 0x10076413
Info : flash size = 1024 kbytes
wrote 262144 bytes from file ODriveFirmware_v3.6-24V.elf in 7.807374s (32.790 KiB/s)

But it still doesn’t show up in odrivetool, I’m using ubuntu 16.04 and the configuration is fine because my another three odrives of the same version just work well.

I tried another solution: force the DFU mode through the switch on board, then run

odrivetool dfu

here is the output:

ODrive control utility v0.4.11
Waiting for ODrive…
Found ODrive 20693590524B (v3.6-24V) with firmware [unknown version] in DFU mode
Checking online for newest firmware… found v0.4.11
Downloading firmware v0.4.11…
The configuration cannot be backed up because the device is already in DFU mode. The configuration may be lost after updating. Do you want to continue anyway? [Y/n] y
Erasing… (sector 0/6)
Traceback (most recent call last):
File “/home/xin/anaconda3/bin/odrivetool”, line 142, in
odrive.dfu.launch_dfu(args, logger, app_shutdown_token)
File “/home/xin/anaconda3/lib/python3.7/site-packages/odrive/dfu.py”, line 454, in launch_dfu
update_device(device, firmware, logger, cancellation_token)
File “/home/xin/anaconda3/lib/python3.7/site-packages/odrive/dfu.py”, line 373, in update_device
dfudev.erase_sector(sector)
File “/home/xin/anaconda3/lib/python3.7/site-packages/odrive/dfuse/DfuDevice.py”, line 170, in erase_sector
status = self.wait_while_state(DfuState.DFU_DOWNLOAD_BUSY, timeout=sector[‘len’]/32)
File “/home/xin/anaconda3/lib/python3.7/site-packages/odrive/dfuse/DfuDevice.py”, line 104, in wait_while_state
status = self.get_status(timeout=actual_timeout)
File “/home/xin/anaconda3/lib/python3.7/site-packages/odrive/dfuse/DfuDevice.py”, line 60, in get_status
status = self.control_msg(DFU_REQUEST_RECEIVE, DFU_GETSTATUS, 0, 6, timeout=timeout)
File “/home/xin/anaconda3/lib/python3.7/site-packages/odrive/dfuse/DfuDevice.py”, line 47, in control_msg
return self.dev.ctrl_transfer(requestType, request, value, self.intf.bInterfaceNumber, buffer, timeout=timeout)
File “/home/xin/anaconda3/lib/python3.7/site-packages/usb/core.py”, line 1043, in ctrl_transfer
self.__get_timeout(timeout))
File “/home/xin/anaconda3/lib/python3.7/site-packages/usb/backend/libusb1.py”, line 883, in ctrl_transfer
timeout))
File “/home/xin/anaconda3/lib/python3.7/site-packages/usb/backend/libusb1.py”, line 595, in _check
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 5] Input/Output Error

It took me awhile, but I finally got my hands on an STLink, but I am having difficulty getting it to work. When I run the command

openocd -f interface/stlink-v2.cfg -f target/stm32f4x.cfg -c init -c “reset halt” -c “flash write_image erase ODriveFirmware_v3.6-56V.elf” -c “reset run” -c exit

I get a response

xPack OpenOCD, 64-bit Open On-Chip Debugger 0.10.0+dev (2019-07-17-11:28)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
WARNING: interface/stlink-v2.cfg is deprecated, please switch to interface/stlink.cfg
Info : auto-selecting first available session transport “hla_swd”. To override use 'transport select '.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : clock speed 2000 kHz
Info : STLINK V2J29S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.152608
Error: init mode failed (unable to connect to the target)

I also tried this on a Linux machine, and got a similar error.

What next steps can I take to get this to work?

EDIT: I forgot to mention that I also tried on all 3 oDrives and got the same error

Are you confident that the STLink is wired correctly? Two computers / operating systems & 3 odrives doesn’t sound good for the STlink

I wired it according to the picture here