How to setup BetaFlight Soft Serial

How to setup BetaFlight Soft Serial

What can we use Softserial for?

Stuff that requires a UART connection but not timing critical, such as:

  • SmartAudio,
  • GPS
  • SBUS
  • ESC telemetry
  • Smart Port

With the limited number of UART’s on a flight controller (only 2 or 3 on F3/F4 boards), you can turn unused pins like LED_Strip or PPM into softserial ports for connecting additional devices.

You can even “split“ one UART for two things. For example if you use UART1 RX pin for ESC Telemetry. you can use UART1 TX pin for SmartAudio or SmartPort if you set it to Soft Serial. This allows you to free up a whole UART for something else.

And Soft Serial also supports inverted signal like Smart Port. This is extremely useful for F1 and F4 flight controllers as they don’t have built-in inverters.

Softserial Limitations

Nothing is perfect, there are some disadvantages in using Soft Serial:

  • Duty cycle limitation – Softserial is not suitable for high duty cycle and “chatty” applications that occupy too much processor time like OSD and serial RX
  • Baud rate limitation – Softserial works well at 9600 baud rate but not higher rates such as 115200
  • Soft Serial consumes processor resources and will increase CPU load
  • In the current Betaflight firmware, only two Soft Serial ports are allowed
  • Softserial can be picky about what pins you are allowed to use – LED_Strips almost always work but other pins are uncertain,  you just have to try

How to Configure Soft Serial

It’s much easier to understand how to use SoftSerial with examples, which I will show you later in this tutorial.

But in a nutshell, there are only 2 steps in configuring Softserial:

  1. Enable SoftSerial feature (in the Configuration tab)
  2. Assign SoftSerial TX/RX to spare pins using Betaflight Resource Remapping (in CLI)
Check out this Betaflight Resource Mapping Tutorial

After FC rebooting, you should see a newly added “Soft Serial” port in the Ports tab.


Which Pins Can I Use For Soft Serial

This depends on the FC, and what timers the pins are connected to, you can find out what pins can be used for Soft Serial on your particular FC at this page: https://github.com/betaflight/betaflight/wiki/Single-Wire-Software-Serial

But most of the times, you just have to try.

In general you should be able to find the following pins on MOST FC’s and use them for soft serial:

  • UART TX & RX
  • PPM Input
  • LED pad (It’s LED_STRIP in CLI, not LED which is the status LED on the FC)
  • Motor 5, 6, 7 & 8 (if they are available)

If you run into any problem or have any technical questions, you should always email your FC manufacturer first.



Softserial Examples

Here are some common usage of Softserial. I am using Betaflight F4 flight controller in all of my examples below, but the same steps and concept should apply to other FC’s.

Connecting “inverted” SmartPort signal to an F4 flight controller

By using Softserial, we can connect SmartPort directly to an F4 FC without worrying about signal inversion.

In this example we will connect it to the TX of UART1.


In CLI, type in “resource”, and we can see the pin number of TX1, which is A09 (it might be different  in another FC).


Let’s assign A09 to Softserial 1, by entering in CLI:

resource SERIAL_TX 11 A09
save

Note that, Soft Serial port number starts from 11, which means, 11 is Softserial #1, 12 is Softserial #2

Enable “Softserial” feature in Betaflight, and you should see Softserial1 in the Ports Tab. Then select “SmartPort” under Telemetry Output.


This should now be working! If not, go to CLI, and make sure:

set tlm_halfduplex = on
set tlm_inverted = off

For inverted S.Port signal, you should have “tlm_inverted” set to “off”, however for uninverted SmartPort, it should be set to “on”. Just try both if you are not sure.

After making these changes, you will need to switch off the FC (by unplugging the USB cable and battery), then switch them back on. Sometimes softserial needs to be power-cycled to work properly.

Not working? Please try resetting the board and follow the exact instruction again. It’s been reported working after resetting the board, I don’t know why this is.



“Sharing” one UART between SmartAudio and ESC Telemetry

By using the TX and RX pins of the same UART for two devices, you can free up a whole UART for something else.

For example you can hook up ESC Telemetry to UART1 RX, and configure UART1 TX as Softserial1 and use that for your SmartAudio.


In CLI, type in “resource”, and we can see the pin number of TX1, which is A09.


Let’s assign A09 to Softserial 1, by entering in CLI:

resource SERIAL_TX 11 A09
save

Enable “Softserial” feature in Betaflight, and you should now see Softserial1 in the Ports Tab. Choose “ESC” in UART1 and choose SmartAudio in Softserial1, before saving it.

You might need to restart the FC by disconnecting the USB cable and battery, then turn it back on for it to start working.




Not enough UART? Let’s use LED_Strip pin for SmartPort

if you have LED_Strip pin on your FC, and you are not using LED, you can turn it into a softserial port and use it for devices like SmartPort and SmartAudio.


In CLI, type in “resource”, and we can see the pin number for LED_Strip is B06.


Let’s assign B06 to Softserial 1, by entering in CLI:

resource LED_STRIP 1 none
resource SERIAL_TX 11 B06
save

Enable “Softserial” feature in Betaflight, and you should now see Softserial1 in the Ports Tab. Select “SmartPort” under Telemetry Output.


if it’s not working, please see example 1 for tips to troubleshoot the issue.



Possible Errors

index not between 1 and 10

Two possible causes:

  • You should check if Softserial feature is enabled. Give the FC a reboot after enabling the “Softserial” feature (unplug USB cable and battery), and check again just in case
  • Your particular FC has Softserial disabled in the firmware. This is because F1 and some F3 FC have limited memory to store the firmware, and features like Softserial have to be removed to save memory space.
Images and content were provided by Oscar Liangs blog, its full of loads of helpfull articles and guides.
    • Related Articles

    • BetaFlight Resource Mapping Guide

      As manufacturers are stuffing more and more features into flight controllers, we are increasingly seeing boards that have fewer pins available for accessories. The result is lost capabilities, such as: Not enough UART input/outputs Inability to fly ...
    • How To Properly Setup And Configure A BetaFlight Quadcopter

      In our experience many problems we encounter with customers stem from incorrect configuration/setup of Betalight.  While Betaflight is an impressive flight control firmware, there are hundreds of parameters that you can tweak and play around with so ...
    • Betaflight Camera Control Setup and Troubleshooting

      Camera control via Betaflight is a fantastic way to adjust your camera settings from your R/C Controller, but it can sometimes be abit tricky to get working properly.  Since this is an open source software feature, we are only able to provide limited ...
    • How to install/Flash Betaflight Firmware (GUI or DFU Mode)

      This is a quick guide that will walk you through the process of flashing betaflight firmware onto your flight controller What is a "Firmware Target" or "HEX File" in this context? Betaflight firmware is made to run on many different boards. So, it is ...
    • How to setup GPS Rescue Mode in Betaflight

      GPS Rescue Mode is intended to bring your quad back autonomously in case of an emergency such as loss of video or radio link. The only purpose is to bring the quad back into range so you can retake control as soon as possible. It is not meant to be a ...