Resource Remapping is an awesome feature in Betaflight, that allows you to swap some pins around on a flight controller. Using Resource Remapping there are so much you can do, for example, to change motor ordering, relocate pins in case of ripped-off solder pads, and many more!
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.
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
How to change motor ordering in flight controller (swap motor outputs)
As an example, imagine we had a quad with wrong motor ordering, maybe you mistakenly rotated the flight controller by 90 degree, or maybe you just wired the ESC signal wrong.
Don’t worry, you don’t need to redo your soldering and wiring, you can easily fix this with Resource Remapping!
Use the motor tab to spin up the motors, from motor #1 to #4 and write down the order on a piece of paper. (make sure props are removed) For example, we have:
Now type in “resource” in CLI, find the 4 lines specifying the motor pin assignment:
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 any mistakes you can just go back.
Now you can can write down the pin number next to the motor ordering with the pin number next to them:
Now write down the correct motor order next to the pin number. Can you see what motor number you need to assign to the pins now?
B06 should be “motor #1”, B04 should be “motor #2”, etc…
Type 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! :)