christianrauch / msp

Implementation of the MultiWii Serial Protocol (MSP) for MultiWii and Cleanflight flight controller
http://www.multiwii.com/wiki/index.php?title=Multiwii_Serial_Protocol
GNU Lesser General Public License v3.0
80 stars 27 forks source link

Issue MSP communication Arduino Leonardo #56

Open DJacquemont opened 1 year ago

DJacquemont commented 1 year ago

Hi !

I am having issues when trying to communicate over USB from my computer (running Ubuntu 22.04) to a brand new Arduino Leonardo. My LOOP_TIME is 2800, the Baudrate is 115200 on both devices, and my MultiWii firmware is version 2.4.

I am using the master branch from this repository. I have tried adding a delay between opening a connection and sending messages, and disabling the Data Terminal Ready (DTR) line via stty -F /dev/ttyUSB0 -hupcl, however nothing seems to work and I thus doubt this is the issue.

To make the problem more understandable, I have se the LoggingLevel to DEBUG, and I have added the following line of code under the message ID extraction in the function processOneMessageV1 std::cout << "Intercepted message ID: " << size_t(id) << std::endl;

When I connect the Arduino and execute the file client_read_test (4 times to show the issue), here is my output:

terminal

I execute ^C because the algorithm stops and nothing more happens afterward. It seems like the buffer always keeps the older messages (and thus has nothing if the Arduino just got connected i.e. the first run)

I am wondering if this could be an error induced by a new library version. Could you please help me solve this issue ?