Resource Remapping is an awesome feature in Betaflight, it allows you to swap pins around on a flight controller. Resource Remapping is powerful, you can change motor order, relocate pins in case of ripped-off solder pads, and so on.
Further Reading: More Tutorials on Betaflight Features.
Why you might need Resource Remapping?
- Not enough UART TX/RX
- Ripped solder pads
- Requires more motor output for hexacopter configuration
- Missing PPM receiver input
- Missing programmable LED output
- Servo output
- Change motor output order
How does Resource Remapping work in Betaflight
There are many pins on a processor (as shown in the top image), and each pin might be assigned a specific function by Betaflight. Resource Remapping basically allows we to re-assign those pins with a different function.
This feature is available in Betaflight V3.1 or newer versions.
In Betaflight configurator CLI, type “resource”, it will return the available functions that we can change, and their current pin assignment:
# resource resource BEEPER 1 C15 resource MOTOR 1 B07 resource MOTOR 2 B06 resource MOTOR 3 B05 resource MOTOR 4 B04 resource PPM 1 B03 resource PWM 1 B00 resource PWM 2 B01 resource SONAR_TRIGGER 1 B00 resource SONAR_ECHO 1 B01 resource SERIAL_TX 1 A09 resource SERIAL_TX 2 A14 resource SERIAL_TX 3 B10 resource SERIAL_TX 11 B01 resource SERIAL_RX 1 A10 resource SERIAL_RX 2 A15 resource SERIAL_RX 3 B11 resource SERIAL_RX 11 B00 resource LED_STRIP 1 A08
The format is as follow:
resource [Function] [Index] [Port]
To change a pin for a function, you just follow the same format, and enter save at the end.
In the following we will show you some of the common usage of Betaflight Resource Mapping.
One very important note about this is, some of the pins of the processor might be unused, and does not connect to any solder points on the flight controller. The port you are changing the function to should ideally be a breakout pin on the flight controller (somewhere you can solder to easily). Otherwise you might have to solder a wire directly to the extremely tiny “leg” on the processor, which is really hard to do.
You can remap motor outputs freely, but if you want to add a motor output using other pins, you might run into “DMA conflict” if you use DShot. LED_Strip is your best bet for that.
You can’t remap hardware serial, but you can use hardware serial pins for other functions.
LED_STRIP pad is Powerful!
You can guarantee to use the LED_STRIP pin for almost anything, such as motor output, soft serial etc, that’s because it usually has its own timer and DMA channel.
Make sure it’s LED_STRIP that you want, and not LED! These are two different resources. (LED is the tiny status indicator that blinks when you power up the FC)
Camera Control is Strictly Camera Control
Because FPV camera control requires resistors and capacitors to work properly, they are normally already built into the flight controller, connected to the “camera control” pin. Because of this, you can’t use it for anything else. Depending on the capacitor value, you might be able to use it for slow speed protocol such as SmartAudio, but usually not any high speed protocol.
These are all “ADC” resources – analogue to digital converters.
- ADC_Batt – battery voltage input
- ADC_Curr – current sensor input
- RSSI – RSSI input
You can remap these 3 resources to each other, but you can’t remap these to anything else.
How to change LED Strip Pin?
For example if you want to change LED strip to A09, simply type in CLI:
resource LED_STRIP 1 A09 save
Note that it’s LED_STRIP! There is another resource called LED, which is the status LED on the flight controller. If you remap LED instead of LED_STRIP, you won’t get what you want, but instead turns off the status LED on the FC.
How to change motor order/output on flight controller
If you have a quad with motors in the wrong order, you can either undo the soldering and swap the motor outputs on the flight controller, or simply fix it in the software using Resource Remapping!
First thing you want to do, is to find out the current motor order. You can do so with the Motor tab in Betaflight.
Remove all propellers!
Use the motor tab to spin up the motors one by one, from motor #1 to #4 and write down the order on a piece of paper. For example, we have:
Now type “resource” in CLI, and find the 4 lines specifying the pin assignment for the four motors:
resource MOTOR 1 B07 resource MOTOR 2 B06 resource MOTOR 3 B05 resource MOTOR 4 B04
Please make a copy of these lines in a text file, if you make a mistake you can just go back.
Now you can write down the pin numbers next to the motors:
On the same paper, replace the motor numbering with the correct ones:
- rear right motor should be #1
- front right motor should be #2
- rear left motor should be #3
- front left motor should be #4
It should now become clear what motor numbers you have to assign to the pins.
In our example,
- B06 should be “motor #1”
- B04 should be “motor #2”
- B07 should be “motor #3”
- B05 should be “motor #4”
To change the motor pin assignment, type these lines in CLI:
resource MOTOR 1 B06 resource MOTOR 2 B04 resource MOTOR 3 B07 resource MOTOR 4 B05 save
And that’s it!
How to change buzzer (beeper) pin
It’s just as simple as the examples above… BUT!
You cannot just assign any pin for the buzzer, you need to do more!
That’s because the buzzer can draw a fairly large amount of current (more than the STM32 processor can handle), therefore there is usually a transistor in place. The transistor handles the current for the processor, and it’s controlled by a signal from the processor. If you connect the beeper directly to the STM32 processor you could potentially fry it.
It’s probably not a good idea moving buzzer pin around considering how much work this is. But if you do decide to move the buzzer to another pin, you will need to build an external power circuit like this. This is an example for the CC3D FC’s, for the most reliable choice of component and circuit please consult your own FC manufacturer.
Multiple functions sharing the same pin?
Sometimes a pin can be shared by multiple functions in Betaflight, if this is not your intent it’s best to free up the pin from tasks that are not required.
To check, simply enter “resource” in CLI. In this example, you can see that pin C08 is shared by two functions: LED_STRIP and CAMERA_CONTROL.
Further Reading: How to setup Camera Control in Betaflight?
If we are not using LED Strip, but camera control, you can free up pin C08 from LED_STRIP by typing this command in CLI:
resource LED_STRIP 1 none
That’s it! :)
Not Enough Serial Port?
If you run out of hardware serial port (aka UART), you can turn spare pins as software serial port, aka Soft Serial.
For example, you can use LED_STRIP, PPM, spare motor outputs.
What Pads That Cannot Be Remapped?
Voltage (5V and battery voltage) and ground pads cannot be remapped as these are physical connections that doesn’t go through the processor.
Camera input and output (for Betaflight OSD) also cannot be remapped as these go through the OSD chip, and not the main processor.