ODrive ignores most requests in UART native mode

I have an issue with my odrive board: I want to use the UART native protocol with an Arduino MEGA, but it doesn’t work as expected. When using the ascii protocol everything works fine, so the Arduino and the UART communication is working.

However, as soon as i switch to the native protocol and send the raw bytes, i only get a response about every 5 to every 50 requests.
The bytes are always the same, for example requesting vbus_voltage. Also, the speed of the requests does not matter, i only get a response to about 5% of the requests, but when i do get a response, it is spot on. It seems like the ODrive just ignores the messages and only randomly accepts a few, without any pattern.

// This is the raw packet being sent
// It's responsible for requesting vbus_voltage
// This packet was taken from a USB sniffer from the official odrive tool, so it should work
{ 0xF4, 0x03, 0x02, 0x80, 0x04, 0x00, 0x53, 0x5E }

// This is the packet being wrapped in a stream for UART and it seems to work, but only sometimes
{ 0xAA, 0x08, 0x3D, 0xF4, 0x03, 0x02, 0x80, 0x04, 0x00, 0x53, 0x5E, 0xB6, 0x74 }

// I also tried other requests but the behaviour is always the same, no matter the data.

I either don’t get any response at all or one that’s spot on. It also shouldn’t be the CRCs since the packets are always the same…

What could be causing this? Any ideas?

It could be that the CPU is too busy on the ODrive end. What kind of encoders are you using? (some encoders e.g. absolute SPI can cause high CPU load)

You could try using the dump_timing(odrv0,path=timings.png) command in odrivetool, which will output an image file with a graph of the different threads using CPU time.

Thank you for your answer!

This is the image generated with dump_timing(odrv0,path="timings.png"):

There is nothing attached to the ODrive, no motors, no encoders, only a 12V power supply and the Arduino MEGA.

I already tried looking in the source code of the firmware, but i can’t really find anything, can someone point me to where the packets are parsed in the firmware?

The native UART protocol uses the ‘fibre legacy stream-based protocol’ as far as I can tell. It is called from communication/interface_uart.cpp:123 and the packets are decoded somewhere in fibre-cpp/legacy_protocol.cpp e.g. PacketUnwrapper::complete()

The timing diagram looks good - you have plenty of spare cycles before the 8kHz deadline (180MHz clock / 8kHz loop rate = budget of 22500 CPU cycles per loop, of which you are using less than 15k)

TBH this sounds like a topic for @samuel

Thank you for pointing that out, i will take a look.

By the way, this is the code for the Arduino:

void setup() {
  Serial.begin(115200);
  Serial1.begin(115200);
}

void loop() {
    auto& ODrive = Serial1;
    uint8_t data[] = { 0xAA, 0x08, 0x3D, 0xF4, 0x03, 0x02, 0x80, 0x04, 0x00, 0x53, 0x5E, 0xB6, 0x74 };

    ODrive.write(data, sizeof(data));
    Serial.println("Request sent");

    delay(100);

    while (ODrive.available()) {
        Serial.print((int)ODrive.read());
        Serial.print(" ");
    }
}

And this is the output of the serial monitor:

Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
170 6 0 244 131 205 177 65 65 12 191 Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
170 6 0 244 131 102 250 65 65 228 78 Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
170 6 0 244 131 102 250 65 65 228 78 Request sent
Request sent
Request sent
Request sent
170 6 0 244 131 102 250 65 65 228 78 Request sent
Request sent
Request sent
170 6 0 244 131 205 177 65 65 12 191 Request sent
170 6 0 244 131 102 250 65 65 228 78 Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
170 6 0 244 131 102 250 65 65 228 78 Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
170 6 0 244 131 102 250 65 65 228 78 Request sent
Request sent
Request sent
170 6 0 244 131 102 250 65 65 228 78 Request sent
170 6 0 244 131 0 67 66 65 124 71 Request sent
170 6 0 244 131 102 250 65 65 228 78 Request sent
170 6 0 244 131 102 250 65 65 228 78 Request sent
Request sent
Request sent
Request sent
170 6 0 244 131 102 250 65 65 228 78 Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
170 6 0 244 131 205 177 65 65 12 191 Request sent
Request sent
Request sent
Request sent
Request sent
170 6 0 244 131 205 177 65 65 12 191 Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
170 6 0 244 131 77 103 66 65 12 32 Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
170 6 0 244 131 77 103 66 65 12 32 Request sent
170 6 0 244 131 102 250 65 65 228 78 Request sent
170 6 0 244 131 205 177 65 65 12 191 Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
170 6 0 244 131 205 177 65 65 12 191 Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
170 6 0 244 131 77 103 66 65 12 32 Request sent
170 6 0 244 131 102 250 65 65 228 78 Request sent
170 6 0 244 131 205 177 65 65 12 191 Request sent
170 6 0 244 131 0 67 66 65 124 71 Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
170 6 0 244 131 0 67 66 65 124 71 Request sent
170 6 0 244 131 205 177 65 65 12 191 Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
170 6 0 244 131 102 250 65 65 228 78 Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
170 6 0 244 131 102 250 65 65 228 78 Request sent
Request sent
Request sent
170 6 0 244 131 102 250 65 65 228 78 Request sent
Request sent
Request sent
Request sent
Request sent
170 6 0 244 131 0 67 66 65 124 71 Request sent
Request sent
Request sent
Request sent
170 6 0 244 131 102 250 65 65 228 78 Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
170 6 0 244 131 102 250 65 65 228 78 Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
170 6 0 244 131 153 139 66 65 204 65 Request sent
Request sent
Request sent
170 6 0 244 131 102 250 65 65 228 78 Request sent
170 6 0 244 131 0 67 66 65 124 71 Request sent
Request sent
Request sent
Request sent
170 6 0 244 131 77 103 66 65 12 32 Request sent
170 6 0 244 131 102 250 65 65 228 78 Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent
Request sent

As you can see, the response is very random but when an answer arrives, it is totally correct. Ideally there should be a response for every request.

Is there a way to debug to see if the packets are actually received, like making minor changes in the firmware like blinking leds or printing text? I don’t have an ST-Link adaptor however, are there other easy ways to see if something is happening?

Right, can you simply print messages on UART b without breaking stuff? Then i could maybe hook this up to the arduino as well…

The Fibre protocol is documented here. There is an incrementing sequence number but IIRC currently there’s not check to reject duplicate messages.

If you want to use printf statements you can set <odrv>.config.usb_cdc_protocol to STREAM_PROTOCOL_TYPE_STDOUT and then look at the virtual COM port with a serial monitor. However this feature is experimental so I can’t guarantee that it works as expected. When in doubt, use the fw-0.5.3 branch (it has a bugfix that might be related).

In general I strongly recommend to always work with the best debugging tools for the job. The cost and setup time is usually easily offset by the savings in debugging time and headache. In this case that’s likely to be breakpoint debugging with an STLink. It could also help to scope the RX/TX lines to see if the signal looks nice and clean.

2 Likes

Thank you for the help, @Samuel.

I did some debugging with printf and came to the conclusion that there must be a bug in legacy_protocol.cpp. Almost all packets seem to be discarded due to a bad header. Apparently the search for the stream header does not work like it should. The header is always shifted and the packet is only parsed correctly when the stream header randomly aligns correctly.

I now switched to the fw-0.5.3 branch, but the issue persists.

Maybe someone who knows better than me could take a look at this?

I just found out that the speed is an issue.

When sending one byte at a time with at least 1ms delay between all bytes everything seems to work, but when the delay gets smaller, packets start being ignored. The delay is not a long term solution tho, as i need all the speed i can get and the odrive should be able to do it with ease.

I already confirmed the signals with another arduino and it is spot on, it must be something in the firmware.

Could this be a threading issue? I found out that it works as long as PacketUnwrapper::complete is called once for every byte, as soon as there are several bytes to handle at once, problems start to occur…

I am encountering exactly the same issue. I used to be able to communicatie with the ODrive over native UART protocol just fine on firmware v0.5.1 (after a lot of troubleshooting and disabling the ASCII protocol handler in the firmware). However, after upgrading to v0.5.2 pretty much 90% of the commands I send get ignored.

This is an example log from my ESP32 controller:

I (355) odrive: [0] axis0_motor_config_calibration_current = 10.000000
E (455) odrive: [0] no response received
E (655) odrive: [0] no response received
E (855) odrive: [0] no response received
I (955) odrive: [0] response received
I (955) odrive: [1] axis0_requested_state = 3
E (1055) odrive: [1] no response received
E (1255) odrive: [1] no response received
E (1455) odrive: [1] no response received
E (1655) odrive: [1] no response received
E (1855) odrive: [1] no response received
E (2055) odrive: [1] no response received
E (2255) odrive: [1] no response received
E (2455) odrive: [1] no response received
E (2655) odrive: [1] no response received
I (2755) odrive: [1] response received
I (2755) odrive: [2] axis0_current_state
I (2755) odrive: [2] response received: value = 4
I (2855) odrive: [3] axis0_current_state
I (2855) odrive: [3] response received: value = 4
I (2955) odrive: [4] axis0_current_state
I (2955) odrive: [4] response received: value = 4
I (3055) odrive: [5] axis0_current_state
E (3155) odrive: [5] no response received
E (3355) odrive: [5] no response received
E (3555) odrive: [5] no response received
E (3755) odrive: [5] no response received
E (3955) odrive: [5] no response received
E (4155) odrive: [5] no response received
E (4355) odrive: [5] no response received
E (4555) odrive: [5] no response received
E (4755) odrive: [5] no response received
E (4955) odrive: [5] no response received
E (5155) odrive: [5] no response received
E (5355) odrive: [5] no response received
E (5555) odrive: [5] no response received
E (5755) odrive: [5] no response received
E (5955) odrive: [5] no response received
E (6155) odrive: [5] no response received
E (6355) odrive: [5] no response received
E (6555) odrive: [5] no response received
E (6755) odrive: [5] no response received
E (6955) odrive: [5] no response received
E (7155) odrive: [5] no response received
E (7355) odrive: [5] no response received
E (7555) odrive: [5] no response received
E (7755) odrive: [5] no response received
E (7955) odrive: [5] no response received
E (8155) odrive: [5] no response received
E (8355) odrive: [5] no response received
E (8555) odrive: [5] no response received
E (8755) odrive: [5] no response received
E (8955) odrive: [5] no response received
E (9155) odrive: [5] no response received
E (9355) odrive: [5] no response received
E (9555) odrive: [5] no response received
E (9755) odrive: [5] no response received
E (9955) odrive: [5] no response received
E (10155) odrive: [5] no response received
E (10355) odrive: [5] no response received
E (10555) odrive: [5] no response received
E (10755) odrive: [5] no response received
E (10955) odrive: [5] no response received
E (11155) odrive: [5] no response received
I (11255) odrive: [5] response received: value = 7
I (11355) odrive: [6] axis0_current_state
I (11355) odrive: [6] response received: value = 7
I (11455) odrive: [7] axis0_current_state
I (11455) odrive: [7] response received: value = 7
I (11555) odrive: [8] axis0_current_state
I (11555) odrive: [8] response received: value = 7
I (11655) odrive: [9] axis0_current_state
I (11655) odrive: [9] response received: value = 7
I (11755) odrive: [10] axis0_current_state
I (11755) odrive: [10] response received: value = 7
I (11855) odrive: [11] axis0_current_state
I (11855) odrive: [11] response received: value = 7
I (11955) odrive: [12] axis0_current_state
I (11955) odrive: [12] response received: value = 7
I (12055) odrive: [13] axis0_current_state
I (12055) odrive: [13] response received: value = 7
I (12155) odrive: [14] axis0_current_state
I (12155) odrive: [14] response received: value = 7
I (12255) odrive: [15] axis0_current_state
I (12255) odrive: [15] response received: value = 7
I (12355) odrive: [16] axis0_current_state
I (12355) odrive: [16] response received: value = 7
I (12455) odrive: [17] axis0_current_state
E (12555) odrive: [17] no response received
E (12755) odrive: [17] no response received
E (12955) odrive: [17] no response received
E (13155) odrive: [17] no response received
E (13355) odrive: [17] no response received
E (13555) odrive: [17] no response received
E (13755) odrive: [17] no response received
E (13955) odrive: [17] no response received
E (14155) odrive: [17] no response received
E (14355) odrive: [17] no response received
E (14555) odrive: [17] no response received
E (14755) odrive: [17] no response received
E (14955) odrive: [17] no response received
E (15155) odrive: [17] no response received
E (15355) odrive: [17] no response received
E (15555) odrive: [17] no response received
E (15755) odrive: [17] no response received
E (15955) odrive: [17] no response received
E (16155) odrive: [17] no response received
E (16355) odrive: [17] no response received
E (16555) odrive: [17] no response received
E (16755) odrive: [17] no response received
E (16955) odrive: [17] no response received
E (17155) odrive: [17] no response received
E (17355) odrive: [17] no response received
E (17555) odrive: [17] no response received
E (17755) odrive: [17] no response received
E (17955) odrive: [17] no response received
E (18155) odrive: [17] no response received
E (18355) odrive: [17] no response received
E (18555) odrive: [17] no response received
E (18755) odrive: [17] no response received
E (18955) odrive: [17] no response received
E (19155) odrive: [17] no response received
E (19355) odrive: [17] no response received
E (19555) odrive: [17] no response received
E (19755) odrive: [17] no response received
E (19955) odrive: [17] no response received
E (20155) odrive: [17] no response received
E (20355) odrive: [17] no response received
E (20555) odrive: [17] no response received
E (20755) odrive: [17] no response received
E (20955) odrive: [17] no response received
E (21155) odrive: [17] no response received
E (21355) odrive: [17] no response received
E (21555) odrive: [17] no response received
E (21755) odrive: [17] no response received
I (21855) odrive: [17] response received: value = 1
I (21855) odrive: [18] axis0_motor_config_current_lim = 20.000000
E (21955) odrive: [18] no response received
E (22155) odrive: [18] no response received
I (22255) odrive: [18] response received
I (22255) odrive: [19] axis0_controller_config_vel_limit = 20.000000
I (22255) odrive: [19] response received
I (22255) odrive: [20] axis0_controller_config_control_mode = 3
E (22365) odrive: [20] no response received
E (22565) odrive: [20] no response received
E (22765) odrive: [20] no response received
E (22965) odrive: [20] no response received
E (23165) odrive: [20] no response received
E (23365) odrive: [20] no response received
E (23565) odrive: [20] no response received
E (23765) odrive: [20] no response received
E (23965) odrive: [20] no response received
E (24165) odrive: [20] no response received
E (24365) odrive: [20] no response received
E (24565) odrive: [20] no response received
E (24765) odrive: [20] no response received
E (24965) odrive: [20] no response received
E (25165) odrive: [20] no response received
E (25365) odrive: [20] no response received
E (25565) odrive: [20] no response received
E (25765) odrive: [20] no response received
E (25965) odrive: [20] no response received
E (26165) odrive: [20] no response received
E (26365) odrive: [20] no response received
E (26565) odrive: [20] no response received
E (26765) odrive: [20] no response received
E (26965) odrive: [20] no response received
E (27165) odrive: [20] no response received
E (27365) odrive: [20] no response received
E (27565) odrive: [20] no response received
E (27765) odrive: [20] no response received
E (27965) odrive: [20] no response received
I (28065) odrive: [20] response received
I (28065) odrive: [21] axis0_requested_state = 8
E (28165) odrive: [21] no response received
E (28365) odrive: [21] no response received
E (28565) odrive: [21] no response received
E (28765) odrive: [21] no response received
E (28965) odrive: [21] no response received
E (29165) odrive: [21] no response received
E (29365) odrive: [21] no response received
E (29565) odrive: [21] no response received
E (29765) odrive: [21] no response received
E (29965) odrive: [21] no response received
E (30165) odrive: [21] no response received
E (30365) odrive: [21] no response received
E (30565) odrive: [21] no response received
E (30765) odrive: [21] no response received
E (30965) odrive: [21] no response received
E (31165) odrive: [21] no response received
E (31365) odrive: [21] no response received
E (31565) odrive: [21] no response received
E (31765) odrive: [21] no response received
E (31965) odrive: [21] no response received
E (32165) odrive: [21] no response received
E (32365) odrive: [21] no response received
E (32565) odrive: [21] no response received
E (32765) odrive: [21] no response received
E (32965) odrive: [21] no response received
E (33165) odrive: [21] no response received
E (33365) odrive: [21] no response received
E (33565) odrive: [21] no response received
E (33765) odrive: [21] no response received
E (33965) odrive: [21] no response received
E (34165) odrive: [21] no response received
E (34365) odrive: [21] no response received
E (34565) odrive: [21] no response received
E (34765) odrive: [21] no response received
E (34965) odrive: [21] no response received
E (35165) odrive: [21] no response received
E (35365) odrive: [21] no response received
E (35565) odrive: [21] no response received
E (35765) odrive: [21] no response received
E (35965) odrive: [21] no response received
E (36165) odrive: [21] no response received
E (36365) odrive: [21] no response received
E (36565) odrive: [21] no response received
E (36765) odrive: [21] no response received
E (36965) odrive: [21] no response received
E (37165) odrive: [21] no response received
E (37365) odrive: [21] no response received
E (37565) odrive: [21] no response received
E (37765) odrive: [21] no response received
E (37965) odrive: [21] no response received
E (38165) odrive: [21] no response received
E (38365) odrive: [21] no response received
E (38565) odrive: [21] no response received
E (38765) odrive: [21] no response received
E (38965) odrive: [21] no response received
E (39165) odrive: [21] no response received
E (39365) odrive: [21] no response received
E (39565) odrive: [21] no response received
E (39765) odrive: [21] no response received
E (39965) odrive: [21] no response received
E (40165) odrive: [21] no response received
E (40365) odrive: [21] no response received
E (40565) odrive: [21] no response received
I (40665) odrive: [21] response received
I (40665) odrive: [22] axis0_current_state
E (40765) odrive: [22] no response received
E (40965) odrive: [22] no response received
E (41165) odrive: [22] no response received
E (41365) odrive: [22] no response received
E (41565) odrive: [22] no response received
E (41765) odrive: [22] no response received
E (41965) odrive: [22] no response received
E (42165) odrive: [22] no response received
E (42365) odrive: [22] no response received
E (42565) odrive: [22] no response received
E (42765) odrive: [22] no response received
E (42965) odrive: [22] no response received
E (43165) odrive: [22] no response received
E (43365) odrive: [22] no response received
E (43565) odrive: [22] no response received
E (43765) odrive: [22] no response received
E (43965) odrive: [22] no response received
E (44165) odrive: [22] no response received
E (44365) odrive: [22] no response received
E (44565) odrive: [22] no response received
E (44765) odrive: [22] no response received
E (44965) odrive: [22] no response received
E (45165) odrive: [22] no response received
E (45365) odrive: [22] no response received
E (45565) odrive: [22] no response received
E (45765) odrive: [22] no response received
E (45965) odrive: [22] no response received
E (46165) odrive: [22] no response received
E (46365) odrive: [22] no response received
E (46565) odrive: [22] no response received
E (46765) odrive: [22] no response received
E (46965) odrive: [22] no response received
E (47165) odrive: [22] no response received
E (47365) odrive: [22] no response received
E (47565) odrive: [22] no response received
E (47765) odrive: [22] no response received
E (47965) odrive: [22] no response received
E (48165) odrive: [22] no response received
E (48365) odrive: [22] no response received
E (48565) odrive: [22] no response received
E (48765) odrive: [22] no response received
E (48965) odrive: [22] no response received
E (49165) odrive: [22] no response received
I (49265) odrive: [22] response received: value = 8

I finally made progress: I found the bug in the firmware!

This is the function did_receive() in Firmware/communication/interface_uart.cpp. It’s basically called whenever some UART data is received and the buffer contains one or more bytes.

void Stm32UartRxStream::did_receive(uint8_t* buffer, size_t length) {
    // This can be called even if there was no RX operation in progress

    bufptr_t rx_buf = rx_buf_;

    if (completer_ && rx_buf.begin()) {
        rx_buf_ = {nullptr, nullptr};
        size_t chunk = std::min(length, rx_buf.size());
        memcpy(rx_buf.begin(), buffer, chunk);
        completer_.invoke_and_clear({kStreamOk, rx_buf.begin() + chunk});
    }
}

You see the std::min(length, rx_buf.size())? That seems to be the problem.

When more bytes are received than rx_buf is large, those excess bytes are cropped but not handled, so whenever chunk != length bytes are missed. I tried to fix this recursively by adding:

if (chunk != length) {
    did_receive(buffer + chunk, length - chunk);
}

Everything works perfectly and all packets are spot on, but after some time it completely stops working and completer_ and rx_buf seem to be null…

I don’t know the firmware well enough to fix this properly, @Samuel could you maybe take a look at this and possibly fix it?

Thank you in advance!

1 Like

I just created an issue referencing this post:

I am sorry for being impatient, but is anyone working on this?

We need to continue working on the project and ODrive is necessary.

Some extra info:
We just found out that the issue with the buffers getting null also happens with the original software and is not caused by our modifications. This seems to be a separate problem which hasn’t been discovered yet.
With the modifications it responds to every single request and stops working after about 10 seconds. When testing with the original software, the ODrive always responds sporadically at random intervals, but after some (more) time it also stops working and hasn’t responded for over 15 minutes now.

Please take a look at it very soon and inform us if someone is working on it. Otherwise we will have to find a workaround.

Time is getting precious, thank you!

Maybe reverting back to 0.5.1 is an option? You just need to disable the ascii output there.

1 Like

It will be some time before we can look at it. If you are able to find a workaround or post a PR, please let us know.

We decided to revert back to 0.5.1 and it’s finally working now, all packets are handled correctly.

Nevertheless, these two bugs still exist and we would be happy to see them fixed so we can upgrade to the latest firmware in the near future. For now we will stick with version 0.5.1, hoping all needed features are working correctly.

I just read someone referring to this thread, so this still seems to be an issue. I just wanted to inform anyone with the same problem that we still haven’t found a solution. We are no longer working on the project but it still uses version 0.5.1, no fix found yet.