Cannot Connect USB with S1

So I am trying to test certain capabilities on an S1 using CAN (basically just sending torque commands and receiving encoder feedback at ~1kHz) before I go ahead and buy the full 8 I need for a system. I am currently using an isolated USB->CAN-FD adapter (although the price is suspect, I admit link:Amazon.com).

I was able to setup and configure the odrive with the 270kV 5065 motor and had it spinning up and accepting torque set points through the web GUI. I then spent several hours struggling to get any CAN-FD messages to work (the adapter would just stop receiving data) and am not sure which was at fault the Odrive or the adapter (I am using cangaroo to diagnose the bus).

I tried changing the data baud rate to 5M (normal baud set at 1M) and the brs enable flag to 1 and configured from the json file in odrivetool. Nothing seemed to work so I started taking some creative experimentation approaches.

In the process of such I had reset everything so that the CAN bus was working and sending feedback which was being received by cangaroo when I decided to try changing the brs enable flag to 1 WITHOUT increasing the data baud rate (ie both bauds were set to 1M). I plugged it into USB and it failed to connect to the device giving me a ‘-5’ error. Nothing happened in between it working from the previous configuration set in odrivetool and it failing (no falls, bumps, shorts, multiple devices plugged in ie only usb OR CAN adapter). I’m really at a loss for what went wrong and how to prevent it.

Now I cannot connect to USB at all and it seems to exhibit the following behavior:

If the USB cable is connected but not the DC power the LED on the board still lights up and flashes from ?red? to blue which I did not think was how it behaved when I first got the board.

If I connect the USB cable first but no DC power it shows up in device manager as COM4 and even shows communication in the events log but cannot connect to odrive (GUI shows something like ‘odrive S1 paired’)

If I connect the DC power first then USB cable it doesn’t (potentially inconsistently) show up as a COM device at all and sometimes shows up as a unrecognized usb device that filed to configure.

The CAN feedback is still sending if I just connect DC power and the USB->CAN-FD adapter and check with cangaroo and sending id:0x000 drc:0 data: gets me a response from the odrive with the version information. I have not gotten far enough with the device to check more complicated commands as I was still trying to setup and test CAN thus I have yet to actually command the motor with CAN, thus I am unsure if the other features of the device are not damaged.

I have not tried to flash firmware to the device as I didn’t want to make a bad situation worse if at all possible. I would appreciate maybe some potential debug steps as I am still very novice to these devices. Perhaps what string of CAN messages I can send to clear errors, set state to closed loop control, and send a setpoint torque? I am not sure if some commands require any data in the message or if the id alone is sufficient to trigger the action (device has node_id = 0)
Would the following be correct?
id:0x018 drc:1 data:[00] #clear errors
id:0x00b drc:8 data:[00 00 00 01 00 00 00 01] #torque control, passthrough (direct control of torque)
id:0x00e drc:4 data:[3c 23 d7 0a] #set torque to 0.01 Nm (not super confident on float conversion)

Sorry if this is a bit all over the place.

PS If anyone has any suggestions on C++ libraries to use to send CAN-FD messages through a Canable 2.0 FD compatible device I would greatly appreciate it. I see stuff on candlelight and libusb (which I have heard GREAT things about lol) but am not sure how the gsusb packaging works (would love a good reference).

Follow-up progress report.

I was missing the Set axis state command which is:
id:007 dlc:4 data:[08 00 00 00] #set to closed loop control

Admittedly I should have thought of little endian (or read it in the documentation " * All values are encoded in little endian (aka Intel format, aka least significant byte first).") but oh well there goes a couple hours of debugging I’ll never get back haha.

Thus to get it to run I just needed to send:
id:0x018 drc:1 data:[01] #clear errors and flash LED
id:007 dlc:4 data:[08 00 00 00] #set to closed loop control
id:0x00e drc:4 data:[00 00 00 3e] #set torque to 0.125 Nm

Probably would have not made that mistake if I wasn’t crafting the data packets by hand haha.

The main issue presented earlier still persists tho and I am unable to connect with USB. When I try the web GUI it says ‘Odrive S1 - Paired’ so maybe it thinks it is hardcoded paired to another device because I accidentally sent some edge case CAN message? I am still not sure but feel a little better knowing the bulk of the functionality remains functional (I have yet to try a RxSdo command as constructing it seemed tedious and I am hesitant to accidently disable CAN and fully brick the device). It might just need a new flash of the firmware but I would love additional feedback from someone with a little more experience than myself.

Hi! Sorry for all the troubles you’re having! Glad to hear you got the endianness figured out, it can definitely be a bit of a gotcha :slight_smile:

Regarding the S1 USB stuff, this kind of seems like an instance of Windows driver mess – did you use Zadig or anything like that, by any chance? You definitely can’t brick the ODrive (there’s really nothing you can do to make it truly unrecoverable), so I wouldn’t worry about that there.

If it’s easy to try the USB with a different computer (especially something Linux-based, e.g. rPi or similar), I’d give that a shot, just make sure nothing got inadvertently damaged (not sure how it would, though).

And regarding the C++ stuff, I think your best bet might be to just use a Linux computer so you can use SocketCAN and native Linux sockets/networking – I don’t think I’ve heard of a native C++ level gs_usb driver, you’d likely have to roll it yourself (possible reference here). Alternatively you can use slcan, but of course that prevents you from using CAN-FD.

You can also see our example scripts for from-scratch ODrive setup here: ODriveResources/examples at master · odriverobotics/ODriveResources · GitHub

Namely interesting may be can_enumerate.py and can_restore_config.py.

Thanks for the response Solomon,

No I have not used Zadig (to my knowledge). It could very well be a windows issue but I am having trouble in Linux as well.

For context I am using VirtualBox to create a Ubuntu VM running on my windows laptop and have successfully used socketCAN to send and receive messages with C++ which is fantastic news (albeit I have had major issues with packet loss I think). Also I realized a lil late that although the adapter I bought has the hardware for FD it is flashes with slcan (no FD) and uses a STM32G431 based chip so atm no candlelight support exists which is oh well… Anyways for now testing with slcan is fine although it hurts my soul to see my max message rate capped to ~200Hz when I will eventually need ~4000Hz outgoing msg/sec so I will probably have to invest in a new adapter.

Quick Question: Does anyone know if better quality CAN-FD adapters can support 4000Hz of outgoing messages per second when using a binary communication like candlelight?

Quick Question: What is the max frequency the setpoint of the S1 can be changed with CAN? I have been attempting ~200Hz and it ‘feels’ more like 2-5Hz at best. (I think I am just losing packets due to an insecure electrical connection on my part).

Regardless I see that when I select to transfer the USB device to the VM’s control it shows as an InterBiometrics device (due to VIM 1209 which I have read has been licensed to open-source projects). Regardless it does not show up as a valid device in the GUI (I am using chrome in Ubuntu).

I then went to install odrivetool and try through a terminal just a few minutes later and now the device refuses to show up as COM4 like before (I transfer it to the VM after seeing it show up in device manager before closing such). Now it says unknown USB device connected Device Descriptor Request Failed.

I have tried multiple cables to little avail and am beginning to think I might have done the ‘impossible’ and bricked an unbrickable S1 lol. I genuinely cannot think of why the USB is failing and I probably don’t have access to a computer running linux without a VM.
*** Literally as I am reviewing my post I tried again and now it shows up which is very strange (still does not connect even to odrivetool).
*** Also when I check ls /dev/tty* it does not show up as either a USB or ACM device which is a bit strange so maybe it isn’t properly getting transferred to the VM???

*** After rebooting my laptop I tried the gui again and see that the Odrive S1 - Paired option is gone. It is hard to give accurate descriptions of the behavior because it is SO INCONSISTENT!!!

********* Should I try to just reflash the device with firmware and hope that fixes everything?!

Also the main reason I am worried to change things with RxSdo it if I accidentally change the odrive CAN baudrate or something similar I would lose my last channel of communication and be unable to revert any bad changes.