Reassigning motor pins in BetaFlight for a custom board

I did a layout for an STM32F405RG that I was going to flash with SilF4ware, an F4 port of SilverWare. I ended up with a mixture of an FC suitable for the AlienFlight F4 target in BetaFlight and Silf4ware that can be custom configured to an extent in Cube MX. This is what happens with a little knowledge :grin:
The way that I connected the gyro was exactly the same as the AlienFlight F4 and as far as I am aware there is no way of re configuring these actual hardware connections in Cube to match my PCB’s. Some Pins I could move in Cube as the code is bit banged so I have quite a bit of flexibility to move about half the pins but the others forget it. To complicate thing this FC uses the MPU-6000 whereas the AFF4 uses the noisy MPU-6500 but I have been told that the code should work for both gyros as long as I am not using any Mag or Baro functions which I am not, plus I do not think that my 6000 has that capability anyway.

On this SilverF4 layout , I have the motors on PC6 - PC9 (Pins 37 - 40) which are CH’s 1 - 4 on TIMER4

My question is can I remap these in the CLI in BetaFlight so I can at least use this board as a derivative design of the AlienFlight F4 that has three UART’s and SP13 (four pins) broken out to pads on the board.

To double complicate thing I am having very sporadic connection via serial and when trying to put into DFU. It has connected, accepted a few different firmwares and gone into DFU but not reliably so I think that I need to rework the STM.



1 Like

I believe that using a unified target in BetaFlight is the way to go for this situation ? Does anyone yet have any experience with doing these and could give me a few clues please

You can remap the motor pins in pretty well any BF firmware. Refer: URGENT! Betaflight motor remap also oscar liang has an article on it.

1 Like

Thanks @Ian444

For betaflight you can probably get away with adjusting the pins in the target files here
For SilF4ware this is gonna be more complicated because it seems like there is some code-gen going on (CubeMX?)

Thanks @bkleiner I’ll have a look. AFAIK adjusting targets is not all that straight forward but I am still trying to get my head around it all :slight_smile:

As for SilF4 ware, the code is all bit banged so very easy to change pins in Cube-MX. Thanks for your input I appreciate it.

1 Like

Well, yes and no. those header files are used as a “base-line”.
The initial value for every pin configuration is taken from those header files, but will be overwritten when there are conflicts, another pinconfig during runtime (via the “resource” CLI) is specified or another runtime thing explicitly overwrites it (mostly in the configuration code).

good to know @CubeMX but i’m more the makefile type a guy.

EDIT: oh you are getting at Alternate Functions/Channels for your pins, yeah you will have to look them up in the datasheet of your STM and compare them with betaflight.
Maybe just try it with the pins adjusted, chances are it will “just work”

1 Like

After getting the v2 of this FC pretty well sorted I have now got v2 soldered up and just initially flashed with the LiteFlite BetaFlight target. Next I’ll check that it flashes via SWD and that some different receiver types all work OK. Then it’s into a frame for a bit of a flight test.


v1 VooDoo Silver F4 with extensive magnet wire gyro rewiring


v1 Silver F4 with XN297 receiver

I finally got the Silver F4 v2 FC into a frame today and started out with the Omnibus F4 target flashed in BetaFlight using a Lemon sat RX. I discovered that I inadvertently forgot to connect the gyro interrupt pin 12 to STM pin 24 but this has been fixed in v3 which is being fabricated at OSH park and should be here over the next 2 -3 weeks. I will fly it without that connection and see how it goes in the meantime. Luckily SilverWare doesn’t use that INT connection in the firmware but it remains to be seen how it will affect the Omnibus and LiteFlite firmwares. A future revision will have a selection jumper to allow the MPU-6000 INT pin to be connected to STM pin 24 for Omnibus F4 and LiteFlight F4, or STM pin 3 for AlienFlight F4. See attached image

I was getting erratic gyro behaviour in BetaFlight Omnibus F4 target without the MPU-6000 INT pin connected to the STM32F4. I soldered in a magnet wire jumper and it seems to have resolved that.

Took it for it’s first proper flight outside today and it is working well with BetaFlight. Next step to flash with SilF4ware

I successfully flashed SilF4ware to the Silver F4 FC and although it is far from sorted out tune wise, at least it is in the air as of today. A lot of setup and tuning to go this week so here is hoping I can get it flying properly.

Getting ahead of myself - v3 PCB’s landed today :purple_heart:

I have run into some setup issues when I flash SilF4ware to the board but have been offered some assistance by the firmware’s developer. I will try what he suggests over the next few days. It’s a hard road sometimes :slight_smile: