Betaflight Soft Serial – Invert FrSKY SmartPort telemetry without soldering
This article was written by my guest author Martin FPV. Any contentual adaptation by me, we have discussed in advance together! Many thanks to Martin for this article and the time you have invested!
Software Serial (Soft Serial)
The current state of the art is that there is a lot of hardware that requires a serial UART port connection to the flight control. The possible comfort would like to be used and the pilot would like to give up no gimmick. These include Smart Audio, ESC Telemetry, SBUS, or Smart Port Telemetry. Unfortunately, there is a problem with today’s flight controller and these are too few ports for too much hardware which could be used. In addition, there is the inversion drama of UART signals, e.g. FrSKY SmartPort. Remedy is in sight, but only with the F7 processors. They have up to 8 UART ports. The usual F3 and F4 flight controllers usually have only 3 UART ports.
To make matters worse, some ports are designed only for specific applications. The one solution that eliminates two problems at once is called Software Serial.
Software Serial, what´s that?
Software Serial provides the ability to deploy additional software emulated UART ports, in addition to hardware UART ports, through software. These can, with the exception of a small bandwidth limitation, perform the same tasks as hardware UARTs. Software Serial is therefore ideal for SmartAudio and SmartPort telemetry.
The big advantage of Softserial is the possibility to invert the signal by software. This is a huge relief since it was previously necessary to pick up the signal from the inverter of the receiver.
What is a resource?
Computer programs are written in a specific programming language, while resources are usually simple text files or tables. The advantage is that they can be read, extended or changed by people without programming skills. In our area the „resource“ of a flight controller is an assignment, which is determined by software (in our case by CLI). This assignment determines what data will be routed to the hardware pin / pad.
Resource remapping command
Presumably most of you are wondering where to find the software port Serial Ports now?
In this case, those of you who have a SP Racing F3 Acro / Deluxe Flight Controller as your own can be lucky. In fact, the manufacturer has implemented both of these in advance of the two possible software serial ports.
If not, you can distribute the „resources“ as you need them. At least in theory. Since Betaflight 3.1, this is possible via the CLI.
We use the following command: https://github.com/betaflight/betaflight/wiki/Betaflight-resource-remapping
However, there are a few things to keep in mind:
Unfortunately, not all resources can be used for all purposes. You can find help here. If your own board is not listed, unfortunately you can only try. Many of the flight controller are similar in structure so that you can derive the resources also many times.
Single wire software serial
A resource that can always be used is that for the programmable LEDs. If you only need one TX connection, it is usually enough to program only one resource. However, if the RX connection is needed, e.g. for ESC telemetry, the TX connection must also be assigned beforehand, otherwise the Serial UART software will not be displayed in the Betaflight Configurator.
What is telemetry and what do I need it for?
Telemetry refers to sensor data provided by the flight controller. These can be either warnings or information (voltage, power consumption, GPS position, etc.). By telemetry you can also send configuration commands. For example, it is possible to set a video channel or to adjust the PIDs. For instructions on how to use a KISS FC to control the video sender, click here.
Configure soft serial port
Below I explain how to create a soft serial port. Please note that you need at least Betaflight 3.1 for this.
Enable soft serial feature
To use softserial, you must first activate the feature.
In the tab „configuration“ under „other Features“ you have to activate „soft serial„. After that, do not forget „Save and Reboot„.
Read current configuration
Next, we need to find out the current configuration / occupancy. To do this we will go to the CLI and send the command „dump all“ with the Enter key.
It may be necessary to release a resource first so that we can use it. In the following example we use the LED pin for this.
We now look for the passage „#resources“ in the dump. We notice the assigned value of resource „resource LED_Strip 1„.
In our case „A01„. (It is best to note this value in a text file)
Now we have to release the resource. We do that by replacing the value with „none„.
The command is:
resource LED_Strip 1 none
Confirm with the Enter key.
As feedback, we now get a confirmation („Resource is freed„) that this resource is released.
Assign a resource to soft serial
In the next step we allocate a free serial port to the free resource. In that case we use Soft Serial 1.
To do this, we first scroll up to „#resources“ again.
Important !, the changes must be saved with „save“, so that they are taken over.
The two softserial resources are named as follows:
Soft Serial 1: SERIAL_TX 11 and SERIAL_RX 11
Soft Serial 2: SERIAL_TX 12 and SERIAL_RX 12
We now assign a resource to the TX pin first. For this we use the just released LED_STRIP 1 Resource A01.
resource SERIAL_TX 11 A01
We confirm this command with the Enter key.
As confirmation, we receive the following message: „Resource is set to A01“
Save assignment and reboot
Now it is important that we do not forget to save the new configuration. For this we send the command „save“ with the Enter key.
In order for the new soft serial port to be displayed, the flight controller automatically performs a reboot.
Use FrSKY SmartPort telemetry
Softserial is great for using FrSKY SmartPort telemetry.
Previously, the uninverted SmartPort signal, which does not have every flight controller, except you have a F4, had to be tapped on a small SMD component (the inverter). Only then could the receiver be used at all. With the R-XSR the problem was recognized and a satisfactory solution was found. There are now solder pads on which you can pick up both signals (SmartPort / SBUS). However, this has the disadvantage that you can no longer use the original plug and may even damage the receiver while soldering on the small pads.
Nowadays, this modification is no longer necessary, since the signal can be tapped by SoftSeries as supplied by FrSKY. This can then be inverted by software.
After the restart, the Ports tab in the Betaflight Configurator looks like this.
There we can now configure the SmartPort telemetry (TX) as usual. And do not forget to solder the telemetry cable from the receiver to the LED pad of the flight controller.
By default (for FrSKY) the signal should be turned on as inverted. If problems arise, the current value can be checked under #master and changed if necessary. Simply enter the following command in the command line and confirm.
set tlm_inverted = off
The change takes place immediately. Then save with „save“, so that the command is permanently effective.
Done, you can now use your FrSky SmartPort signal without hardware tuning.
Use ESC telemetry (RX) via Softserial
If the ESC telemetry (RX) is now to be used, then a few more steps are required.
Since an RX pin is required to use ESC telemetry, a placeholder must first be programmed on the TX resource, otherwise the soft serial port will not be displayed in the Betaflight Configurator.
For this purpose, e.g. the resource „PPM 1“ not used at SBUS or, if this is not possible, the motor output „resource motor 5“ not required for a four-motor copter. In this case „A00“.
As in the previous example, we first release the required resources with the „none“ command and then assign the shared resource addresses to the desired ports. Do not forget „save“. The result should look like this.
The cable from the ESC telemetry is then soldered back to the LED solder pad on the flight controller. Do not forget to activate the ESC sensor in the tab „Configuration“ under „Other Features“.