handle the Multiwii Serial Protocol (MSP) with terminal prog

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
loeten
Posts: 11
Joined: Wed Dec 03, 2014 1:47 pm

handle the Multiwii Serial Protocol (MSP) with terminal prog

Post by loeten »

Hi all, just a simple question: Is it possible somehow to handle the serial protocol via a terminal program (lets say microcom or similar)?

i read here

http://www.multiwii.com/wiki/index.php?title=Multiwii_Serial_Protocol

and also in the thread mentioned there. My board works fine with the GUI (Version 2.3)

For some debug issues, i would like to be able to send some commands and read the response, in example write(type)

$M>100

(MSP_IDENT) and get back the protocol version. I tryed without success, i guess because too many time between the letters.. any chance/ what do i need to do different? The serial connection itself is ok, so i can load a sample sketch with "Serial.println..." and it prints.

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: handle the Multiwii Serial Protocol (MSP) with terminal

Post by Hamburger »

afaik it requires sending a checksum byte which may be difficult to compute manually and difficult to enter in the terminal program?

loeten
Posts: 11
Joined: Wed Dec 03, 2014 1:47 pm

Re: handle the Multiwii Serial Protocol (MSP) with terminal

Post by loeten »

Maybe yes, the wiki page (above) does not tell me.. and yes it maybe real difficult to input!

So I try on searching for a short piece of working code and a toolchain to send it against the board.. Recommandations?

loeten
Posts: 11
Joined: Wed Dec 03, 2014 1:47 pm

Re: handle the Multiwii Serial Protocol (MSP) with terminal

Post by loeten »

Maybe i ask too complicated (i am not used to this Arduino stuff yet!)

I just want to generate / see some debug messages.

First - i thought about writing "Serial.writeln.." where i need it, but it does not compile (not yet figured out, why..)

Then, i have seen - there is #ifdef DEBUGMSG and void debugmsg_append_str - so i guess i can enable DEBUGMG and transfer something with this function -

BUT WHERE CAN I SEE IT THEN? :-)

That's why i was thinking about the terminal - maybe there's an easyer way..?

waltr
Posts: 733
Joined: Wed Jan 22, 2014 3:21 pm
Location: Near Philadelphia, Pennsyvania, USA

Re: handle the Multiwii Serial Protocol (MSP) with terminal

Post by waltr »

I tried this over the weekend and come to the same conclusions.
1- a CkSum is required. I started digging through the MW code (protocol.ccp) to figure out how to do a checksum.
2- You can try using a terminal program that can send a binary file. Use a binary editor to create the file and send with the terminal program.
3- Try looking at the Source code for the MWconfig.exe
4- The next step I am going to try is writing some Python code to send the MSP's to figure out how they work.

The Wiki is really bad since it has NO INFO on how the MSP interchange works. I am a Wiki Editor and have the MSP section targeted for improvement.
If there is anyone that understands the details I would very much appreciate some help. Please either post here or PM me.

loeten
Posts: 11
Joined: Wed Dec 03, 2014 1:47 pm

Re: handle the Multiwii Serial Protocol (MSP) with terminal

Post by loeten »

Before doing some python staff, i would like to understand how the developers / contributers debugged their stuff..?

The most logical for me seems that somewhere in the GUI you have a tab or some place where the debug messages are printed. Maybe we're just to blind to see? :-)

About how to create a checksum: If you can read "Processing" - check the source code of the GUI, especially the

"sendRequestMSP" - function.

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: handle the Multiwii Serial Protocol (MSP) with terminal

Post by Hamburger »

the DEBUGMSG stuff should output on the console. If you run the MWiiconfig from a terminal window that is where you should see the debug messages appear.
Other ideas: if all you want to see is some values we have the debug[0]..[4] variables which also get displayed as nice graphs in the gui.
Or you could enable lcd.tty in config.h and use the outputXY() functions from LCD.cpp to write to a terminal at the serial interface (whether connected via ftdi-usb to a computer or via bluetooth to a smartphone with a vt100 app does not matter).

Last, if you had one of the supported serial or i2c displays then you could use the outputXY() functions again to output to that display.

loeten
Posts: 11
Joined: Wed Dec 03, 2014 1:47 pm

Re: handle the Multiwii Serial Protocol (MSP) with terminal

Post by loeten »

Ok, that seems to be the missing part of the puzzle. :-)

In config.h, i enabled DEBUG and DEBUGMSG. For test, i added this 2 lines at the start of void loop:

Code: Select all

void loop () {
  debugmsg_append_str("loop\n");
  debug[1]=255;
...


I can see the 2nd debug at 255 in teh GUI (hurra!), but i don't see a string output in the terminal window, All it says is:

Code: Select all

ControlP5 0.7.5 infos, comments, questions at http://www.sojamo.de/libraries/controlP5
WARNING:  RXTX Version mismatch
   Jar version = RXTX-2.2pre1
   native lib Version = RXTX-2.2pre2


Also the transmitter LED is not blinking - so what did i miss to see the text ("loop") permanently?

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: handle the Multiwii Serial Protocol (MSP) with terminal

Post by Hamburger »

dunno. The original implementor of DEBUGMSG seems to have left long ago. I have never used it - for me it is always either debug[] or an attached lcd/oled. If you want to follow that DEBUGMSG route further you could search for the implementation of that functionality and see if looking at it hard enough does trigger an idea? Maybe it outputs to a different serial interface by default?

loeten
Posts: 11
Joined: Wed Dec 03, 2014 1:47 pm

Re: handle the Multiwii Serial Protocol (MSP) with terminal

Post by loeten »

:-) you just answered when i posted a separate thread - but thanks. I think i can live with the 4 debug values at first,, and maybe somebody else knows.

polarisman30060
Posts: 4
Joined: Thu Dec 12, 2013 11:15 pm

Re: handle the Multiwii Serial Protocol (MSP) with terminal

Post by polarisman30060 »

I have a short python module for communicating with the FC . It is at github. Polarisman30060/mspmodule . It is written to be read by non-programmers like myself so should be easy to understand.

I use it to let my BBB talk to the FC.
Last edited by polarisman30060 on Mon Dec 08, 2014 5:04 pm, edited 1 time in total.

polarisman30060
Posts: 4
Joined: Thu Dec 12, 2013 11:15 pm

Re: handle the Multiwii Serial Protocol (MSP) with terminal

Post by polarisman30060 »

polarisman30060 wrote:I have a short python module for communicating with the FC . It is at github. Polarisman30060/mspmodule . It is written to be read by non-programmers like myself so should be easy to understand.

Post Reply