New Multiwii Serial Protocol
Re: New Multiwii Serial Protocol
Subscribing. As I'm about to implement a minimalistic configuration tool using Python on Symbian, this is going to be useful.
-
- Posts: 2261
- Joined: Sat Feb 19, 2011 8:30 pm
Re: New Multiwii Serial Protocol
Alex, what are the implications of sending this information over the I2C bus?
Re: New Multiwii Serial Protocol
LenzGr wrote:Subscribing. As I'm about to implement a minimalistic configuration tool using Python on Symbian, this is going to be useful.
Hi LenzGr,
I do not know about your motivation for implementing a 'minimalistic configuration tool' for sybian. But wanted to let you know you could probably circumvent the effort by using the existing LCD_CONF and LCD_VT100 implementation. That way you would only need to find a vt100 aware terminal program and connect your symbinan phone via BT. As a side effect you'd get live telemetry for free as well. I started a thread over at RCG with some photos of various smartphones doing this.
Re: New Multiwii Serial Protocol
I thinks it's a good idea.
A new high efficency serial protocol is a must!
Good work Alex!
I think it is time to introduce a new GUI also... do you think?
A new high efficency serial protocol is a must!
Good work Alex!
I think it is time to introduce a new GUI also... do you think?
Re: New Multiwii Serial Protocol
Dear Alex,
did you spoken about this with EOSBandi? That would be great if this new serial protocol would be supported by WinGUI!!!
BR
Adrian
did you spoken about this with EOSBandi? That would be great if this new serial protocol would be supported by WinGUI!!!
BR
Adrian
-
- Posts: 1630
- Joined: Wed Jan 19, 2011 9:07 pm
Re: New Multiwii Serial Protocol
nicodh wrote:Hi Alex, I like this, It's going to be easy to transmit data (it's hard to dissassemble the char string with the current protocol)
When it will be release? I mean, I will need to modify my new android configurator (witch is for naze32 at the base) to keep the compatibility with multiwwi original.
Hi,
My plan is to finalize it rapidly in order to have a good common and independent basis for OSD/GUI/phone apps/...
-
- Posts: 1630
- Joined: Wed Jan 19, 2011 9:07 pm
Re: New Multiwii Serial Protocol
copterrichie wrote:I strongly believe this is a major step in the right direction and opens the door to a wide variety of Wii Telemetry options.
Thanks Alex,
Question, is this new protocol presently implemented in the MultiConf?
It's currently implemented in the last dev release.
-
- Posts: 1630
- Joined: Wed Jan 19, 2011 9:07 pm
Re: New Multiwii Serial Protocol
copterrichie wrote:Just one more thing Alex, when I tried compiling the code with "#define I2C_GPS" enabled, I receive the following error message.
MultiWii:451: error: 'GPS_reset_home_position' was not declared in this scope
it was a typo error, it's solved now
-
- Posts: 1630
- Joined: Wed Jan 19, 2011 9:07 pm
Re: New Multiwii Serial Protocol
nhadrian wrote:Dear Alex,
did you spoken about this with EOSBandi? That would be great if this new serial protocol would be supported by WinGUI!!!
BR
Adrian
I tried to document well the code about the protocol implementation.
It should be quite easy to implement and replace in WinGUI.
Re: New Multiwii Serial Protocol
Hamburger wrote:I do not know about your motivation for implementing a 'minimalistic configuration tool' for sybian. But wanted to let you know you could probably circumvent the effort by using the existing LCD_CONF and LCD_VT100 implementation. That way you would only need to find a vt100 aware terminal program and connect your symbinan phone via BT. As a side effect you'd get live telemetry for free as well. I started a thread over at RCG with some photos of various smartphones doing this.
Yes, I'm familiar with your work - I did read about it when I tried to figure out how I could use my Nokia mobile phone (an N71) as a configuration utility (I don't want to lug a Laptop into the field just for tweaking PID parameters). Unfortunately I could not find any terminal application for Symbian that supports establishing serial communications over Bluetooth. And before I start implementing a vt100 terminal emulation in Python, I'd rather try to use the native serial protocol to update the few widgets I'm interested in
Re: New Multiwii Serial Protocol
Hi
At the moment i try to read the data from multiwii with the new Multiwii Protocoll .
But for the moment my programm doesnt work
I try it with this code :
can anyone help me ?
Thanks !
At the moment i try to read the data from multiwii with the new Multiwii Protocoll .
But for the moment my programm doesnt work
I try it with this code :
Code: Select all
int Byte;
void setup() {
Serial.begin(115200); // Serial Monitor
Serial1.begin(115200); // Mwii
}
void loop() {
/* Data request */
Serial1.write('$');
Serial1.write('M');
Serial1.write('>');
Serial1.write(102); // 9 DOF IMU Data Massage request
/* Read Data from Mwii */
while (Serial1.available() > 0) {
Byte = Serial1.read();
Serial.println(Byte); // Print data from Multiwii
}
}
can anyone help me ?
Thanks !
Re: New Multiwii Serial Protocol
maybe your code is too fast? If the other side does not respond quickly enough, your while loop has nothing to execute. You may have to insert something like 'while (!Serial1.available() ) /*do nothing*/;'
Re: New Multiwii Serial Protocol
Hi,
would it be possible to have the communication on MEGA on Serial3 as well? or as an Option?
this would allow to permanently wire a zig-bee, bluetooth or APC 220 to that port
kind regards Christoph
would it be possible to have the communication on MEGA on Serial3 as well? or as an Option?
this would allow to permanently wire a zig-bee, bluetooth or APC 220 to that port
kind regards Christoph
Re: New Multiwii Serial Protocol
i'm going to try to integrate that into Rushduino OSD
-
- Posts: 1630
- Joined: Wed Jan 19, 2011 9:07 pm
Re: New Multiwii Serial Protocol
LuFa wrote:Hi
At the moment i try to read the data from multiwii with the new Multiwii Protocoll .
But for the moment my programm doesnt work
I try it with this code :Code: Select all
int Byte;
void setup() {
Serial.begin(115200); // Serial Monitor
Serial1.begin(115200); // Mwii
}
void loop() {
/* Data request */
Serial1.write('$');
Serial1.write('M');
Serial1.write('>');
Serial1.write(102); // 9 DOF IMU Data Massage request
/* Read Data from Mwii */
while (Serial1.available() > 0) {
Byte = Serial1.read();
Serial.println(Byte); // Print data from Multiwii
}
}
can anyone help me ?
Thanks !
Serial1.write('<');
-
- Posts: 1630
- Joined: Wed Jan 19, 2011 9:07 pm
Re: New Multiwii Serial Protocol
dynai wrote:Hi,
would it be possible to have the communication on MEGA on Serial3 as well? or as an Option?
this would allow to permanently wire a zig-bee, bluetooth or APC 220 to that port
kind regards Christoph
It would be possible, but currently the code can handle only one port via TX interrupt (needed for communication)
The mod should not be complicated
Re: New Multiwii Serial Protocol
Very good work Alex !!
By cons, when the link is bad, I receive incorrect values.
Do you use the checksum to validate incoming messages ?
just for information, there must be a display issue on GPS.
By cons, when the link is bad, I receive incorrect values.
Do you use the checksum to validate incoming messages ?
just for information, there must be a display issue on GPS.
-
- Posts: 1630
- Joined: Wed Jan 19, 2011 9:07 pm
Re: New Multiwii Serial Protocol
Synthex wrote:Very good work Alex !!
By cons, when the link is bad, I receive incorrect values.
Do you use the checksum to validate incoming messages ?
just for information, there must be a display issue on GPS.
Hi,
Thank you for pointing me the GUI lat/long bug.
It was a typo in the GUI.
Every message with a data payload are checksummed, and the GUI should keep the old values until a good is received.
I don't have explanations for the moment about your "spike"
Re: New Multiwii Serial Protocol
Would that typo also explain why reset and calib.acc do not work in gui?
Re: New Multiwii Serial Protocol
Hi, also there is possibly a BUG in debug values either on MW or GUI side because al the debug parameters are constantly zero and doesn't matter what I define in sketch for debug...
BR
Adrian
BR
Adrian
Re: New Multiwii Serial Protocol
I dont have a baro but tested a walue on debug2 and it works
Re: New Multiwii Serial Protocol
i am unable to connect to mwc using the new serial protocol from MultiWii_dev_20120414.zip, witjout any modification .. i try with the gui , with the arduino ide console , with some python code , i try with 8mhz , 16mhz 328p with a usb ftdi and with a direct omap uart , i even boot in a real windows32 .. no luck .. the old serial work without a flaw , when i send back the char parsed in the code i can reach oldSerialCom, but it do not go in the header detection loop .. :'(
does anyone have the same issue ?
does anyone have the same issue ?
Re: New Multiwii Serial Protocol
Can you add "armed" to the datas
-
- Posts: 1630
- Joined: Wed Jan 19, 2011 9:07 pm
Re: New Multiwii Serial Protocol
Hi,
in fact it is.
It's in the MSP-STATUS message:
serialize16(accMode<<BOXACC|baroMode<<BOXBARO|magMode<<BOXMAG|armed<<BOXARM|
GPSModeHome<<BOXGPSHOME|GPSModeHold<<BOXGPSHOLD|headFreeMode<<BOXHEADFREE);
The ARM status will be activated even if you don't have any ARM box checked.
in fact it is.
It's in the MSP-STATUS message:
serialize16(accMode<<BOXACC|baroMode<<BOXBARO|magMode<<BOXMAG|armed<<BOXARM|
GPSModeHome<<BOXGPSHOME|GPSModeHold<<BOXGPSHOLD|headFreeMode<<BOXHEADFREE);
The ARM status will be activated even if you don't have any ARM box checked.
Re: New Multiwii Serial Protocol
Thanks I miss that
Re: New Multiwii Serial Protocol
any update on the non-functioning 'Calib ACC' and 'Reset' buttons in GUI?
For whatever reason pressing any of these does not have any effect. Cannot currently test the 'Calib MAG' button. Triggering the ACC calibration via TX sticks combo still works, so that code in MWii on the arduino side is still working as expected. Just never gets triggered from GUI via Serial Protocol.
For whatever reason pressing any of these does not have any effect. Cannot currently test the 'Calib MAG' button. Triggering the ACC calibration via TX sticks combo still works, so that code in MWii on the arduino side is still working as expected. Just never gets triggered from GUI via Serial Protocol.
-
- Posts: 1630
- Joined: Wed Jan 19, 2011 9:07 pm
Re: New Multiwii Serial Protocol
Everything is working fine on my side.
But I don't use extra features like telemetry, it's maybe the problem.
But I don't use extra features like telemetry, it's maybe the problem.
Re: New Multiwii Serial Protocol
Any idea why the debug values are not working? I'm currently tinkering with a new I²C sonar and it'd be nice to see which values are generated by it.
Re: New Multiwii Serial Protocol
when running at 8mhz the new serial protocol only seems to work at 57600bds
when running @112500 it never get after stateMSP==1 ..
when running @112500 it never get after stateMSP==1 ..
Code: Select all
switch(c) { // header detection $MW<
case '$':
if (stateMSP == 0) stateMSP++; break; // first octet ok, no need to go further
case 'M':
if (stateMSP == 1) stateMSP++; break; // second octet ok, no need to go further
case '<':
// we never get here ..
if (stateMSP == 2) stateMSP++; break; // third octet ok, no need to go further
}
Re: New Multiwii Serial Protocol
The status display for the checkboxitems via highlighting the label to the left does not work for passThrough and Beeper. The data are not sent on the MWC side?
Re: New Multiwii Serial Protocol
kos wrote:when running at 8mhz the new serial protocol only seems to work at 57600bds
ok , this is caused by either the serial interupt library not handling long serial burst correctly or having the serialCom not fast enough .
solved by changing multiwiiconf to write char one by one
the new serial work on 328p 8Mhz 115200 with this modification
edit : not a good solution
Code: Select all
serialize8('$');serialize8('M');serialize8('<');serialize8(MSP_IDENT);
serialize8('$');serialize8('M');serialize8('<');serialize8(MSP_STATUS);
serialize8('$');serialize8('M');serialize8('<');serialize8(MSP_RAW_IMU);
serialize8('$');serialize8('M');serialize8('<');serialize8(MSP_SERVO);
serialize8('$');serialize8('M');serialize8('<');serialize8(MSP_MOTOR);
serialize8('$');serialize8('M');serialize8('<');serialize8(MSP_RC);
serialize8('$');serialize8('M');serialize8('<');serialize8(MSP_RAW_GPS);
serialize8('$');serialize8('M');serialize8('<');serialize8(MSP_COMP_GPS);
serialize8('$');serialize8('M');serialize8('<');serialize8(MSP_ALTITUDE);
serialize8('$');serialize8('M');serialize8('<');serialize8(MSP_BAT);
serialize8('$');serialize8('M');serialize8('<');serialize8(MSP_DEBUG);
for(i=0;i<indTX;i++) {g_serial.write(char(outBuf_[i]));}
based on my experiment , this bug can lead to this beahaviour -> viewtopic.php?f=16&t=1666
one should monitor how many MSP_PACKET are never answerd
edit : still not happy with the way it work at 8mhz
Last edited by kos on Sat May 12, 2012 3:22 am, edited 1 time in total.
-
- Posts: 2261
- Joined: Sat Feb 19, 2011 8:30 pm
Re: New Multiwii Serial Protocol
I am trying to figure out when and how this following subroutine is called and used. Any ideas? Seems to be useful but I see no evidence it is presently being used.
Thank you.
Thank you.
Code: Select all
void SerialWrite(uint8_t port,uint8_t c){
switch (port) {
case 0: serialize8(c);UartSendData(); break; // Serial0 TX is driven via a buffer and a background intterupt
#if defined(MEGA) || defined(PROMICRO)
case 1: while (!(UCSR1A & (1 << UDRE1))) ; UDR1 = c; break; // Serial1 Serial2 and Serial3 TX are not driven via interrupts
#endif
#if defined(MEGA)
case 2: while (!(UCSR2A & (1 << UDRE2))) ; UDR2 = c; break;
case 3: while (!(UCSR3A & (1 << UDRE3))) ; UDR3 = c; break;
#endif
}
Re: New Multiwii Serial Protocol
in LCD .. deprecated spoted
#elif defined(LCD_TEXTSTAR) || defined(LCD_VT100)
SerialWrite(0, i );
#elif defined(LCD_TEXTSTAR) || defined(LCD_VT100)
SerialWrite(0, i );
-
- Posts: 2261
- Joined: Sat Feb 19, 2011 8:30 pm
Re: New Multiwii Serial Protocol
Thank you, I looked every where but the LCD file.
Re: New Multiwii Serial Protocol
Sorry for the slight off-topic question, but on a MEGA board which has I think 3 serial ports, is it possible for using multiple at once,..
For example one for connecting an osd to the board, another for connecting and using a bluetooth board and the third for connecting the GPS for rth and position hold (gps would be shared between osd and multiwii).
For example one for connecting an osd to the board, another for connecting and using a bluetooth board and the third for connecting the GPS for rth and position hold (gps would be shared between osd and multiwii).
Re: New Multiwii Serial Protocol
kos wrote:in LCD .. deprecated spoted
#elif defined(LCD_TEXTSTAR) || defined(LCD_VT100)
SerialWrite(0, i );
what makes you call that deprecated? Is it not the standard way to output serial data anymore? By which strategy/implementation is it superseeded now?
-
- Posts: 2261
- Joined: Sat Feb 19, 2011 8:30 pm
Re: New Multiwii Serial Protocol
I am looking at ways of sending the telemetry data to a different serial port on the mega
Serial0 - normal USB
Serial1 - PPM
Serial2 - GPS
Serial3 - ODS/Telemetry
Any help is greatly appreciated.
Thank you.
Serial0 - normal USB
Serial1 - PPM
Serial2 - GPS
Serial3 - ODS/Telemetry
Any help is greatly appreciated.
Thank you.
-
- Posts: 2261
- Joined: Sat Feb 19, 2011 8:30 pm
Re: New Multiwii Serial Protocol
Seems to me, I should be able to test for which port the require for data is coming from, then send the reply for that port.
Correct?
Code: Select all
while (SerialAvailable(0)) { <- Change to (SerialAvailable(port)
c = SerialRead(0); <- Change to SerialRead(port)
.
.
.
tailSerialReply(); <- Change to tailSerialReply(port)
.
.
.
Correct?
-
- Posts: 2261
- Joined: Sat Feb 19, 2011 8:30 pm
Re: New Multiwii Serial Protocol
I made all of the required changes in the serial handler and it is working great. What I need now is a smart way to automatically switch the port number based upon which port requires servicing.
I need to be able to switch between port 0 and port 3, at present, I can manually change these numbers, compile and load the code.
Code: Select all
void serialCom() {
uint8_t i, c, port = 0; <- Need a smart way to change this number.
static uint8_t offset,dataSize;
while (SerialAvailable(port)) {
c = SerialRead(port);
I need to be able to switch between port 0 and port 3, at present, I can manually change these numbers, compile and load the code.
Re: New Multiwii Serial Protocol
Code: Select all
if(rcData[AUX4]< 1500){port=0;}else{port=1;}
-
- Posts: 2261
- Joined: Sat Feb 19, 2011 8:30 pm
Re: New Multiwii Serial Protocol
Interesting, thank you.
However, I was thinking more along the likes of checking a flag or an Interrupt.
However, I was thinking more along the likes of checking a flag or an Interrupt.
-
- Posts: 2261
- Joined: Sat Feb 19, 2011 8:30 pm
Re: New Multiwii Serial Protocol
Question, using this example "UCSR0B |= (1<<UDRIE0);", how would I send data to Serial Port 3?
Thank you.
Edited: I got it now.
I need to add something similar to this to handle the port.
This is for Serial0, so I need to duplicate it for Serial3
Thank you.
Edited: I got it now.
I need to add something similar to this to handle the port.
This is for Serial0, so I need to duplicate it for Serial3
Code: Select all
ISR_UART {
if (headTX != tailTX) UDR0 = bufTX[tailTX++]; // Transmit next byte in the ring
if (tailTX == headTX) UCSR0B &= ~(1<<UDRIE0); // Check if all data is transmitted . if yes disable transmitter UDRE interrupt
}
Code: Select all
#if !defined(PROMICRO)
ISR_UART {
if (headTX != tailTX) UDR0 = bufTX[tailTX++]; // Transmit next byte in the ring
if (tailTX == headTX) UCSR0B &= ~(1<<UDRIE0); // Check if all data is transmitted . if yes disable transmitter UDRE interrupt
}
#if defined(MEGA)
ISR_UART3 {
if (headTX != tailTX) UDR3 = bufTX[tailTX++]; // Transmit next byte in the ring
if (tailTX == headTX) UCSR3B &= ~(1<<UDRIE3); // Check if all data is transmitted . if yes disable transmitter UDRE interrupt
}
#endif
-
- Posts: 2261
- Joined: Sat Feb 19, 2011 8:30 pm
Re: New Multiwii Serial Protocol
Here is a copy of the draft Serial.ino, bench testing on Serial0 and Serial3. In theory, it can be configured to work on all of the four serials but there is only coded for Serial0 and Serial3.
Config.h File:
Main File under Setup:
And the attached Serial.ino file.
Config.h File:
Code: Select all
// Serial Telemery Information Sent to another serial port (Mega)
#define TELEMERY_SERIAL 3
#define TELEMERY_BAUD 115200
Main File under Setup:
Code: Select all
#if defined(TELEMERY_SERIAL)
SerialOpen(TELEMERY_SERIAL,TELEMERY_BAUD);
#endif
And the attached Serial.ino file.
- Attachments
-
- MegaSerial.zip
- Telemetry on Serial3
- (4.69 KiB) Downloaded 582 times
Re: New Multiwii Serial Protocol
So this mod enables telemetry on serial 3 right? Are you going to send that data to yourself with bluetooth or what are you going to use it for?
-
- Posts: 2261
- Joined: Sat Feb 19, 2011 8:30 pm
Re: New Multiwii Serial Protocol
msev wrote:So this mod enables telemetry on serial 3 right? Are you going to send that data to yourself with bluetooth or what are you going to use it for?
No, it is going to the onboard Arduino nano for ODS and for Antenna tracking.
viewtopic.php?f=6&t=1611
Re: New Multiwii Serial Protocol
msev wrote:Sorry for the slight off-topic question, but on a MEGA board which has I think 3 serial ports, is it possible for using multiple at once,..
For example one for connecting an osd to the board, another for connecting and using a bluetooth board and the third for connecting the GPS for rth and position hold (gps would be shared between osd and multiwii).
This seems to have been overlooked. I'm also interested as I've started flying MEGAs and would like to make better use of its serial channels. Is this re-write going to enable xbee telemetry or at least the ability to pass serial communications off to a BT module on serial 2 or 3 (0 is standard and 1 is tied up with PPM SUM).
If this is not the intended functionality then I may start tinkering myself but I don't want to work something that is already being attended to.
With the now very functional and maturing GPS code I think telemetry is going to become more and more important as waypoint navigation becomes possible.
PS - very exciting time for MultiWii - my favourite and first choice for flying robots.
Re: New Multiwii Serial Protocol
Hi ,
i try to Controll the Mwii via the new Protocol .
i can read datas from multiwii without any proplems but i cant send anythink to Mwii .
Can anyone tell me how i have to calculate the Checksum for send datas to Mwii ?
i use a second arduino to do this , a example code will be also very nice
Thanks !
i try to Controll the Mwii via the new Protocol .
i can read datas from multiwii without any proplems but i cant send anythink to Mwii .
Can anyone tell me how i have to calculate the Checksum for send datas to Mwii ?
i use a second arduino to do this , a example code will be also very nice
Thanks !
Re: New Multiwii Serial Protocol
you can grab the code from multiwii , look at serializeN() function
$M<[payloadlenght][mspId][payload][cheksum]
payloadlenght = payload / 8
cheksum = for (char c :payload){ checksum ^= int(c); }
ex : with mspId = MSP_SET_RC_TUNING the payload lenght is 7
here is java implementation that i use in myMultiWiiConf.pde, a liitle readable than the previous checksum calculation
$M<[payloadlenght][mspId][payload][cheksum]
payloadlenght = payload / 8
cheksum = for (char c :payload){ checksum ^= int(c); }
ex : with mspId = MSP_SET_RC_TUNING the payload lenght is 7
here is java implementation that i use in myMultiWiiConf.pde, a liitle readable than the previous checksum calculation
Code: Select all
// MSP_SET_RC_TUNING
payload = new ArrayList<Character>();
payload.add(char( round(confRC_RATE.value()*100)) );
payload.add(char( round(confRC_EXPO.value()*100)) );
payload.add(char( round(rollPitchRate.value()*100)) );
payload.add(char( round(yawRate.value()*100)) );
payload.add(char( round(dynamic_THR_PID.value()*100)) );
payload.add(char( round(throttle_MID.value()*100)) );
payload.add(char( round(throttle_EXPO.value()*100)) );
requestMSP(MSP_SET_RC_TUNING,payload.toArray( new Character[payload.size()]) );
Code: Select all
//send with/without payload
void requestMSP(int msp, Character[] payload) {
if(msp < 0) {
return;
}
StringBuffer bf = new StringBuffer().append(MSP_HEADER);
if (payload != null){
bf.append(char(payload.length)).append(char(msp));
byte checksum=0;
for (char c :payload){
bf.append(c);
checksum ^= int(c);
}
bf.append(char(int(checksum)));
}else{
bf.append(char(msp));
}
Re: New Multiwii Serial Protocol
Hello,
May I make a request for adding MSP_INFO to the protocol?
What I need, is to be able to diferentiate the type of board (8bits or 32bits) and maybe the firmware release (at least the date of compilation for example).
For example create a variable like boardtype that would be 8 or 32 depending on the type of processor.
I know that change the revision number would be a pain, so instead you could add the compilation date, which is included by the compiler at build time.
This way it would be possible to show or hide features (like the command line interpreter for 32bits version) in my android development and my all in one windows configurator.
I would really appreciate this. Thanks.
May I make a request for adding MSP_INFO to the protocol?
What I need, is to be able to diferentiate the type of board (8bits or 32bits) and maybe the firmware release (at least the date of compilation for example).
For example create a variable like boardtype that would be 8 or 32 depending on the type of processor.
I know that change the revision number would be a pain, so instead you could add the compilation date, which is included by the compiler at build time.
This way it would be possible to show or hide features (like the command line interpreter for 32bits version) in my android development and my all in one windows configurator.
I would really appreciate this. Thanks.
Re: New Multiwii Serial Protocol
HI,
I commited a small change in the serial.ino, now it is able to process single commands. Perviously to finish a command processing it needed the first byte of the next command to come in.
EOSBandi
I commited a small change in the serial.ino, now it is able to process single commands. Perviously to finish a command processing it needed the first byte of the next command to come in.
EOSBandi