Usb-to-serial device

Hello everyone

I wan to use ODrive in my project, and I have to decide how to wire things up.
I will have a Linux machine that acts as coordinator, and there are 6 meter of cable between it and the odrive.

Given this situation, I think that it is fine to use the serial communication instead of the USB.

My questions are:

  1. Is the protocol the same, so that I can still use odrivetool?
  2. what do I have to tell odrivetool in order to speak on a specific tty?

In general, is something like that done before?

Kind regards for your time and for any reply

The UART port of the ODrive currently runs two protocols in parallel by default (in the next release you’ll probably have to select the protocol explicitly). One is the ASCII protocol and the other one is the Native Protocol aka Fibre, which is what odrivetool speaks.

You can launch odrivetool with odrivetool --path serial:/dev/ttyS0.

But 6m seems very long for a UART connection. You may need to go differential (RS-485) or lower the baudrate (you’ll have to modify odrivetool to make that work: modify the line DEFAULT_BAUDRATE = 115200 in

Also beware of ground loops: if the power lines also travel along those 6m cables you risk frying the ODrive. To avoid this the safest bet would be to have independent power supplies on both sides and only have a single data ground wire between them.

Edit: @PJohnson just made a nice write-up about Ground Loops.

Thank you very much for the guidance!

Thank you for the adivce against ground loop, I didn’t event thought about them…

This is the connection I am doing:

instead of 2 arduinos I have the PC and the odrive. (and obviously I connected both rx and tx for each side)

On the PC side I have :ÅMÅŽÕÑ&dchild=1&keywords=cp210x&qid=1604132928&s=electronics&sr=1-1

I made a test with the arduino
PC->cp210->max485->arduino and it works.
There is no ground connected between cp210 and arduino, so I think I can consider them isolated.

The cp210 is on /dev/ttyUSB0 so I launch odrivetool with that path, but it cannot find the odrive.
The connection is PC->cp210->max485->odrive

Where can I start looking for problems?
I am kinda sure that tx and rx are right, and I think I can use the 485 tranceiver at 3.3v (I will do more research on that)
I have tried the communication with PC and arduino and it works, bu

The MAX485 Datasheet suggests that it cannot operate from a 3.3V supply (see page 7: “Positive Supply: 4.75V ≤ VCC ≤ 5.25V”). However you could power it from the 5V pin on the ODrive. The logic lines should then be compatible (See page 2 “Input High Voltage: min 2V” and furthermore ODrive’s pins are 5V-tolerant).
If that doesn’t help, the easiest way to debug would be to hook an oscilloscope onto the ODrive’s RX and TX pins. Then you quickly know if the problem is in the PC->ODrive path, on the ODrive itself or in the ODrive->PC path.

Argh, looking at that datasheet was supposed to be my duty… Feeling a bit guilty right now, but very grateful.

When looking with the oscilloscope, what should I expect? who should initiate the communication?

1 Like

I connected the logic analyzer, and the odrive actually respond!
Here is image of pulseview:

Terminal will eventually print “Downloading json data from ODrive… (this might take a while)”
on the serial I can see different communications (with longer replies from odrive) happening multiple times (the last 2 bytes are always the same, I guess they are a checksum)

Maybe the computer is having troubles reading the responses?