UART Communication: Maximum frequency ? Timeout?


#1

Hi Guys !

I am trying to communicate with my ODrive via UART with a Raspberry pi. I basically copied the Arduino code that is proposed by @madcowswe here. I mostly use the setcurrent function as explained in the ascii protocol and I also wish to get the encoder position.
I am meeting a timeout issue (from the readString() function) :

  • I can send the current command at a quite frequency (1kHz) to ODrive and everything works perfectly fine.
  • If I want to get the encoder position (sending the request at 1kHz), while the motor is not turning, I receive the position and then I get a timeout response after one or two seconds, respectively when the motor is turning, it lasts a bit longer before I get a timeout. I tried at lower frequencies, it lasts longer but also ends up in a timeout.

After having a timeout my only option in order to restart a communication via UART is to shut the power down and restart it.

So here is my question, is there a maximal frequency for the UART communication ?
Has anybody an idea to what could cause this ?

Thanks a lot !


ASCII commands makes ODrive unreachable
#2

Maybe we are out of CPU-time and the read command is perhaps more expensive than the writes. I have seen some issues with intermittent spikes in CPU usage that I don’t know where they are coming from, and I intend to dig into that eventually.

Meanwhile, you can try to slow down the PWM frequency (the control loop frequency is tied to this), by increasing TIM_1_8_PERIOD_CLOCKS to 12000 here.