Skip to content

Conversation

@dixi83
Copy link

@dixi83 dixi83 commented Oct 31, 2025

User description

Added support for FlyingRC F4wing mini
see #11009 for more details
Test board has been shipped but, still on its way.


PR Type

Enhancement, New Target


Description

  • Add support for FlyingRC F4wing mini flight controller

  • Define timer hardware configuration for 6 servo outputs

  • Configure IMU, barometer, magnetometer, and rangefinder sensors

  • Set up UART and SoftSerial communication interfaces


Diagram Walkthrough

flowchart LR
  A["FlyingRC F4wing mini<br/>STM32F405"] --> B["Timer Hardware<br/>6 Servos + LED"]
  A --> C["SPI1 IMU<br/>ICM42605"]
  A --> D["I2C Sensors<br/>Baro/Mag/Range"]
  A --> E["UART/SoftSerial<br/>6 Ports"]
  A --> F["ADC VBAT<br/>Current Meter"]
Loading

File Walkthrough

Relevant files
Configuration changes
target.h
Board hardware and peripheral configuration                           

src/main/target/FLYINGRCF4WINGMINI/target.h

  • Define board identifier and LED pins for status indication
  • Configure SPI1 for ICM42605 IMU with CW90_DEG_FLIP alignment
  • Set up I2C1 for barometer, magnetometer, rangefinder, and pitot
    sensors
  • Define 6 UART ports and SoftSerial1 for communication
  • Configure ADC for battery voltage monitoring and current measurement
  • Enable features: OSD, telemetry, current meter, blackbox, and 4-way
    ESC interface
+112/-0 
target.c
Timer hardware definitions and servo mapping                         

src/main/target/FLYINGRCF4WINGMINI/target.c

  • Define timer hardware array with 8 timer configurations
  • Map TIM8 channels to S1/S2 servo outputs on PC9/PC8
  • Map TIM1 channels to S3/S4 servo outputs on PB15/PA8
  • Map TIM2 channels to S5/S6 servo outputs on PB11/PB10
  • Configure TIM3 and TIM5 for LED and SoftSerial functionality
+42/-0   
config.c
Target configuration function stub                                             

src/main/target/FLYINGRCF4WINGMINI/config.c

  • Create empty targetConfiguration function for board-specific setup
  • Include necessary headers for platform, MSP box, config, and piniobox
+27/-0   
CMakeLists.txt
CMake build configuration for target                                         

src/main/target/FLYINGRCF4WINGMINI/CMakeLists.txt

  • Define CMake build configuration for STM32F405XG microcontroller
  • Register FLYINGRCF4WINGMINI as a valid build target
+1/-0     

@qodo-merge-pro
Copy link

PR Compliance Guide 🔍

All compliance sections have been disabled in the configurations.

@qodo-merge-pro
Copy link

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Resolve critical pin resource conflicts

Resolve the resource conflict on pin PA2, which is simultaneously configured for
UART2_TX, SOFTSERIAL_1_TX, and SOFTSERIAL_1_RX, by removing or reassigning the
conflicting peripherals.

src/main/target/FLYINGRCF4WINGMINI/target.h [69-83]

-#define USE_UART2
-#define UART2_TX_PIN            PA2
-#define UART2_RX_PIN            PA3
-
 #define USE_UART4
 ...
 #define UART5_RX_PIN            PD2
 
 #define USE_SOFTSERIAL1
-#define SOFTSERIAL_1_TX_PIN      PA2
-#define SOFTSERIAL_1_RX_PIN      PA2
+// Softserial TX is on PA2, using TIM5_CH3 as defined in target.c
+// Softserial RX pin needs to be defined on a free pin if used.
+#define SOFTSERIAL_1_TX_PIN      PB0 // Example: Use a free pin
+#define SOFTSERIAL_1_RX_PIN      PB1 // Example: Use a free pin

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies a critical pin resource conflict on PA2, which is assigned to UART2_TX, SOFTSERIAL_1_TX, and SOFTSERIAL_1_RX, preventing these peripherals from functioning correctly.

High
Fix SoftSerial TX/RX pin assignment

Assign SOFTSERIAL_1_RX_PIN to a different pin, as it is currently incorrectly
assigned to the same pin PA2 as SOFTSERIAL_1_TX_PIN.

src/main/target/FLYINGRCF4WINGMINI/target.h [81-83]

 #define USE_SOFTSERIAL1
 #define SOFTSERIAL_1_TX_PIN      PA2
-#define SOFTSERIAL_1_RX_PIN      PA2
+#define SOFTSERIAL_1_RX_PIN      PB0 // Example: Assign to an unused pin
  • Apply / Chat
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies that SOFTSERIAL_1_TX_PIN and SOFTSERIAL_1_RX_PIN are assigned to the same pin PA2, which would make softserial non-functional.

Medium
Correct timer usage for SoftSerial

In the timer definition for TIM5, change the usage from TIM_USE_ANY to the more
specific TIM_USE_SOFTSERIAL to correctly configure it for the softserial driver.

src/main/target/FLYINGRCF4WINGMINI/target.c [39]

-DEF_TIM(TIM5,  CH3,  PA2,  TIM_use_ANY,    0, 0), //TX2  softserial1_Tx
+DEF_TIM(TIM5,  CH3,  PA2,  TIM_USE_SOFTSERIAL,    0, 0), //TX2  softserial1_Tx

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 7

__

Why: The suggestion correctly points out that TIM_USE_SOFTSERIAL is more appropriate than TIM_USE_ANY for a timer intended for softserial, improving configuration clarity and correctness.

Medium
  • More

@dixi83 dixi83 changed the title Target: FlyingRC F4wing mini New target: FlyingRC F4wing mini Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant