FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell graph)

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell graph)

Post by haydent »

Hi all, just pointing out this mod for flyers and devs.

Give it a fly ! :D

I would also be interested in getting the MultiWii patch side of it integrated into Multiwii. That is the part that translates the S.Port serial data into Multiwii.

A guide to setting it up is here: https://code.google.com/p/multiwii-osd/wiki/Frsky_SPort

Currently it supports Volts, Cell Volts (upto 6), Amps, Vario & Alt (via the corresponding frsky sensor modules)

Once the data is in multiwii, it is added to the MSP, and available to be displayed for example as a cell volt graph in your osd:

Image
Image

User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by haydent »

shameless bump, come on... someone has to be interested in this...

User avatar
shikra
Posts: 783
Joined: Wed Mar 30, 2011 7:58 pm

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by shikra »

I'm interested! - I think its awesome. Ordered a frsky rx .....

User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by haydent »

dont forget to order the inverter too

User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by haydent »

im working on a mod for mw to make it read sport sensors without a frsky reciever

User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by haydent »

did it, mw can now communicate with sport sensors direct via serial, no s.port reciever needed! https://code.google.com/p/multiwii-osd/ ... SPort_Host

PeterWeb
Posts: 11
Joined: Wed Jul 02, 2014 7:43 am

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by PeterWeb »

haydent wrote:did it, mw can now communicate with sport sensors direct via serial, no s.port reciever needed! https://code.google.com/p/multiwii-osd/ ... SPort_Host


Nice work, thank you. I have the alternate inverter on order and will be keen to give it a try.

User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by haydent »

Great

domstuff
Posts: 10
Joined: Sun Oct 19, 2014 10:07 am

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by domstuff »

Hello,

First of all thank you very much for yours work

I would like to put this places from there on my minimosd but I have a problem with the patch.

when I apply the patch to multiwii 2.3,no problem with the "sport patch" but the "gps patch" no working.

This patch aslo no working on MultiWii2_3-navi-b7 version :(

I tested the last patch found here https://code.google.com/p/multiwii-osd/source/browse/#hg%2FMWC_Patches%2Ffrsky_sport

Other question : you have envisaged to put the frsky gps v2 on your osd ?

Thanks for your reply

User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by haydent »

glad to hear from you and that you had some success. with the gps time patch, i assume you have the showing of the time enabled ? and you are using multiwii-osd ?

i would be surprised if it did work with navi as i have not tried to make it patch that fork, but no doubt it could be done

i would happily put gps in it, but i do not have that module

domstuff
Posts: 10
Joined: Sun Oct 19, 2014 10:07 am

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by domstuff »

Thanks for your reply,

I use Multiwii-OSD R1.2.I have to look at what is modified in multiwii 2.3 and I have make the modifications manually.
For the version "multiwii navi b7" it is more complicated because the code is different.

GPS time working and I have the "general" cell voltage,I do not manage to have the graph cell of the FLVSS frsky.

I have installed the R1.2 directly,I must install old the version initially ?

User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by haydent »

if you have the overall voltage working the data link is working which is good, the cells may not be showing as maybe a problem with that version of the osd. i havent done anything with it recently, so likely there are some changes that need making to update it to various versions. you could try temporarily try R1 or R1.1 just to see if it make the graph work. i really must make some updates on this soon. as i want to get these mw mods added to next main mw release.

User avatar
shikra
Posts: 783
Joined: Wed Mar 30, 2011 7:58 pm

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by shikra »

Hi - in MWOSD, the MSP code for CELLS has changed - it is now 130. If you have existing multiwii code that used to work - need to update that MSP value.

Sorry, but unfortunately there was a clash with the new navi feature added for 2.4. Unfortunately they got the code officially first !

User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by haydent »

thanks for clarifying that !

domstuff
Posts: 10
Joined: Sun Oct 19, 2014 10:07 am

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by domstuff »

Ok thanks,

I await the update.

do not hesitate if you want test ;)

domstuff
Posts: 10
Joined: Sun Oct 19, 2014 10:07 am

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by domstuff »

Good evening has all,

I succeeded in one setting up this OSD code with multiwii_navi_b7 by integrating the code manually ;)

All functions,RSSI,frsky batery voltage and cells graph ,GPS time ....

Really cool to have these infos in FPV.

GO TO FLYYYYYY :D

User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by haydent »

well done diy

whirligig
Posts: 14
Joined: Fri Nov 21, 2014 6:52 pm

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by whirligig »

shikra wrote:Hi - in MWOSD, the MSP code for CELLS has changed - it is now 130. If you have existing multiwii code that used to work - need to update that MSP value.

Sorry, but unfortunately there was a clash with the new navi feature added for 2.4. Unfortunately they got the code officially first !


Thanks Shikra, I used your value of 130 for MSP_CELLS and the high/low cell values now show up on the OSD.

The MWOSD is beautiful. I should get off by butt and go flying!

mikez104
Posts: 29
Joined: Sat Feb 14, 2015 3:52 am

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by mikez104 »

Ok, this is really cool and I'm really trying to get it to work. My setup is
Witespy EZ 3.0 Black flight controller
Frsky X4R SB receiver with lipo battery sensor, variometer and 40amp current sensor
witespy minim OSD - the older one
I'm using vanilla version of multiwii 2.3
I downloaded the patches and installed with the TortoiseMerge.exe program.
I added SPort.cpp and SPort.h to the multiwii folder.
The I uncommented the #define SPORT_SERIAL 1 and the #define SPORT_FLVSS lines. Then compiled and uploaded. After all that, moving the sticks on my radio no longer affects the inputs in multiwii wingui. I tried to comment out the two lines above and then it won't compile anymore. I can't figure what I am doing wrong.

Last night when I tried (I redid the whole thing twice again tonight) after I did all the patching and whatnot, my sticks would affect the inputs but not correctly. Throttle input would result in several channels bouncing all over. Almost like the baud rate was getting jacked up.

Any ideas? I really want to make this work!

Thanks
Mike

User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by haydent »

ok firstly, how have you got your witespy connected to your s.port lines ? you will need to have this connected to a spare and chosen serial port with a logic inverter as pointed out in docs.

also try commenting sport_serial line again and see if your controls work correctly.

mikez104
Posts: 29
Joined: Sat Feb 14, 2015 3:52 am

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by mikez104 »

Thanks for the quick reply :)
The witespy board has an sbus port on it which ties to serial 1 so you can use serial 1 for something OR use sbus. I only have the receiver plugged into the sbus port. Nothing else plugged into serial1. I believe the sbus has the built in inverter then connects to serial 1.

When I comment out the sport_serial line with the patches installed, it won't compile. Here is the short version of the error.

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Arduino: 1.0.6 (Windows XP), Board: "Arduino Mega 2560 or Mega ADK"
SPort.cpp: In function 'void initSPort()':
SPort.cpp:26: error: 'SPORT_SERIAL' was not declared in this scope
SPort.cpp: In function 'void checkSPort()':
SPort.cpp:55: error: 'SPORT_SERIAL' was not declared in this scope

And here is a link to the verbose error.
https://dl.dropboxusercontent.com/u/83528764/frsky_error.txt

User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by haydent »

ok, you found i bug there, initSport() and checkSport() should be enclosed in a ifdef, can you make it look like this:

Code: Select all

....

#if defined(SPORT_SERIAL)

void initSPort(void) {

    SerialEnd(SPORT_SERIAL);
    SerialOpen(SPORT_SERIAL, SPORT_SERIAL_BAUD);
    delay(500);
   
    for(uint8_t j=0;j<=5;j++){
      checkSPort();
      LEDPIN_ON
      delay(20);
      LEDPIN_OFF
      delay(80);
    }
    if(!SPORT_PRESENT){//relase comport if sport device not detected
             SerialEnd(SPORT_SERIAL);
             SerialOpen(SPORT_SERIAL,SERIAL0_COM_SPEED);
    }
}

void checkSPort(void) {
 
     while (SerialAvailable(SPORT_SERIAL)) {
        uint8_t data = SerialRead(SPORT_SERIAL);
        processSerialData(data);
     }
   
    if((currentTime-lastPacket) > SPORT_TIMEOUT && lastPacket){
      lastPacket=0;
      memset(cells, 0, sizeof(cells));
      analog.vbat = 0;
      sport_alt.vario = 0;
      sport_alt.EstAlt = 0;
      analog.amperage = 0;
    }

}

#endif

....

mikez104
Posts: 29
Joined: Sat Feb 14, 2015 3:52 am

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by mikez104 »

You mean change the SPort.cpp file? I think I found the right section but mine looks different than that. Should I take all of your code and replace the whole block or just add "#if defined(SPORT_SERIAL)". Here is what the section from mine looks like.

Code: Select all

/*
SPort code from https://code.google.com/p/opentx/source/browse/trunk/src/telemetry/frsky_sport.cpp (Many Thanks)
Adapted for MultiiWii by haydent www.httech.com.au
*/

uint8_t frskyRxBuffer[FRSKY_RX_PACKET_SIZE];   // Receive buffer. 9 bytes (full packet), worst case 18 bytes with byte-stuffing (+1)

uint8_t SPORT_PRESENT = 0;

uint32_t lastPacket = 0;
uint16_t cells[6];
alt_t sport_alt;

void initSPort(void) {
 
    LEDPIN_ON
    SerialEnd(SPORT_SERIAL);
    SerialOpen(SPORT_SERIAL, SPORT_SERIAL_BAUD);
    delay(500);
   
    for(uint8_t j=1;j<=100;j++){//check 100 times if sport active, takes about 70 but extra is not noticed     
      checkSPort();     
      delayMicroseconds(SPORT_HOST_INTERVAL);     
    }
   
    if(!SPORT_PRESENT){//relase comport if sport device not detected
             SerialEnd(SPORT_SERIAL);
             SerialOpen(SPORT_SERIAL,SERIAL0_COM_SPEED);
    }   
    LEDPIN_OFF
}

void checkSPort(void) {

  #ifdef SPORT_HOST
      static uint32_t lastRequest = 0;

      if((currentTime-lastRequest) > SPORT_HOST_INTERVAL || !SPORT_PRESENT){
         
          SerialWrite(SPORT_SERIAL, START_STOP);//request header
          SerialWrite(SPORT_SERIAL, SPORT_SENSOR_ID);//sensor id
          lastRequest = currentTime;         
      }
  #endif
 
    while (SerialAvailable(SPORT_SERIAL)) {
        uint8_t data = SerialRead(SPORT_SERIAL);
        processSerialData(data);
     }
   
    if((currentTime-lastPacket) > SPORT_TIMEOUT && lastPacket){
      lastPacket=0;
      memset(cells, 0, sizeof(cells));
      analog.vbat = 0;
      sport_alt.vario = 0;
      sport_alt.EstAlt = 0;
      analog.amperage = 0;
    }

}
 
// Receive buffer state machine state enum

User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by haydent »

so before "void initSPort(void) {" put "#if defined(SPORT_SERIAL)"

and before "// Receive buffer state machine state enum" put "#endif" (no quotes)

then that should let the sport code disable with commenting of SPORT_SERIAL value, then you can test if it is interfering with your controls or not.

mikez104
Posts: 29
Joined: Sat Feb 14, 2015 3:52 am

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by mikez104 »

Got it. Ok it compiled fine. I can now comment out the SPORT_SERIAL and I have control again.

User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by haydent »

ok dokie progress. so quick question. what protocol & connection are you using for control ?

mikez104
Posts: 29
Joined: Sat Feb 14, 2015 3:52 am

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by mikez104 »

sbus on serial 1.

User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by haydent »

well you cant run sbus and s.port on the same serial ...

mikez104
Posts: 29
Joined: Sat Feb 14, 2015 3:52 am

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by mikez104 »

Ok, I though it was kind of the same thing. So the only way to do that from the same receiver wold be to use ppm for control and then run the s.port through the sbus input I guess. And I can't do that because the receiver is an X4R and would not have enough channels. I was thinking that all the data came out of that one port and I could just have it all come through the same port.

User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by haydent »

sbus and s.port use different serial speeds and protocols, so are not compatible.

you can however run them on different serial ports, so sbus on 1 and s.port on 0 or 3. which ever you have spare. you will though need another serial inverter.

mikez104
Posts: 29
Joined: Sat Feb 14, 2015 3:52 am

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by mikez104 »

So I would have to disconnect the telemetry units from my x4r and attach them to an inverter on another serial. I guess i could do that but then I'd lose the telemetry back to the radio. Or could the telemetry gear be attached to the receiver and also an inverter going to a serial port?

User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by haydent »

yes you can either have the flight controller connected inline with the other sensors and the reciever's s.port connections and it eaves drops the data or as a standalone host for the sensors without the rx

mikez104
Posts: 29
Joined: Sat Feb 14, 2015 3:52 am

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by mikez104 »

Well that's cool but now I need ore serial ports. I have 4 but am using 0 for bluetooth, 1 for sbus, 2 for gps and 3 for OSD. Although, maybe I can scab the OSD into the bluetooth and disconnect the TX from the OSD to the FC. Well, regardless, I need an inverter. So off to find one of those. I think I will disable the sbus control from serial 1 and make that s.port and make sure I can see the data on the OSD before I go further though. I thank you for your help with this. It's a good addition to this great OSD/FC software! :D

User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by haydent »

yes, shortage of ports. what do you use bt for ? if it just for configuring, you can just disconnect it b4 each flight and plug the s.port connection in

mikez104
Posts: 29
Joined: Sat Feb 14, 2015 3:52 am

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by mikez104 »

I use bt for setting options and PIDs with EZ gui. Really good program. When you think about it, Do I really need half the crap I have attached? Ha. But to me, Making all this stuff work and building is just as fun as flying.

User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by haydent »

sure, thats what i use it for too, but you dont need it connected while flying, so just unhook it and connect up the s.port connection

mikez104
Posts: 29
Joined: Sat Feb 14, 2015 3:52 am

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by mikez104 »

I havent messed with it until tonight. I decided to remove the Sbus from the sbus input which goes to serial1 via an inverter and replace it with the sport data to see if I could get it to pass through to the OSD. I Think I may have got the main voltage to come through. It was all reading zero then I went into the OSD GUI and told it to use multiwii and I got a voltage that seemed correct. I did not get any current readying or lipo voltage. Not sure what I'm doing wrong. Also, should rssi pass through?

User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by haydent »

rssi is not put into s.port protocol which is stupid i know complain to frsky. what sensors are you using ? i currently only coded it for the ones i have, yours may be different ?

mikez104
Posts: 29
Joined: Sat Feb 14, 2015 3:52 am

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by mikez104 »

I have the vairometer, the 40 amp current sensor and the lipo battery voltage reader with the cool display.

User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by haydent »

yep thats what i got too, for current did you enable that sensor ?

mikez104
Posts: 29
Joined: Sat Feb 14, 2015 3:52 am

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by mikez104 »

In the config.h file? Yes, I enabled all 3 lines. From there I just choose "from multiwii" in the odd GUI fight? I should have brought it with me. I'm on the road all week and won't be home until Friday night. Would have given me something to work on at the hotel.

User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by haydent »

sounds like the ones. we might be stuck without debugging it. le me know when you are home with it.

mikez104
Posts: 29
Joined: Sat Feb 14, 2015 3:52 am

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by mikez104 »

Will do. Thanks again for all your help.

mikez104
Posts: 29
Joined: Sat Feb 14, 2015 3:52 am

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by mikez104 »

Ok, here's what I have going on. I took some pictures of what I have hooked up, output and screenshot of multiwii OSD gui.I removed the VARIO for the time being. I get an accurate voltage reading from the battery but no graph or averages. I verified this by disconnecting the ballance tap from the battery module. When I do that the voltage goes to 0v. I am getting no current reading at all although I do get it on my TX via the telemetry.
https://dl.dropboxusercontent.com/u/83528764/mwosd.JPG
https://dl.dropboxusercontent.com/u/835 ... 112414.jpg
https://dl.dropboxusercontent.com/u/835 ... 112348.jpg

mikez104
Posts: 29
Joined: Sat Feb 14, 2015 3:52 am

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by mikez104 »

I saw the zero adjust and amps adjust and zeroed those out thinking that might be it but that had no affect.

User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by haydent »

well it sounds and looks like you have it hooked up ok if you are getting a correct voltage. i will have to hook it up myself to see if its still working.

mikez104
Posts: 29
Joined: Sat Feb 14, 2015 3:52 am

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by mikez104 »


User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by haydent »

cheers

User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

Re: FrSky S.Port Data into MultiWii, MSP & OSD (inc. cell gr

Post by haydent »

ok, first a quick test of your osd, if in the osd gui when its hooked up if you choose "simulate frsky cells" and "simulate on osd" do you get the cell graphs ?


Post Reply