Skip to content

Conversation

jp39
Copy link

@jp39 jp39 commented Oct 8, 2025

User description

Tested on my 7" quad today, it flies.

Note that this board has no barometer. But it does not seem to cause any issues at all after set baro_hardware = NONE.


PR Type

Other


Description

This description is generated by an AI tool. It may have inaccuracies

  • Add complete support for AIKONF4V2 flight controller

  • Configure STM32F405 MCU with SPI, UART, I2C peripherals

  • Support MPU6000/ICM42605 IMU, MAX7456 OSD, flash storage

  • Enable default features including OSD, telemetry, blackbox


Diagram Walkthrough

flowchart LR
  A["AIKONF4V2 Target"] --> B["STM32F405 MCU"]
  B --> C["SPI Devices"]
  B --> D["UART Ports"]
  B --> E["I2C Bus"]
  C --> F["IMU Sensors"]
  C --> G["OSD Chip"]
  C --> H["Flash Storage"]
Loading

File Walkthrough

Relevant files
New target
target.h
Main target configuration and pin definitions                       

src/main/target/AIKONF4V2/target.h

  • Define board identifier and USB product string
  • Configure all peripheral pins (UART, SPI, I2C, ADC)
  • Set up IMU sensors (MPU6000, ICM42605) with alignment
  • Enable OSD, barometer, magnetometer, and flash storage
+134/-0 
target.c
Timer and PWM output configuration                                             

src/main/target/AIKONF4V2/target.c

  • Define timer hardware configuration for 4 motor outputs
  • Configure PWM pins on TIM8 channels for motor control
  • Set up PPM and LED strip on TIM4 channel
+39/-0   
config.c
Target-specific configuration stub                                             

src/main/target/AIKONF4V2/config.c

  • Create empty target configuration function
  • Include necessary headers for platform and PWM mapping
+27/-0   
CMakeLists.txt
Build system configuration                                                             

src/main/target/AIKONF4V2/CMakeLists.txt

  • Add CMake build configuration for STM32F405xG target
+1/-0     

Copy link

qodo-merge-pro bot commented Oct 8, 2025

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
No custom compliance provided

Follow the guide to enable custom compliance check.

  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

Copy link

qodo-merge-pro bot commented Oct 8, 2025

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Resolve IMU hardware resource conflict

Resolve the hardware conflict caused by two IMU sensors (MPU6000 and ICM42605)
being configured on the same SPI bus and Chip Select pin. Remove the definition
for the incorrect IMU after verifying the board's schematic.

src/main/target/AIKONF4V2/target.h [93-100]

-#define USE_IMU_MPU6000
-#define MPU6000_CS_PIN          SPI1_NSS_PIN
-#define MPU6000_SPI_BUS         BUS_SPI1
-#define IMU_MPU6000_ALIGN       CW0_DEG
+// #define USE_IMU_MPU6000
+// #define MPU6000_CS_PIN          SPI1_NSS_PIN
+// #define MPU6000_SPI_BUS         BUS_SPI1
+// #define IMU_MPU6000_ALIGN       CW0_DEG
 #define USE_IMU_ICM42605
 #define ICM42605_CS_PIN         SPI1_NSS_PIN
 #define ICM42605_SPI_BUS        BUS_SPI1
 #define IMU_ICM42605_ALIGN      CW90_DEG
  • Apply / Chat
Suggestion importance[1-10]: 10

__

Why: This suggestion correctly identifies a critical hardware resource conflict where two IMUs share the same SPI bus and CS pin, which would prevent the flight controller from initializing and functioning correctly.

High
Fix pin resource conflict issue

Fix the resource conflict on pin PB6, which is assigned to both PPM input and
LED strip output. The timer configuration in target.c should be updated to use
TIM_USE_LED only, as PPM is likely unused.

src/main/target/AIKONF4V2/target.h [33-34]

 #define USE_LED_STRIP
 #define WS2811_PIN              PB6
+// In src/main/target/AIKONF4V2/target.c, change the corresponding line to:
+// DEF_TIM(TIM4,  CH1,  PB6,  TIM_USE_LED, 0, 0), // LED
  • Apply / Chat
Suggestion importance[1-10]: 9

__

Why: This suggestion correctly identifies a resource conflict on pin PB6, which is configured for both LED strip output and PPM input. This would cause one or both features to fail, so fixing it is crucial for correct board operation.

High
High-level
Remove incorrect barometer hardware definition

The target.h file incorrectly enables barometer support by defining USE_BARO.
These definitions should be removed to align with the hardware capabilities, as
noted in the PR description.

Examples:

src/main/target/AIKONF4V2/target.h [106-108]
#define USE_BARO
#define BARO_I2C_BUS            DEFAULT_I2C_BUS
#define USE_BARO_ALL

Solution Walkthrough:

Before:

// src/main/target/AIKONF4V2/target.h

// ...
// OSD
#define USE_MAX7456
#define MAX7456_CS_PIN          SPI3_NSS_PIN
#define MAX7456_SPI_BUS         BUS_SPI3
// Baro
#define USE_BARO
#define BARO_I2C_BUS            DEFAULT_I2C_BUS
#define USE_BARO_ALL
// Blackbox
#define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT
// ...

After:

// src/main/target/AIKONF4V2/target.h

// ...
// OSD
#define USE_MAX7456
#define MAX7456_CS_PIN          SPI3_NSS_PIN
#define MAX7456_SPI_BUS         BUS_SPI3
// Baro
// This board does not have a barometer.

// Blackbox
#define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT
// ...
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies a configuration error where the code enables a barometer, contradicting the PR description which states the hardware lacks one, thus improving the target's default correctness.

Medium
General
Define specific GPIO port masks

Replace the wildcard 0xffff GPIO port initializations with specific pin masks
for TARGET_IO_PORTA, TARGET_IO_PORTB, and TARGET_IO_PORTC. This ensures only
necessary pins are configured, improving robustness and power efficiency.

src/main/target/AIKONF4V2/target.h [128-133]

-#define TARGET_IO_PORTA         0xffff
-#define TARGET_IO_PORTB         0xffff
-#define TARGET_IO_PORTC         0xffff
-#define TARGET_IO_PORTD         0xffff
-#define TARGET_IO_PORTE         0xffff
-#define TARGET_IO_PORTF         0xffff
+#define TARGET_IO_PORTA         (PIN_MASK(0) | PIN_MASK(1) | PIN_MASK(2) | PIN_MASK(3) | PIN_MASK(4) | PIN_MASK(5) | PIN_MASK(6) | PIN_MASK(7) | PIN_MASK(9) | PIN_MASK(10) | PIN_MASK(15))
+#define TARGET_IO_PORTB         (PIN_MASK(4) | PIN_MASK(5) | PIN_MASK(6) | PIN_MASK(8) | PIN_MASK(9) | PIN_MASK(10) | PIN_MASK(11) | PIN_MASK(12) | PIN_MASK(13) | PIN_MASK(14) | PIN_MASK(15))
+#define TARGET_IO_PORTC         (PIN_MASK(1) | PIN_MASK(2) | PIN_MASK(3) | PIN_MASK(6) | PIN_MASK(7) | PIN_MASK(8) | PIN_MASK(9) | PIN_MASK(10) | PIN_MASK(11) | PIN_MASK(12))
+#define TARGET_IO_PORTD         0x0000
+#define TARGET_IO_PORTE         0x0000
+#define TARGET_IO_PORTF         0x0000
  • Apply / Chat
Suggestion importance[1-10]: 5

__

Why: The suggestion correctly points out that using wildcard 0xffff for GPIO port initialization is poor practice and proposes a more precise configuration. This improves code quality and prevents potential issues, but is less critical than a functional bug.

Low
  • Update

@sensei-hacker
Copy link
Collaborator

Please ignore the suggestions from the AI bot about the IMU and baro.
The led pin might be a valid point, though, perhaps?

@jp39
Copy link
Author

jp39 commented Oct 9, 2025

@sensei-hacker, please take a look at the updated branch for LED pin related changes.

Note that I've had trouble with poshold mode on this quad, and I suspect it's because of the lack of barometer. Because of this I will replace the FC with another one on this quad. I will no longer be able to test things on the AIKON F4 V2.

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.

2 participants