CAN Message Rates are all over the place (and what is the Rx loop rate?)

Hi all!

Looking for some insight here as to why the CAN message Tx rates would be inconsistent. I’m guessing I might be asking too much of the device, but wanted to reach out and see if there’s anything I could do to improve this without reducing performance.

I’m running a single ODrive Pro on a 1Mbps CAN bus point to point, and properly terminated on both ends. (So only two devices, the ODrive, and my ECU) I have all of the feedback messages set to a 1ms Tx rate. I can back down on some of them, but I really need speed, position, and torque to be at 1ms at the very least. I’d like to have Iq Measured and Setpoint at 1ms as well for diagnostics, along with bus voltage and current, but I can drop those down to 5ms or even 10ms if needed.

As you can see below in this screenshot (cursors are set to approx 1ms), some messages are at 1ms, but there are these “bursts” that occur back to back that are in the realm of 0.36ms. Which are then usually folowed by a gap of ~2ms. My guess is that the CAN processor is just getting hung up and overrun on broadcast requests.

However, the bus load is only at 65%, and there are zero error frames, as you can see here. So it’s a pretty clean bus. There’s also nothing else on the bus right now. The ODrive is the only thing broadcasting (since this is just a test bench for now).
image

Next question is on the Rx side of things. I want to run my external control loop at 1ms. So I intend to send Torque Commands at 1ms. If I try to do that, will the ODrive even update the internal target that quick internally? If not, what is the limit of how quickly it can update?

Thank you!

Hi! The ODrive’s controller runs at 8kHz, so 1ms / 1kHz incoming data is well below the max loop rate.

That being said, I think your messages are just running way too fast. If we assume 14 bytes per feedback message (arb ID + payload + CRC), then that’s 8 feedback messages * 14 bytes/message * 8 bits/byte * 1kHz == 896 Kbit/s. Given the busload is only shown as 64% (645.1 Kbit/s), it definitely looks like this is a busload/saturation issue.

If you have 1kHz torque control, and you’re aiming for a max busload of 70%, then you have headroom for an additional (1Mbps/8)/14 * 0.7 - 1kHz = 5250 messages/second. So you could do, e.g.:

  • 1kHz pos/vel (Get_Encoder_Estimates)
  • 1kHz torque (Get_Torques)
  • 1kHz Iq setpoint/measure (Get_Iq)
  • 100Hz heartbeat (Heartbeat)
  • 10Hz temperature (Get_Temperature)
  • 500Hz bus voltage/current (Get_Bus_Voltage_Current)

And be only a bit above 50% busload!