Connecting Odrive to RPi over UART

Hello all,

Please excuse me, but I am a bit of a newbie when it comes to the Odrive.

I am trying to connect my RPi 4 to the Odrive (v3.6) over UART. I have GPIO14, 15, & 6 on the Pi (which correspond to TX, RX, & GND) connected to GPIO2, 1, & GND on the Odrive respectively.

I have no problem connecting the Odrive to USB and getting communication that way, this project just requires that I communicate differently.

To make sure I cover my bases, I will walk through the proccess of what I did after the aforementioned connection:

  1. On the RPi 4, I added myself to the dialout group.

  2. In the code, I use the command:

OdriveSerial serial = ODriveSerial(2000000, "/dev/ttyS0", read_callback)

which doesn’t work, and instead gives me an error saying "open: No such file or directory. If I use the port for the USB, everything works well. I’ve also tried /dev/ttyAMA0 to establish connection, but I get the same error as previous.

Any ideas would be greatly appreciated! Thanks in advance!

1 Like

Check the Linux kernel log messages (sudo dmesg -w) when you first plug in the device to see what port name it gets. Different serial adapters use different drivers, so it could be called ttyACM0 for example.

What library are you using that defines the OdriveSerial class? Is this a port of the Arduino library to RPi?

Are you sure that baud rate 2M is correct? I thought most UARTs wen up to 1M.

BTW, you could also try CAN bus - IMO the best way of interfacing RPi to ODrive is to have USB for configuration, and CAN for control. I personally recommend the ‘innomaker’ usb-to-CAN adapter.

1 Like