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 ...
    • Betaflight Firmware Guide for iFlight BNF Drones

      Important Disclaimer More than 50% of our support work is linked to messed up firmware, flash-bricked flight controllers or misconfigured BNF drones. So don't waste your time or money, FPV quads are more fun flying than fixing... Before proceeding ...
    • Recent Articles

    • What is the Shipping Cost for My Order?

      Curious about the shipping cost for your order? Here’s how to quickly estimate it, along with everything you need to know about our shipping options. How to Estimate Shipping Costs To get an accurate shipping quote for your order, follow these simple ...
    • Super Payments FAQ

      What is Super Payments? Super Payments is designed to provide a fast, secure, and seamless checkout experience while also rewarding you for your loyalty, earning cash rewards each time you shop with us. How It Works Choose Super Payments at checkout. ...
    • What to Do if Your Payment Was Declined but You See Multiple Charges

      Why Did This Happen? If your payment attempt was denied, but you still see charges on your card, you're likely experiencing a common scenario called pre-authorisation. Here’s why this might occur: You attempted to place an order, but it failed during ...
    • How to Log Out of Your Unmanned Tech Account

      If you need to log out of your Unmanned Tech account, follow these simple steps: Click on the Account Icon In the top right corner of the page, click on the account icon that looks like a small person. Select "Logout" From the dropdown menu, scroll ...
    • Why Soldering is Essential in the FPV Hobby and How to Learn

      Soldering is an essential skill for anyone diving into the FPV (First-Person View) drone hobby. Being proficient in soldering ensures that all electronic components of your drone are securely connected, which is crucial for reliable performance and ...