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 v1 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.