I just bought an FrSky Taranis for my quad copter and needed to get the Mavlink data up on the Taranis LCD telemetry display. So here is my solution using a Teensy3.1 as a converter between MavLink and the S.Port on FrSky X8R.
See attached file below...
There was a small discussion today with Mike Blandford about the implementation with the Teensy, and he mentioned on a thread at RCGroups, that the code for telemetry packets is not 100% correct. Apparently the code has been incorrect for quite some time and the error just keeps getting repeated over and over. Here is the quote from Mike
"The SPort protocol is NOT correct, there is no "byte stuffing" implemented.
It looks like the code has been copied from the diydrones site where it is also wrong, and that was copied from a googlecode site which is also wrong!
And then later an explanation of the specific byte stuffing:
"Byte stuffing is used to prevent the value 0x7E (used as the first byte of a SPort frame) appearing in the middle of a frame. FrSky used this method in the the original HUB data.
In the middle of a frame, 0x7E is sent as 0x7D followed by 0x5E, and 0x7D is sent as 0X7D followed by 0x5D.
When I looked at Christian's code it did not appear that this special case is being handled and the packet is just a raw byte stream that could inadvertently send a 0x7E in the middle of the packet. Since I am no programmer, it would sure be nice if someone could check this out.
A question for somebody who's done some coding here. In Christians version A2 value can display HDOP, but needs a Lua script to do it. Why is that the case ?
i.e If A2 can display a voltage with two decimal points normally, why the need for a script to show HDOP value with two decimal points also ?
(I tried it BTW, it displays a value but it's not the same HDOP value as seen in Mission Planner).
One short question about the Connection from the APM to the FrSky X8R.
On the picture there is a direct connection from the X8R to the APM 2.5 or 2.6.
I thought that ist not possible because X8R uses sbus and APM 2.5 only can PPM(CPPM)
Am i wrong ?
When yes, and i hope so :-), is it dependend on firmware Version of X8R and which jumper have to set on X8R and APM 2.5 ?
Thanks in advance
You can change how the A2(Hdop) value is sent be changing on the code running on the teensy (FrSkySport.ino)
The choice of the Lua scripts to present the data has to do with the versatility that the script provide.
The HDop values on the Taranis on mine are the same as in APM Planner.
Thanks for the heads up
We've picked code that was working from the original author of this thread (Rolf) and tried to keep it going even when the battery issues came up.
I believe we could all contribute to a better solution, even regarding Matthias current development to have SPort native on PixHawk.
AFAIK the X8R can not do CPPM yet (maybe ever).
OK, are you sure HDOP on the Taranis and Planner read identically at the same time ?
When I checked it was out by one full digit most of the time (Taranis said 3.XX while Mission Planner said 2.XX or lower).
If your sure then I have a problem some place...
Maybe somebody else can check it (with no Lua script running).
Thanks, I've implemented the byte-stuffing algorithm as you described it (I don't have the protocol specification). I did some quick testing and it seems to work, but please report if you find any abnormalities.
Unfortunately it seems like the the resolution of A2 is only 8 bits.
The current implementation is sending hdop /4. If you configure A2 with a range of 1024, you should get a close enough value of the actual hdop.
You don't need the scripts if you configure the A2 range yourself, but some of the values are packed together to enable more values to be sent. The scripts is used to make these values easier to handle for the telemetry screens.
According to Mavlink Inspector window yes both values are the same...
Thanks for the fast and clearly statement.
Then i need to connect my APM over a sbus2cppm converter.
I was just a little bit confused about the picture from this Thread on which it looks like it works without any converter.
This issue has been discussed previously on this thread.