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:

  1. Not enough UART input/outputs
  2. Inability to fly with more than 4 motors (no hexacopters)
  3. Inability to control LEDs
  4. Missing beeper
  5. Inability to control a transponder LED
  6. Inability to use PPM receivers
  7. Inability to add servo outputs (such as for automatic FPV camera tilt)

Luckily, Betaflight has our back. If your flight controller is missing any of the above features, you can likely enable them using a feature called resource remapping. In this article I’ll walk through how to use it.

What is Betaflight Resource Remapping?

The concept of resource remapping is simple to understand: you are telling the flight controller to pretend that one of your I/O pins has become a different pin. This means you can tell your flight controller to pretend motor output 1 is now motor output 3. More practically, you can tell it that the beeper output pin is now a PPM receiver input pin.

The table below lists the various functions you can assign to pins in Betaflight:

Function Name Description
CAMERA CONTROL Betaflight can be hooked up to your FPV camera's OSD feature to control camera settings like brightness/contrast/etc. As of November 2017 this feature still isn't supported without hardware mods on most FCs. Learn more here.
BEEPER Betaflight can use a beeper to help you find a lost quad and audibly notify you of issues.
LEDSTRIP <n> Betaflight can control programmable LED strips for custom lighting effects. <n> is the LED strip number.
MOTOR <n> Motors — Betaflight supports up to 8 motor outputs in total. <n> is the motor number.
PPM Betaflight can receive commands from PPM RC receivers.
PWM <n> Betaflight can also receive individual PWM channel controller channels. <n> is the RX channel.
SERIAL_TX On some flight controllers you can add extra UARTs and assign them to pins. The SERIAL_TX function maps a pin to a software TX.
SERIAL_RX On some flight controllers you can add extra UARTs and assign them to pins. The SERIAL_RX function maps a pin to a software RX.
SERVO <n> Betaflight can control up to 8 servos which can be used for things like FPV camera tilters and dropping mechanisms. <n> is the servo number.

So how is this useful to you? Let’s say you want to add an LED controller feature to your Flight Controller, but it doesn’t have an LED output pin. All you have to do is look on the above list of pins for a feature that your flight controller does have but that you are not using. Then, plug your LED into that pin and use resource remapping to tell Betaflight how to use it properly. Let’s jump into how that is done:

How to use Betaflight Resource Remapping

Resource remapping was introduced in Betaflight version 3.1. If you are running an older version of Betaflight and need this feature, now is the time to update. You’ll like it, I promise.

Resource remapping must be entirely done via the Betaflight CLI interface. Betaflight Configurator has a terminal which allows you to execute CLI commands easily, so the first step is to connect to your flight controller via Betaflight Configurator and go to the “CLI” tab.

The “resource” command is the one you’ll be using to change your pins around. For this tutorial, we will swap the MOTOR 2 function to the LEDSTRIP pin. You might want to do this if your flight controller’s MOTOR 2 pin is broken, and you’re not using LEDs. The process is:

  1. Find a free pin on your flight controller that you want to re-purpose. (We chose the LED pin.)
  2. Find out the internal Betaflight code name for that pin by running “resource” from the CLI:

    The list that will appear is all functions that are currently assigned to pins on your flight controller. To find the code name for a pin, find the function that you want to replace and the use the code name adjacent to it. For example, the function name “LEDSTRIP 1” is assigned the code name “A08”.
    Before continuing further, we recommend you copy and paste the output found above, or take a screenshot of it. If you screw something up, you’ll want to restore these settings. If you forget to write these down, the only way to do that will be to reset your flight controller.
  3. Before you assign a new function to a pin, you’ll need to clear the old assignment for that pin. Clear the old pin mapping by running “resource <function name> NONE”.
    Continuing our example, you would run “resource LEDSTRIP 1 NONE”
  4. Map the pin to your new desired function by running “resource <function> <new pin code name>” — adding your code name and function in:
    Continuing our example, you would run “resource MOTOR 2 A08”
  5. Save your settings by entering “Save” in the CLI:
  6. Once the flight controller reboots, check that your assignment worked by running the “resource” command again:

    You want to verify that:

    1. Your function now has a new pin code name.
    2. No pin code names are duplicated.

That’s it. Keep in mind that every time you flash new firmware on your Flight Controller, you will need to re-run these commands. Therefore, it may be helpful to write them down.

If you want to read more about the “resource” command and how all this works, check out the Betaflight wiki documentation:
https://github.com/betaflight/betaflight/wiki/Betaflight-resource-remapping

Note for using resource remapping with DSHOT motor outputs

There is a “gotcha” here. DSHOT motor outputs cannot be assigned to any old pin. They need to be assigned to a pin which supports a feature called “DMA”. Trial and error is the easiest way to figure this out – if DSHOT isn’t working you have a pin without DMA. If you want a foolproof way of figuring it out and are a bit more technically minded, you’ll need to read ST micros spec sheet. Some instructions can be found in this Github ticket.

How to configure software serial ports in Betaflight

Due to the resource-intensive nature of software-serial (UART) ports, many pin assignments will not work for adding a software serial port. Unfortunately, what works and what does not work is not totally clear at the time of this writing. The Betaflight wiki contains a list of tested pin assignments on various boards, which you can access here:
https://github.com/betaflight/betaflight/wiki/Single-Wire-Software-Serial

One “trick” that i have discovered is that most boards that have UART pins can have those pins re-mapped to software serial ports without any issues. This may sound strange at first, but think about it: when you have a serial RX connected to your FC, you only use the RX pin on your FC. This means you can re-map the TX pin to a software serial port to get use out of both pins! A configuration like this can allow you to use the TX and RX pins of a single UART for both a serial RX and telemetry.

To use software serial, you first need to enable it in the configuration tab of Betaflight configurator:

Next up, you’ll assign the pin mappings as described in the above directions. Note that when assigning software serial ports, you need to use a port number of 10 or above. Thus — to assign pin “A10” to software serial 1 TX, you would use:
resource SERIAL_TX 10 A10

Similarly, to assign pin “A9” to software serial 2 RX, you would use:
resource SERIAL_RX 11 A9

Enter “save” in the CLI and take a look at your ports tab. If your configuration worked, your software serial ports should show up, ready for assignment.

It is worth re-iterating that software serial ports are quite finnicky. Many pins will not work for use with software serial for several reasons. My best suggestion is that if you try one pin and it doesn’t seem to be working, try another. If you have a popular FC, consult the aforementioned Betaflight wiki page for pins which have been found to work.

Alternate Uses of Resource Remapping

Now that you understand how resource remapping works, you can use it to customize your flight controller as you see fit. This has a variety of uses outside of simply enabling features that your flight controller does not support from the factory:

  • Recovering broken pins on your flight controller that were torn out or melted away by soldering damage.
  • Reconfiguring your flight controller’s pin layout to improve the aesthetics (or functionality) of your wiring.

 

Show Buttons
Hide Buttons