As the topic suggests, I have a Teensy 4 talking to 6 odrives via UART (the teensy 4 has 7 hardware serial pairs!) and the ASCII protocol gets me an update rate of ~50hz on 24 floats (axis*.encoder.pos_estimate and axis*.motor.current_control.Iq_measured for both axes on 6 odrives). Basically, the teensy is running a busy loop that reads/writes 1 byte at a time to each odrive UART as needed in a non-blocking, round robin process.
I would like to increase this update frequency from 50hz to ~500hz (perhaps even more, if possible). Going by byte count, it seems that implementing the native protocol over UART might give me a 2-4x speedup (assuming the communications medium, and not the actual command processing time, is the primary cause of request/response latency). So perhaps 100hz-200hz, but certainly not 500hz. A similar speedup could be obtained by implementing a minimalist ASCII serial protocol with custom firmware.
In terms of increasing communications bitrate: I’ve looked at the CAN and I2C options but there is little to no clear information/examples about actual CAN/odrive implementations (it’s not even clear to me whether I need a CAN transceiver for the teensy, each odrive, etc, or not), and I2C requires irreversible hardware modifications. There are designated SPI pins on the odrive for encoder interfacing, and SPI is typically quite high performance, but I have not seen any mention of SPI communication for odrive commands.
USB serial seems like a very interesting option, considering the high data rates, but does this actually pan out in practice? I believe USB does some packetization that puts a ceiling on request/response frequencies, though that ceiling may be fairly high (~1000hz). I’m also not sure what’s involved in setting up the teensy 4 as a usb host to 6 odrives, but I believe it’s possible.
It’s also possible that algorithms requiring update rates of 500hz or more are better offloaded to the odrive itself as custom firmware and shuffling data at these frequencies is more trouble than it’s worth. Is this the case?
edit: I came across this discussion - UART Port baud rate - which indicates that very substantial (8x or more) UART baud rate speedup is possible by flashing custom firmware. Some posters even indicate that they had success with baud rates in the megabits. This seems to be the most fruitful way forward to get the speedup I want, especially if coupled with the native or minimal ASCII protocol I mentioned above. Would be nice if the UART baud rate could be updated via config parameter (and take effect upon reboot, I suppose).