UART Port baud rate

Hi all,

I was wondering if anyone had experimented with the baud rate of the ODrive serial port. Currently it defaults at 115200 as indicated in Board/v3/Src/usart.cpp .

Is it possible/safe to change this value?

Thanks

I know @je310 did this.

@je310 do you mind sharing what you changed?
Thanks

Jelsdon == je310 (lost my password it seems). Yes:
Firmware/Board/v3/Src/usart.c
Line:
huart4.Init.BaudRate = 115200;
Can be changed. Though there are some limitations on what is allowed. I have used 921600 to great success, which is fast enough for me to get the update frequencies I want. I tried 2500000, which does not work. You can check using the CubeMX tool, as it does reject the settings that are too high (presumably based on various clocks, which I would not change unless you understand how they affect the rest of the ODrive)

3 Likes

Thanks @Jelsdon, a rate of around 921600 would be ideal for my needs. Glad to hear it is so easy to change!

Just to add that today I’ve successfully tested odrive at 2000000 baud together with a Teensy 3.5. 1000000 baud works as well.

In case it’s usefull for anyone

today I tried to

  • change the value of Firmware/Board/v3/Src/usart.c / huart4.Init.BaudRate = 115200;
  • reflash odrive with new elf file
  • then change my odrive <-> arduino UART baudrate in arduino code accordingly
  • then read odrive firmware value through UART from arduino

=> to no avail. :confused:

These are my observations
Serial1.begin(115200); // ok. just works
// Serial1.begin(921600); // fails. no communication at all
// Serial1.begin(460800); // fails. no communication at all
// Serial1.begin(230400); // fails. cryptic communication. homing works but streaming positions is a disaster (collisions with main chassis)

maybe i did something wrong.
maybe i should try with a teesy 3.5 board.
Dunno.

i’m stuck with 115200 for now. too bad this is not dynamically configurable through odrivetool like the other parameters.

Just to point out that in my case the comm wires were quite short, i.e. <20cm. With this setup I was able to reliably use 921600 and 1000000 baud using a teensy 3.5. 2000000 also seemed to work, but there were some reliability issues

Thanks for pointing out the cable length. I used two wires, not twisted together. No ferrite.
Just like yconst the arduino sits immediately next to the odrive board, in the 15cm range (did not precisely measure)

Were you using software serial or hardware uart on the arduino? The max speed arduino uno can handle on software serial is about 115200.

Exclusively hardware tx/rx
I’l not in front of it but I believe in the arduino méga code, it was ‘Serial1’