Is UART broken in 0.6.4?

I’m trying to control 3 ODrives using an Arduino Mega and ODrive’s Arduino library. My setup seems to be working, but whenever I try to get values out of my ODrive’s like calling odrive_1.GetPosition(0), then it seems random whether I get the correct or incorrect value.

Sometimes I get the correct value, sometimes and incorrect value and sometimes no value.

I’m guessing that it has something to do with the bug that someone found in the firmwire:

Any suggestions on how to proceed? Am I doing something wrong? Hasn’t the bug been fixed in 0.6.4? What about 0.6.5?

If you use ODrive’s Arduino library, you use ASCII UART mode, not native UART mode. Those bugs only affect native mode, so they shouldn’t affect you.

Thanks for the quick response.

Ok, well that rules out a firmwire bug. It still leaves the question of why I’m getting wrong values. I have 3 D5312S motors hooked up to 3 ODrive S1’s with 3 RS485 attached. Everything seems to be working, except I’m getting faulty values half the time.

This is what happens when I run the below code:

      odrive_serial_1 << "r axis0.pos_vel_mapper.pos_rel\n";
      Serial << "1: " << odrive_1.readFloat() << '\n';
      odrive_serial_2 << "r axis0.pos_vel_mapper.pos_rel\n";
      Serial << "2: " << odrive_2.readFloat() << '\n';
      odrive_serial_1 << "r axis0.pos_vel_mapper.pos_rel\n";
      Serial << "3: " << odrive_3.readFloat() << '\n';

The first time the above code is called, the following is printed:

1: 0.2189
2: 0.3169
3: 0.0000

The third ODrive definitely shouldn’t have a position of 0.0. If I try to run the code again without moving any of the arms, I get the following:

1: 0.5029
2: 0.3169
3: 0.0000

Now the value of the first ODrive has changed, but the position of the encoder is the same.

Any suggestions as to what might be going on?

A quick update here. If I change the GetPosition in the ODrive Arduino library so that pos_vel_mapper.pos_rel is called instead, then I receive the correct values more frequently.

It still happens that I receive the wrong value or simply 0.0 though. Especially on the first run.

Also, sometimes when I call a “run_state”, then it doesn’t always go through.

It seems to me that not all the values are send or received when communicating through Android. Can that be true and is there anything I can do about it?

1 Like

I seem to have solved it with the help from someone on the discord channel. I forgot to connect all ODrives to the 5V channel on my Arduino Mega. It seems to be working after I did that.

1 Like