Description
While trying to write to 6 ODrives using the Arduino GIGA R1 WiFi, I found that only the first 3 messages would successfully be transmitted. At first, I realized that I wasn't checking the output of the ODriveCAN::setPosition
function that internally calls can_intf.write
, which calls the sendMsg
function defined in ODriveHardwareCAN.hpp
, but then I realized that since the underlying Arduino_CAN write function (which calls the mbed::CAN write function) returns 1 on success and 0 on failure. This means that the last line in the sendMsg
function (return can_intf.write(msg) >= 0;
) causes this function to always return true without checking if the message was queued or not. By removing the >=
and checking the output to wait until messages were sent, I was able to get my project working. I'm not sure how high the sendMsg
is in the firmware stack, so I'm not sure if removing the >=
would fix only my platform and break others, but if it would work I think it would be a very important fix. I also understand that 6 ODrives may not be the most common setup, but the code as it is does not work properly on my platform.
Let me know if more information is needed, thank you!