NEW: FrSky Smart Port (AKA S.PORT) Support for MultiWii
NEW: FrSky Smart Port (AKA S.PORT) Support for MultiWii
I made a fork of the MultiWii code on Github and added my new (barely alpha) FrSky Smart Port code:
https://github.com/liftoff/multiwii-firmware
Hopefully someone with a better handle on the MultiWii code (and C++ in general) will take a look at that and make it more usable. Right now it supports VBAT, Vario, Barometer Altitude, T1 temperature (barely--very innacurate), and some other things. The code is also there to support T2, RPMs, and Fuel but MultWii doesn't have any support for those things (that I'm aware of) so they're commented out.
There's more GPS-specific code but I haven't tested it. In theory it should show your GPS altitude (GAlt in OpenTx) and your GPS-reported speed ("Spd").
For this to work you need a HARDWARE SERIAL INVERTER. Basically you need to invert both the Tx and Rx signals from a (UART) serial port on your MultiWii FC's to send/receive from the Smart Port. I made one myself with two transistors and some resistors... I'll see if I can post a circuit diagram (have to make one first).
Thank you to all the folks in #multiwii on Freenode for their help!
UPDATE: I've created a diagram of what I'm using to connect my flight controller's serial port to the Smart Port:
Here's a picture of what it looks like in the real world:
Combined with my custom Crius All-In-One-Pro 2.0 I/O board and custom wiring harnesses:
https://github.com/liftoff/multiwii-firmware
Hopefully someone with a better handle on the MultiWii code (and C++ in general) will take a look at that and make it more usable. Right now it supports VBAT, Vario, Barometer Altitude, T1 temperature (barely--very innacurate), and some other things. The code is also there to support T2, RPMs, and Fuel but MultWii doesn't have any support for those things (that I'm aware of) so they're commented out.
There's more GPS-specific code but I haven't tested it. In theory it should show your GPS altitude (GAlt in OpenTx) and your GPS-reported speed ("Spd").
For this to work you need a HARDWARE SERIAL INVERTER. Basically you need to invert both the Tx and Rx signals from a (UART) serial port on your MultiWii FC's to send/receive from the Smart Port. I made one myself with two transistors and some resistors... I'll see if I can post a circuit diagram (have to make one first).
Thank you to all the folks in #multiwii on Freenode for their help!
UPDATE: I've created a diagram of what I'm using to connect my flight controller's serial port to the Smart Port:
Here's a picture of what it looks like in the real world:
Combined with my custom Crius All-In-One-Pro 2.0 I/O board and custom wiring harnesses:
Re: NEW: FrSky Smart Port (AKA S.PORT) Support for MultiWii
Just a quick bump since I just updated the original post with pics and a circuit diagram.
Re: NEW: FrSky Smart Port (AKA S.PORT) Support for MultiWii
Thanks for sharing your FrSky Smart Port code! With it I was able to send GPS data back to my FrSky Taranis. I used your code and tweaked it to be more like a library that can be reused in other projects. Maybe you could port back my code to your MultiWii-fork since I managed to figure out how to encode the GPS coordinates after some head scratching.
The actual encoding looks like this:
I just used SoftwareSerial with the inversion bool set to true like this:
And two 1K resistors inline with RX and TX when connecting to the Smart Port data bus.
The actual encoding looks like this:
Code: Select all
uint32_t FrSkySport_EncodeCoordinate(float coord, bool latitude)
{
uint32_t ewns = latitude ? (coord > 0 ? 0 : 1) : (coord > 0 ? 2 : 3);
uint32_t c = (uint32_t)(abs(coord));
uint32_t D = c * 60;
uint32_t M = (c * 60) % 60;
uint32_t S = ((coord - c) * 60 - M) * 10000;
return (ewns << 30) | (D + M) * 10000 + S;
}
I just used SoftwareSerial with the inversion bool set to true like this:
Code: Select all
SoftwareSerial smartPortSerial(2, 4, true); // RX, TX
And two 1K resistors inline with RX and TX when connecting to the Smart Port data bus.
- Attachments
-
- FrSkyTelemetry.zip
- (3.45 KiB) Downloaded 586 times
It would probably be worth merging this in with the original FrSky telemetry code viewtopic.php?t=1929
Re: NEW: FrSky Smart Port (AKA S.PORT) Support for MultiWii
also it might be noted (if it is an issue or not) transmission via software serial library is blocking
also i cant seem to integrate software serial into mw
i just get errors indicating it cant find the library...
also i cant seem to integrate software serial into mw
i just get errors indicating it cant find the library...
Re: NEW: FrSky Smart Port (AKA S.PORT) Support for MultiWii
hi i having a problem with the serial port 3 or better the rx port, wen connecting i have a freze and nothing... are you have a solution for this, my board is a crius aio v.2, i have burn a new bootloader from ardunio (stk500boot_v2_mega2560.hex) nothing, the problem persist, wen not connected works fine with sbus ,
i have used an other serial port, and the problem persist... i don´t no...
i have the liftoff scatch, nice
i have used an other serial port, and the problem persist... i don´t no...
i have the liftoff scatch, nice
Re: NEW: FrSky Smart Port (AKA S.PORT) Support for MultiWii
just a quick post, my code for smart port reod into mw and osd: viewtopic.php?f=8&t=5164
inverters available: http://www.multiwiicopter.com/products/ ... r-paris-v5
inverters available: http://www.multiwiicopter.com/products/ ... r-paris-v5
Re: NEW: FrSky Smart Port (AKA S.PORT) Support for MultiWii
Hello,
can someone tell me, why the code for this is not part of the GIT?
Greetings,
Hendrik
can someone tell me, why the code for this is not part of the GIT?
Greetings,
Hendrik
Re: NEW: FrSky Smart Port (AKA S.PORT) Support for MultiWii
Hello,
any updates on this?
Im trying to get my MultiWii data via SmartPort on X8R receiver to my Taranis using the liftoff fork provided in the first post.
Until now I could not get it to work, so I'm asking for help.
Im using this converter, where I have A3_Tx connected to the RS232-side input as well as + and - from an empty motor port. I connected the output of TTL-side to the S.Port of my X8R receiver.
With this setup I do not get any data to my Taranis. Can anyone tell me what I'm doing wrong? Do I need another converter?
Thanks for your help!
any updates on this?
Im trying to get my MultiWii data via SmartPort on X8R receiver to my Taranis using the liftoff fork provided in the first post.
Until now I could not get it to work, so I'm asking for help.
Im using this converter, where I have A3_Tx connected to the RS232-side input as well as + and - from an empty motor port. I connected the output of TTL-side to the S.Port of my X8R receiver.
With this setup I do not get any data to my Taranis. Can anyone tell me what I'm doing wrong? Do I need another converter?
Thanks for your help!
Re: NEW: FrSky Smart Port (AKA S.PORT) Support for MultiWii
I am not getting the battery voltage on the MinimOSD using the FrSky S.Port patch to Multiwii 2.3. I am not getting the high and low cell voltages eventhough FLVSS is turned on. Does VBAT also needs to be turned on to make this work?
I reviewed sport.cpp and sport.h and did not find any GPS or baro related output from the Multiwii to S.Port. Is this working?
Update: I answered my question on VBAT. Once turned on, I did not see the battery voltage but instead the board voltage. I did not modify any of the VBAT parameters in the config.h. It's turned off now. The info from the FrSky battery sensor is dink free. I'm still trying the resolve the missing cell voltages on the OSD.
Update: The cell voltages are working now after I found Shikra's post (http://www.multiwii.com/forum/viewtopic.php?f=8&t=5164&p=60032#p57984) that the MSP_CELLS should be 130 instead of 121. After making that correction, both high and low voltages plus the number of cells appears on the OSD.
I reviewed sport.cpp and sport.h and did not find any GPS or baro related output from the Multiwii to S.Port. Is this working?
Update: I answered my question on VBAT. Once turned on, I did not see the battery voltage but instead the board voltage. I did not modify any of the VBAT parameters in the config.h. It's turned off now. The info from the FrSky battery sensor is dink free. I'm still trying the resolve the missing cell voltages on the OSD.
Update: The cell voltages are working now after I found Shikra's post (http://www.multiwii.com/forum/viewtopic.php?f=8&t=5164&p=60032#p57984) that the MSP_CELLS should be 130 instead of 121. After making that correction, both high and low voltages plus the number of cells appears on the OSD.
Last edited by whirligig on Mon Dec 22, 2014 7:52 pm, edited 2 times in total.
Re: NEW: FrSky Smart Port (AKA S.PORT) Support for MultiWii
which sport.h/cpp files are you referring too ?
Re: NEW: FrSky Smart Port (AKA S.PORT) Support for MultiWii
This one from MW OSD R1.2:
void processSerialData(uint8_t data);
void processSportPacket(uint8_t *packet);
void initSPort();
void checkSPort();
extern uint16_t cells[6];
extern alt_t sport_alt;
extern uint8_t SPORT_PRESENT;
#define SPORT_SERIAL_BAUD 57600
#define START_STOP 0x7e
#define BYTESTUFF 0x7d
#define STUFF_MASK 0x20
#define DATA_FRAME 0x10
#define ALT_FIRST_ID 0x0100
#define ALT_LAST_ID 0x010f
#define VARIO_FIRST_ID 0x0110
#define VARIO_LAST_ID 0x011f
#define CURR_FIRST_ID 0x0200
#define CURR_LAST_ID 0x020f
#define VFAS_FIRST_ID 0x0210
#define VFAS_LAST_ID 0x021f
#define CELLS_FIRST_ID 0x0300
#define CELLS_LAST_ID 0x030f
#define FRSKY_RX_PACKET_SIZE 9
#define SPORT_TIMEOUT 1000000 // 1 sec
#define SPORT_DATA_S32(packet) (*((int32_t *)(packet+4)))
#define SPORT_DATA_U32(packet) (*((uint32_t *)(packet+4)))
//following code is sport host related
//all sensor id's requested by x8r reciever
//0, 161, 34, 131, 228, 69, 198, 103, 72, 233, 106, 203, 172, 13, 142, 47, 208, 113, 242, 83, 52, 149, 22, 183, 152, 57, 186, 27
#define SPORT_HOST_INTERVAL 120000// 120000 //interval between sensor requests //x8r 12 millis
#define SPORT_SENSOR_ID 0xA1 //161 cell monitor //currently only coded for one option
void processSerialData(uint8_t data);
void processSportPacket(uint8_t *packet);
void initSPort();
void checkSPort();
extern uint16_t cells[6];
extern alt_t sport_alt;
extern uint8_t SPORT_PRESENT;
#define SPORT_SERIAL_BAUD 57600
#define START_STOP 0x7e
#define BYTESTUFF 0x7d
#define STUFF_MASK 0x20
#define DATA_FRAME 0x10
#define ALT_FIRST_ID 0x0100
#define ALT_LAST_ID 0x010f
#define VARIO_FIRST_ID 0x0110
#define VARIO_LAST_ID 0x011f
#define CURR_FIRST_ID 0x0200
#define CURR_LAST_ID 0x020f
#define VFAS_FIRST_ID 0x0210
#define VFAS_LAST_ID 0x021f
#define CELLS_FIRST_ID 0x0300
#define CELLS_LAST_ID 0x030f
#define FRSKY_RX_PACKET_SIZE 9
#define SPORT_TIMEOUT 1000000 // 1 sec
#define SPORT_DATA_S32(packet) (*((int32_t *)(packet+4)))
#define SPORT_DATA_U32(packet) (*((uint32_t *)(packet+4)))
//following code is sport host related
//all sensor id's requested by x8r reciever
//0, 161, 34, 131, 228, 69, 198, 103, 72, 233, 106, 203, 172, 13, 142, 47, 208, 113, 242, 83, 52, 149, 22, 183, 152, 57, 186, 27
#define SPORT_HOST_INTERVAL 120000// 120000 //interval between sensor requests //x8r 12 millis
#define SPORT_SENSOR_ID 0xA1 //161 cell monitor //currently only coded for one option
Re: NEW: FrSky Smart Port (AKA S.PORT) Support for MultiWii
riskable wrote:Just a quick bump since I just updated the original post with pics and a circuit diagram.
Could you tell me what transistors you are using in your bi-directional inverter? Thanks.
Re: NEW: FrSky Smart Port (AKA S.PORT) Support for MultiWii
Hello guys,
Fort the frsky smart port work on multiwii and minimosd I use this converter :
http://www.hobbyking.com/hobbyking/store/%5F%5F24523%5F%5FZYX%5FS%5FS%5FBUS%5FConnection%5FCable.html
Connected on smart port device and A1 port on fc.
Modifier multiwii config.h to A1 serial port.
Added sport.h/sport.cpp on multiwii code but you must modifier the other files manualy because the patch no working.
I have the entire multiwii code working with smart port on 2.3 navi b7 version.
I can post this code if you wan.
Fort the frsky smart port work on multiwii and minimosd I use this converter :
http://www.hobbyking.com/hobbyking/store/%5F%5F24523%5F%5FZYX%5FS%5FS%5FBUS%5FConnection%5FCable.html
Connected on smart port device and A1 port on fc.
Modifier multiwii config.h to A1 serial port.
Added sport.h/sport.cpp on multiwii code but you must modifier the other files manualy because the patch no working.
I have the entire multiwii code working with smart port on 2.3 navi b7 version.
I can post this code if you wan.
Re: NEW: FrSky Smart Port (AKA S.PORT) Support for MultiWii
Domstuff,
I'm using a similar inverter I made that is connecting the S.port on my FrSky voltage sensor to the 5v, ground, and Rx pins on Serial Port 3 on my Multiwii Pro. I am getting the battery voltage on the OSD but no cell voltage yet. The inverter is working fine but I believe it is only passing FrSky sensor data to the OSD. What I would like to do is take the GPS, ACC, and baro data from the Multiwii and send it to my telemetry screen on the Taranis. I believe this will require a bidirectional inverter where there is an extra wire going to the Tx pin on Serial Port 3. Does your code send this data?
I'm using a similar inverter I made that is connecting the S.port on my FrSky voltage sensor to the 5v, ground, and Rx pins on Serial Port 3 on my Multiwii Pro. I am getting the battery voltage on the OSD but no cell voltage yet. The inverter is working fine but I believe it is only passing FrSky sensor data to the OSD. What I would like to do is take the GPS, ACC, and baro data from the Multiwii and send it to my telemetry screen on the Taranis. I believe this will require a bidirectional inverter where there is an extra wire going to the Tx pin on Serial Port 3. Does your code send this data?
Re: NEW: FrSky Smart Port (AKA S.PORT) Support for MultiWii
To have the smartport info on your osd (cells voltage) it's necessary to have the complet multiwii code(don't use multiwii vbat parameter) and OSD code parameter correctly and you must use the defaut fonts for osd.
I experimente if I use a another fonts pack I lose the cells voltage.
For your sensors infos on Taranis,frsky is normaly directly compatible but I do not believe that it is possible to have the infos baro,gps from the fc on Taranis.
My code :
I experimente if I use a another fonts pack I lose the cells voltage.
For your sensors infos on Taranis,frsky is normaly directly compatible but I do not believe that it is possible to have the infos baro,gps from the fc on Taranis.
My code :
Re: NEW: FrSky Smart Port (AKA S.PORT) Support for MultiWii
I am just wondering whether time was not ripe to integrate also the S.PORT protocol into the 2 new files Telemetry.cpp/h of the multiwii main trunk http://www.multiwii.com/forum/viewtopic.php?f=8&t=6249 , which host currently the implementation of the old Frsky protocol.
The S.PORT protocol can be implemented to receive the data from the Frsky devices (current sensor, cell voltage sensor, air speed sensor, GPS sensor, etc) on the sensor hub in order to use them internally or to forward them via OSD like mentioned in this thread http://www.multiwii.com/forum/viewtopic.php?f=8&t=5164&hilit=SPORT#p51448
In that thread some code snipplets can be found. So, my question would be:
- Is there any newer version available?
- Is the code mature enough?
Since the S.PORT protocol is a two way protocol, it can also be implemented in a second way by sending the data measured by multiwii (via powermeter, GPS device, vbat and cell sonsor, etc) to the opentx / er9x transmitter (with related patch) or to the Frsky Dashboard.
In that thread I have not found any appropriate code. So, my question would be:
- Are there already code snipplets available?
Finally, you can imagine to combine both implementations in order to receive data from the Frsky sensors and to forward them not via OSD but to your opentx / er9x transmitter or to your Frsky dashboard. Has anybody done so and got some experience as to it? What about the performance?
Just to make it clear: I am still using the old protocol. So, there is help required in order to integrate and test the S.PORT code.
The S.PORT protocol can be implemented to receive the data from the Frsky devices (current sensor, cell voltage sensor, air speed sensor, GPS sensor, etc) on the sensor hub in order to use them internally or to forward them via OSD like mentioned in this thread http://www.multiwii.com/forum/viewtopic.php?f=8&t=5164&hilit=SPORT#p51448
In that thread some code snipplets can be found. So, my question would be:
- Is there any newer version available?
- Is the code mature enough?
Since the S.PORT protocol is a two way protocol, it can also be implemented in a second way by sending the data measured by multiwii (via powermeter, GPS device, vbat and cell sonsor, etc) to the opentx / er9x transmitter (with related patch) or to the Frsky Dashboard.
In that thread I have not found any appropriate code. So, my question would be:
- Are there already code snipplets available?
Finally, you can imagine to combine both implementations in order to receive data from the Frsky sensors and to forward them not via OSD but to your opentx / er9x transmitter or to your Frsky dashboard. Has anybody done so and got some experience as to it? What about the performance?
Just to make it clear: I am still using the old protocol. So, there is help required in order to integrate and test the S.PORT code.
Re: NEW: FrSky Smart Port (AKA S.PORT) Support for MultiWii
riskable wrote:
UPDATE: I've created a diagram of what I'm using to connect my flight controller's serial port to the Smart Port:
Sorry, I know this is an old post, but can you please clarify the resistor values? Are those values suggesting R1 is 10k, R2 is 4.7K, R3 is 1k, R4 is 1k, and R5 is 1k ? Or are the 5 resistors: 110k, 24.7k, 31k, 41k, 51k ?
Also, the s.port works on 3.3v not 5v - do the resistors in the diagram drop the voltage to 3.3v for this purpose, or has this requirement been overlooked?
Finally, for the naze32 running cleanflight, there is only telemetry output (I.e. one way from the FC to the s.port only), so can I just use the transistor and 3 resistors on the right hand side of your diagram (leaving out the RX side on the left)?
Thanks, Paul
Re: NEW: FrSky Smart Port (AKA S.PORT) Support for MultiWii
QuadBow wrote:I am just wondering whether time was not ripe to integrate also the S.PORT protocol into the 2 new files Telemetry.cpp/h of the multiwii main trunk http://www.multiwii.com/forum/viewtopic.php?f=8&t=6249 , which host currently the implementation of the old Frsky protocol.
The S.PORT protocol can be implemented to receive the data from the Frsky devices (current sensor, cell voltage sensor, air speed sensor, GPS sensor, etc) on the sensor hub in order to use them internally or to forward them via OSD like mentioned in this thread http://www.multiwii.com/forum/viewtopic.php?f=8&t=5164&hilit=SPORT#p51448
In that thread some code snipplets can be found. So, my question would be:
- Is there any newer version available?
- Is the code mature enough?
Since the S.PORT protocol is a two way protocol, it can also be implemented in a second way by sending the data measured by multiwii (via powermeter, GPS device, vbat and cell sonsor, etc) to the opentx / er9x transmitter (with related patch) or to the Frsky Dashboard.
In that thread I have not found any appropriate code. So, my question would be:
- Are there already code snipplets available?
Finally, you can imagine to combine both implementations in order to receive data from the Frsky sensors and to forward them not via OSD but to your opentx / er9x transmitter or to your Frsky dashboard. Has anybody done so and got some experience as to it? What about the performance?
Just to make it clear: I am still using the old protocol. So, there is help required in order to integrate and test the S.PORT code.
hey quadbow, for some reason i didnt get notification for this, ill have to look into if forum notes are still working.
yes im keen on this pming
Re: NEW: FrSky Smart Port (AKA S.PORT) Support for MultiWii
Hi Haydent,
That's good news. I am looking forward to receiving from you code I will integrate into the main trunk.
That's good news. I am looking forward to receiving from you code I will integrate into the main trunk.
Re: NEW: FrSky Smart Port (AKA S.PORT) Support for MultiWii
athertop wrote:riskable wrote:
Sorry, I know this is an old post, but can you please clarify the resistor values? Are those values suggesting R1 is 10k, R2 is 4.7K, R3 is 1k, R4 is 1k, and R5 is 1k ? Or are the 5 resistors: 110k, 24.7k, 31k, 41k, 51k ?
Also, the s.port works on 3.3v not 5v - do the resistors in the diagram drop the voltage to 3.3v for this purpose, or has this requirement been overlooked?
Hi Paul,
yesterday I built an inverter with this circuit. I used the first resistor values and it is working.
You will also have dificulties to find a 41k resistor.
Best Regards,
Lutz