My plan is to control a couple of odrives using an industrial RS485 bus. I am moving away from my unstable USB connections due to electric noise. I can not use CAN bus, due to the limited command set implemented in the FW. I believe one on one would work using two RS-232 & RS-485 transceivers, but I would like to address each controller separately on one bus.
Can we make the odrive addressable similarly to the CUA AMT21 encoder ?
ODrive V3.6 doesn’t support communication on RS485. It’s doable, but you’d have to get your own transceivers and write your own drivers. Why not expand the CAN protocol?
You are probably right, it would require MODBUS implementation on both end. Can you give me some hint how to add new commands (like get_gpio_states () to the CAN bus protocol ?
It’s quite simple (hah, get it?). You add the message to the enumeration in can_simple.hpp
, then add a function called get_gpio_states
or similar, then in the large switch statement in can_simple.cpp
, you check for your enumerated value and call the appropriate function.
The only caveat is I was dumb and only gave the protocol 5 bits for commands, so you can only have 32 separate commands.
Alternatively, you can write your own protocol, add it to the odrive-firmware.yaml
, and then tell odrive to use it via the config var odrv0.can.config.protocol
Thanks for the explanation. I think I found a detailed guidance here. Will share my addition when it is ready.