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:
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.
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:
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:
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
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.
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 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.
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.
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:
This article was provided by Propwashed, be sure to check out their site as it is full of helpfull tips and tricks.