BetaFlight Resource Mapping Guide

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:

  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

Check out our BetaFlight Soft Serial Setup Guide

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:

betaflight softserial

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 11 or above. Thus — to assign pin “A10” to software serial 1 TX, you would use:
resource SERIAL_TX 11 A10

Similarly, to assign pin “A9” to software serial 2 RX, you would use:
resource SERIAL_RX 12 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.

betaflight softserial

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.

 This article was provided by Propwashed, be sure to check out their site as it is full of helpfull tips and tricks.


    • Related Articles

    • 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 ...
    • How to troubleshoot your Motors and ESC (Betaflight)

      Problem:  One or more motors are not spinning up correctly when trying to fly your quadcopter. This is a fairly common issue pilots encounter with betaflight quads.  Sometimes this could be due to an incorrect flight controller setting, bad ...
    • 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 ...
    • Recent Articles

    • Modified Your Drone? Here’s How It Affects Your Warranty

      Warranty Basics When you purchase a product with a warranty inlcuded by the manufacuter, or retailer (like us), it's like a promise that the item, as sold, will work as expected for a certain period (usually 6 months or 1 year). But what happens when ...
    • Resolving Card Payment Processing Issues

      Experiencing a failed payment attempt can be frustrating, particularly when you're certain your credit card is functioning correctly. At Unmanned Tech, we recognize the importance of a smooth payment process and are here to assist you in resolving ...
    • Changing Your Delivery Preferences (Safe Space / Neighbour delivery Opt-Out)

      For convenience, many couriers will attempt to deliver to a neighbour if they are unable to deliver to your address for any reason. However, for some, this can cause problems. If for any reason you need to, you can change your delivery preferences ...
    • Happymodel Mobula6

      Hi there! If you're here, you're likely having issues with your Mobula6 VTX. Below are a few pointers from a support thread of ours which helped to resolve this issue for a number of our customers in the past. Firstly, make sure that you're not set ...
    • Solving Radio ELRS Version Mismatch: A Step-by-Step Guide

      Are you facing difficulties with binding your ELRS radio and receiver? It could be due to a mismatch in the ELRS version. Don't worry! Our team has found a solution and has put together a detailed step-by-step guide to help you update your radio and ...