Mlink-FrSky-Telemetry converter

General Help and support for the Taranis Radio.
User avatar
MikeB
9x Developer
Posts: 17992
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Mlink-FrSky-Telemetry converter

Post by MikeB »

Here is a code snippet from openTx, processing the hub data:

Code: Select all

  if (byte == 0x5e) {
    state = TS_DATA_ID;
    return;
  }
  if (state == TS_IDLE) {
    return;
  }
  if (state & TS_XOR) {
    byte = byte ^ 0x60;
    state = (TS_STATE)(state - TS_XOR);
  }
  if (byte == 0x5d) {
    state = (TS_STATE)(state | TS_XOR);
    return;
  }
It looks WRONG to me. A 0x5D 0x3D pair is processed incorrectly. The 0x5D puts the state to include TS_XOR, then when processing the 0x3D, it is converted to 0x5D, and THEN this is detected as a 0x5D and the TS_XOR put back, instead of just processing the byte.

I think an else needs to be added:

Code: Select all

    state = (TS_STATE)(state - TS_XOR);
  }
  else if (byte == 0x5d) {
Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

Tobi
Posts: 56
Joined: Sun Jul 26, 2015 8:17 pm
Country: -

Re: Mlink-FrSky-Telemetry converter

Post by Tobi »

Hello Mike,

sounds sensible, so the error lies in OptenTX - ok, I am wating for update ;) .
(Eaven regarding this OpenTX is still the best ever :D ).

I now finished my babelfisch in Form of an Arduino MiniPro 5V 16MHz Atmega328. If anyone is interested in, I put all files together (code, my own MLink-Library, schematic - its verry simple).
Use at own risk! At this time it is not verry long tested. The MLinkExMin folder is to be copied in arduino library folder as usual. Example codes are included eaven to build own MLink sensors.
If anyone findes some errors (and I am shure there are some...), he is welcome to tell me. I will fix it as soon as possible.

I did some special about rssi. In my first tests I found that the rssi-warning comes verry often. I expectet this, because ACT transmit the reciving quality as it is. Normaly - depending on antenna position - the value changes in a wide range between 100% and some times down to 5%. That is not ab problem, its normal. But the warning level in OptenTX can only set to a minimum of 12%. To fix this, I did two things:

1. rssi is filterd in a ring buffer and liniarized up to 2km maximum range (on 100mW Tx-power it goes to 0 at ca. 2km)
2. the raw rssi is additional send on ID 0x3F so every one can setup his own warning.
( I do not know if 0x3F is reservated to an other ID. If it is, please tell me, so I will change this .)

By the way, using rssi for range warning is not quiet sensible, because the retrieve power is normaly less than the Tx power. So if rssi goes kritical telemetry gives up long time before. If telemetry gets lost, this is a (not critical) trigger for coming home but not rssi ;) . Mr. Westerteicher from ACT told so day after day but nobody listen to him ;) .

Now I go for more testing...

best regards

Tobi
Attachments
Mlink-FrSky-converter.zip
(31.93 KiB) Downloaded 408 times
User avatar
Kilrah
Posts: 11108
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Mlink-FrSky-Telemetry converter

Post by Kilrah »

Tobi wrote: By the way, using rssi for range warning is not quiet sensible, because the retrieve power is normaly less than the Tx power. Mr. Westerteicher from ACT told so day after day but nobody listen to him ;)
It might be the case for Multiplex stuff, but FrSky uses the same power both ways... and it's how it should be IMO, those who don't are doing it wrong ;)
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Mlink-FrSky-Telemetry converter

Post by jhsa »

Tobi wrote:
By the way, using rssi for range warning is not quiet sensible, because the retrieve power is normaly less than the Tx power. So if rssi goes kritical telemetry gives up long time before. If telemetry gets lost, this is a (not critical) trigger for coming home but not rssi ;) . Mr. Westerteicher from ACT told so day after day but nobody listen to him ;) .

Now I go for more testing...

best regards

Tobi
I'm really glad telemetry gives up before we lose control, and when that happens it's really time to land. But as Kilrah said both TX and RX power is equal, and I also think that is the way it should be.. It makes for a very accurate report..

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
Tobi
Posts: 56
Joined: Sun Jul 26, 2015 8:17 pm
Country: -

Re: Mlink-FrSky-Telemetry converter

Post by Tobi »

If both ways are on the same power it is a bit more sensible. I eaven do not know how the RSSI signal is processt by FrSky. Maybe it is more averaged.
Yesterday I did some flights (with a floater in storm - not a good idea, but it survived) - OpenTX telemetry processing is verry verry usefull (and the babelfish works ;) ). First time I could realy use telemetry in air without looking on display or getting a text overflow. Verry good work of all OpenTX-experts!
First programming the babelfish was just something like playing around, but now I am verry glad that I made it (with great help from Mike and Kilrah :) ) to use OpenTX telemetry functionality.

Best regards

Tobi

Tobi
Posts: 56
Joined: Sun Jul 26, 2015 8:17 pm
Country: -

Re: Mlink-FrSky-Telemetry converter

Post by Tobi »

Hello Mike, helle Kilrah,

since the new version 2.11 there must be a little update of my MLink-FrSky translation code. I will send this for download as soon as possible.
The bug in byte stuffin is fixed- Thanks for this quick work! Now it works fine.

Testing it in the last weeks, I found some additional problems:

1. There are some bugs in my MLink library - I used it for more than one year and did not see them until now - I am sorry. I will fix it in my update.

2. Negative values for altitude leads to values greater than 65000! This could only be, if there is a wrong type casting in telemetriy code of OpenTX, I beleve. Please tell me if I am wrong. To fix this, I only send absolut values at this time.

3. If send 3,6V sometimes it appears a wrong value (25,6V and 29,2V). It seems to be a bug in MLink-processing because I made a log of sendet and recived data with correlation. This shows, that the sendet value is every time correkt, but it is not every time recived correct. I will comunicate this with ACT.

4. On Mlink-protocol it is possible to send up to 16 different voltage values. I tried to map this using the Cell-ID of FrSky-D protocoll. But only sometimes it apppears a sensor called "Cell". The visualized values do not correspond wiht the send data. And some minutes later, it stops. I also tried to send the cell-number but I did not find any thing wich schows the cell number in OpenTX telemetry display.
This is my code for sending a 16bit value in which the first 4 bits are the cell number and the last 12bits are the voltage value:

((((uint16_t)zelle&0x000F)<<12)&0xF000) | ((Uf>1)&0x0FFF))

And for testing :
0x1000 | ((Uf>1)&0x0FFF))

Do I something wrong?

Until I did not fixed this, I send now of all voltage valuses everty time only the smalest, because using a cell analysing sensor, the weakest value is the sensiblest. And if there is only one value measured, it is every time send anyway.
Using ACT-MLink the first two values in data stream are every time reciver voltage and rssi. If this is so, this voltage value will be ignored for searching the weakes voltage value.

Best regards

Tobi
User avatar
Kilrah
Posts: 11108
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Mlink-FrSky-Telemetry converter

Post by Kilrah »

Tobi wrote:2. Negative values for altitude leads to values greater than 65000! This could only be, if there is a wrong type casting in telemetriy code of OpenTX, I beleve. Please tell me if I am wrong. To fix this, I only send absolut values at this time.
Sensors have a "Positive" attribute/checkbox you would need to uncheck if you want to send negative values.
Tobi wrote:4. On Mlink-protocol it is possible to send up to 16 different voltage values. I tried to map this using the Cell-ID of FrSky-D protocoll. But only sometimes it apppears a sensor called "Cell". The visualized values do not correspond wiht the send data.
The FrSky protocol doesn't specify more than 6 cells per "logical" sensor. You should group your cells in packs of 6 and increment the data ID by one for each new one. They will appear as separate "Cels" sensors in OpenTX.
User avatar
dinamich
Posts: 288
Joined: Mon Apr 01, 2013 1:21 pm
Country: Slovenia
Location: Ljubljana

Re: Mlink-FrSky-Telemetry converter

Post by dinamich »

projectkk2glider@github
Tobi
Posts: 56
Joined: Sun Jul 26, 2015 8:17 pm
Country: -

Re: Mlink-FrSky-Telemetry converter

Post by Tobi »

Kilrah wrote:
The FrSky protocol doesn't specify more than 6 cells per "logical" sensor. You should group your cells in packs of 6 and increment the data ID by one for each new one. They will appear as separate "Cels" sensors in OpenTX.
Could you give me some mere information? I do not understand how to transmit a data ID. At this point I only know how to send a cell-ID in first 4 bit and the data on the rest.

The bug of negative altitude values is fixed - again I am verry impressed of the fast reaction. I do not know any comercial producer, who would react as fast as you! :D

Best regards

Tobi
User avatar
Kilrah
Posts: 11108
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Mlink-FrSky-Telemetry converter

Post by Kilrah »

Ah I just had a look at your code and see that it uses the D protocol, for some reason I thought it was smart port. My "hack" suggestion referred to smart port, with the D protocol I'm afraid there won't be a way to support more than 6 cells.
Tobi
Posts: 56
Joined: Sun Jul 26, 2015 8:17 pm
Country: -

Re: Mlink-FrSky-Telemetry converter

Post by Tobi »

6 cells would be ok, but eaven if I send f.e. three times values with different IDs, only one "Cell"-sensor is found.

If I send:
Uf = 4000

cell_ID=0x00
(cell_ID<<12) | (Uf>>1)

cell_ID=0x01
(cell_ID<<12) | (Uf>>1)

cell_ID=0x02
(cell_ID<<12) | (Uf>>1)

it shows only one sensor called "Cels" but no data - activating "Discover new sensors".

Best regards

Tobi
User avatar
Kilrah
Posts: 11108
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Mlink-FrSky-Telemetry converter

Post by Kilrah »

What do you mean "3 times values with different IDs"? What "ID" are you referring to?
Tobi
Posts: 56
Joined: Sun Jul 26, 2015 8:17 pm
Country: -

Re: Mlink-FrSky-Telemetry converter

Post by Tobi »

Maybe I did not understand the FrSky-docu in the correct way, but there I found for sensor-ID 0x0006
the following structure: upper 4 bits are the cell-number ( I calld it cell ID - maybe al little confunsig - sorry ;) ) and the lower 12bits are the voltage value.
So when I send a voltage three times with different cell numbers (1,2,3, etc.), I expected that there will be three "Cels"-sensors in OpenTX-telemetry menu.
User avatar
Kilrah
Posts: 11108
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Mlink-FrSky-Telemetry converter

Post by Kilrah »

OK. Then no, you'll have only one cell sensor, that contains all cells and reports the total voltage. You can then get "details" (lowest, highest, highest-lowest, and any individual cell) using Calculated sensors you create with formula "Cells"
aduncan
Posts: 59
Joined: Fri Dec 30, 2011 8:15 pm
Country: -
Location: Strathaven, Scotland

Re: Mlink-FrSky-Telemetry converter

Post by aduncan »

Tobi. I have ordered an HFMG3 M-Link module for my Taranis, and would like to get telemetry from my M-Link receivers. Are you ready for public consumption?
Tobi
Posts: 56
Joined: Sun Jul 26, 2015 8:17 pm
Country: -

Re: Mlink-FrSky-Telemetry converter

Post by Tobi »

So, this is the update. There was bugs in my own MLink-library and a view changes was necessary since OptenTX 2.1.2 . Negative values for altitude are now possible.

Best regards

Tobi
Attachments
Mlink-FrSky-converter 1.0 18.09.2015.zip
MLink-FrSky-Converter
(35.63 KiB) Downloaded 400 times
aduncan
Posts: 59
Joined: Fri Dec 30, 2011 8:15 pm
Country: -
Location: Strathaven, Scotland

Re: Mlink-FrSky-Telemetry converter

Post by aduncan »

Thank you. I will report back when my module arrives. I have a spare Arduino proMini to use.

Regards
Andrew
Tobi
Posts: 56
Joined: Sun Jul 26, 2015 8:17 pm
Country: -

Re: Mlink-FrSky-Telemetry converter

Post by Tobi »

Hello Andrew,

please report if you find any errors. I use a proMini 328 5V. The power consumption is verry small, so you can leave it swtiched on when ever the Taranis is aktive (supply by Taranis S.Port).

@ Kilrah:
You can then get "details" (lowest, highest, highest-lowest, and any individual cell) using Calculated sensors you create with formula "Cells"
Using LUA script? I can not find any other kind of formula... :?:


Best regards

Tobi
User avatar
Kilrah
Posts: 11108
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Mlink-FrSky-Telemetry converter

Post by Kilrah »

Create a new telemetry sensor on the telemetry page, and select what I mentioned in its settings.
Tobi
Posts: 56
Joined: Sun Jul 26, 2015 8:17 pm
Country: -

Re: Mlink-FrSky-Telemetry converter

Post by Tobi »

Ok, I understand and I found the option, but I am sorry, it still do not work. I send three times voltage values with different cell numbers but only one time a value is shown. Then it stops and the sensor 0x0006 is not longer analysed.
aduncan
Posts: 59
Joined: Fri Dec 30, 2011 8:15 pm
Country: -
Location: Strathaven, Scotland

Re: Mlink-FrSky-Telemetry converter

Post by aduncan »

aduncan wrote:Thank you. I will report back when my module arrives. I have a spare Arduino proMini to use.

Regards
Andrew
Tobi. My module arrived and I have made up the ProMini board. I have a problem with your arduino file. It stops with error messages when I try to upload it. I'm using the latest Arduino 1.6.5. Do I need to use an earlier version? Thank you
Andrew
jonathanyeo
Posts: 82
Joined: Sat Nov 14, 2015 12:26 pm
Country: -

Re: Mlink-FrSky-Telemetry converter

Post by jonathanyeo »

Tobi, Andrew,

Did you manage to solve the challenge and have the Taranis work nicely with the HFM3 M-LINK RF module , and displaying the telemetry on the internal display and using it just like frsky telemetry.

Jonathan
Tobi
Posts: 56
Joined: Sun Jul 26, 2015 8:17 pm
Country: -

Re: Mlink-FrSky-Telemetry converter

Post by Tobi »

Hello Andrew,

I am sorry that I had no look to the aktivity on this thread - I was verry buisy in the last weeks...
I did the programming with 1.6.5, too. Which error message did you get?

Best regards

Tobi
aduncan
Posts: 59
Joined: Fri Dec 30, 2011 8:15 pm
Country: -
Location: Strathaven, Scotland

Re: Mlink-FrSky-Telemetry converter

Post by aduncan »

Hi Toby,

The problem is I don't know very much about Arduino. I've only used it to flash the diy vario. From memory I tried to open some of your .ino files, and got compilation errors.

I've actually sold all my Mpx receivers, so am off the project. Thanks for your kind help anyway.

Andrew
Tobi
Posts: 56
Joined: Sun Jul 26, 2015 8:17 pm
Country: -

Re: Mlink-FrSky-Telemetry converter

Post by Tobi »

Hello Andrew,

ok I see. I am sorry, that I am too late - I hope, that you did not sold all MPX recivers because of this problem...
If anyone else has the same problem: Close the arduino editor and copy the folder "MlinkExMin" from the zip-file in the library-folder of your arduino SDK (for example c:\programms\arduino\library ). Than start the arduino editor and try again. It should be fixed now.

best regards

Tobi
aduncan
Posts: 59
Joined: Fri Dec 30, 2011 8:15 pm
Country: -
Location: Strathaven, Scotland

Re: Mlink-FrSky-Telemetry converter

Post by aduncan »

Hi Toby,

I still have the JR/MPX module, and yesterday I found another M-Link 7 channel telemetry receiver. So I followed your instructions and flashed the Arduino board. When I ran Arduino I selected your folder, but it gave me 2 choices - MSBeinlesen and SensorDaten. The first one compiled and flashed without problem, but Sensor Daten gave errors. I assume that MSBeinlesen was the correct choice.

I coupled it to the JR/M-Link module and the Taranis, but no telemetry. I'm using 2.1.3 firmware. In radio settings I set the serial port to Telemetry. Set the internal XJT to off and the JR Module to PPM. In the telemetry page I only had the choice of S.port, Frsky D, or Frsky D Cable. I set it to search for new sensors, but nothing came up.

I wait your comments. I'm only doing this because I do not like to leave things unfinished, and I'm curious!!!

Andrew
Tobi
Posts: 56
Joined: Sun Jul 26, 2015 8:17 pm
Country: -

Re: Mlink-FrSky-Telemetry converter

Post by Tobi »

Hello Andrew,

making a MLink-FrSky translator you have to use the code "MLinkFrSkyConverter.ino" wich uses the MlinkExMin library. The examples of the library are not necessary for this project.

The examples includet in the MlinkExMin library are made to gererate a RX-MLink stream for sensors or to analyse a MLink stream coming from TX-modul if you whant to make a stand allone tememetry processing without using the OpenTX functionality (before I did the translator I used this, but OpenTX Telemetry processing is much better so I do not use this option any longer).

So compile and umload MLinkFrSkyConverter.ino (FrSkyProtokoll.ino must be in the same folder!) to an arduino pro mini 5V, make the inverter-circuit wich is shown in the schematic and plug S1 to the TX module (for pin mapping see the TX dokumentation - pin mapping in the schematic is the ACT version) and S2 to the rear Taranis RS232 plug (for pin mapping please have a look to Taranis hardware dokumentation). Than chose in hardware menu "Serial port : Telemetry" and in tememetry menu "Frsky D (Cable)". Now it should work if there is a MLink stream on S1.

Stay allways curious - its the best thing humans can do :) .

Best regards

Tobi
Donaufischh66
Posts: 8
Joined: Sat Nov 21, 2015 9:06 pm
Country: -

Re: Mlink-FrSky-Telemetry converter

Post by Donaufischh66 »

Hello Tobi,
I am new on this Forum therefore I am not allowed to send private messages.
I would like to contact you, to ask some questions in german! My english is a littel bit rusty!

I want to change from my Multiplex to Taranis Transmitter. I have several receivers and Sensors. Therefore I am highly interested in your MLINK Translator.
Right now I dont have any Frysky Receivers.
Which modul do I Need for MPX Mlink with the Taranis X9D. Cay I use your Translator also with the X9E?
Maybe you can send me a short private Message, the we could talk on in german!
THanks in advance
Roland
User avatar
MikeB
9x Developer
Posts: 17992
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Mlink-FrSky-Telemetry converter

Post by MikeB »

As soon as a small number of your posts have been approved, you will be able to send private messages.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
Tobi
Posts: 56
Joined: Sun Jul 26, 2015 8:17 pm
Country: -

Re: Mlink-FrSky-Telemetry converter

Post by Tobi »

Hello Roland,

I would gess that the x9E have the same interface - but I dont know exactly . Maybe Mike could tell you.
The only module you need is an arduino pro mini 5V and a little transitstor for inverting the RS232 signal.
I will send you a PN. If there are sensible information wich could be interested for other users I will translate them and post it here, if you want.

Best regards

Tobi

Post Reply

Return to “General help (FrSky Taranis radio)”