Uart arduino timing out

Hello,

I’m getting an issue with the uart between two odrives and an Arduino mega.

After a trigger/event all serial communication to one or both odrives results in a timeout.

The event that triggers it has something to do with reading data while the motors are enabled and moving, but I can’t pin down an exact cause.

  • The only way to re-establish communication is by cycling power to the odrives.
  • The odrive can be read from or the motors controlled with only occasional issues, but not both.
  • the odrive and Arduino are connected with short jumper wires that are as far as reasonably practical from everything noisy.
  • Vibration, either from myself or the motors doesn’t seem to influence anything.
  • temporarily disconnecting rx/tx doesn’t cause any issue outside the obvious loss of data.

Anyone got any ideas?

Noise or improper grounding. Make sure all of the logic grounds are grounded on J3. You may have trouble with communication anyway if you’re powering everything off the same battery…

thanks for the reply.
the arduino and odrive have a common ground.
the arduino is powered from a seperate sorce to the odrive. (separate battery or pc)
i cant do much more about noise unless your recommending a shielded cable for the ~100mm between boards?

how reliable is the step/dir input method?
does anyone have code i can work off of that’s more feature complete than the example code?

replaced the serial line with shielded cable and grounded the heat-sink. seems to have solved the issue.
thanks for pointing it out, wouldn’t have thought it would be that noisy at such low speeds/power on such a short cable.
its all happy running from a common battery now too.

1 Like