Skip to content
Juan Pedro López edited this page Jan 29, 2018 · 8 revisions

Why this wiki

When programming the script I have found many problems trying to understand the information available. There were not so many experiences with the passthrough protocol, some had errors and most were first trials like mine.

Understanding how the new protocol was implemented and how to decode in the radio was a not simple task. I will try to summarise my findings and improve this wiki as I solve some the issues I have found.

Tested setup

  • FrSky R-XSR receiver.
  • Pixhawk 2.4.8 (clone version).
  • Taranis XD9+ SE with Open TX 2.2.
  • The lua script and the images you can find in the code section.

Pixhawk configuration

This was the easiest part. Following the recomendation I used serial4 for communications. You need to go to the full parameter list in the Mission Planner and in the configuration for the serial4 indicate 57 as baud rate and 10 as the protocol to be used. That's all.

Make sure you use protocol 10 in only one of the serials.

Wiring with Pixhawk

The Pixhawk uses TTL electric levels, S.Port uses RS-232 electric levels. This is why you need an adapter/converter circuit.

You can do your own circuit by both using transistors, optocouplers, resistors, capacitors and a diode. You can also build your own board with a MAX232N (or any other variant), some capacitors and a diode. For protoboard testing, both options could be fine, but for the final setup I recommend buying a cheap RS-232 to TTL adaptor. You just need to solder a diode in place to be able to send TX data from the Pixhawk.

This is the wiring diagram I have used, you can see the location of the diode you need on all circuits:

R-XSR to Pixhawk converter

I tested the circuit using an oscilloscope to ensure I was getting the right signal levels and that the timing was correct. Remember that S.Port uses a polling protocol, this means that the FrSky receiver 'rules' and the Pixhawk will not start sending data until it receives the 'tell me your sensors' command from the receiver.

Setting up the Taranis

This is not a tutorial about telemetry scripts. If you do not know what I mean here, please read any tutorial on how to setup your radio.

You have to:

  1. Upload the script to the SD card into SCRIPTS/TELEMETRY. The images go in SCRIPTS/BMP.
  2. Go to the telemetry setup screen of you model: long press MENU key + long press PAGE key.
  3. Select the script uploaded.
  4. Press EXIT + long press PAGE. You should now see the script screen running.

The lua telemetry script

First, let me insist that you need OpenTX version 2.2 or above. The key function here is the new sportTelemetryPop(). Almost all passthrough data is passed to a queue only accessible with this function. Only GPS data is passed as a discoverable normal sensor with Id 800.

After several trials, I can tell you that due to the big volume of data per second you will get you can query the queue only from the main loop. You have to be sure that you empty the queue before you go to process or draw data received. At first I was giving priority to drawing functions, reading one message and then drawing. This caused low attendance to the queue and a delay of almost 2 seconds from action on the flight controller to reaction on the screen. You will see in the script that the first thing I do is a while..do loop to empty the queue before processing data. Yes, I will be discarding old messages, but due to the telemetry messages you will get I consider this a very good approach.

I would also recommend using a "widget" approach to drawing in the screen. You will see in the script that I almost only erase the area to be redrawn. The script uses two approaches to erasing screen areas, I will probably rewrite the code once I finish full field testing and keep the simplest one.

I will try to explain how to decode each message type and how to later on process the data. For the moment I left comments in the code to explain as much as possible what was done. If you have any specific question, please do not hesitate to contact me.

I will write separate pages for each message type.