Skip to content

Conversation

@sensei-hacker
Copy link
Collaborator

@sensei-hacker sensei-hacker commented Sep 20, 2025

User description

New target BROTHERHOBBY F405 V3


PR Type

Other


Description

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

  • Add new flight controller target BROTHERHOBBYF405V3

  • Configure ICM42605 gyro, MAX7456 OSD, W25N01G flash

  • Setup 6 UARTs, I2C sensors, ADC channels

  • Define 9 PWM outputs with LED strip support


Diagram Walkthrough

flowchart LR
  A["New Target"] --> B["Hardware Config"]
  B --> C["SPI Devices"]
  B --> D["UART Ports"]
  B --> E["I2C Sensors"]
  C --> F["ICM42605 Gyro"]
  C --> G["MAX7456 OSD"]
  C --> H["W25N01G Flash"]
  D --> I["6 Serial Ports"]
  E --> J["Baro/Mag/Rangefinder"]
Loading

File Walkthrough

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

src/main/target/BROTHERHOBBYF405V3/target.h

  • Define hardware pins for SPI, I2C, UART interfaces
  • Configure ICM42605 gyro, MAX7456 OSD, W25N01G flash
  • Setup ADC channels for voltage, current, RSSI
  • Enable default features and PWM outputs
+186/-0 
target.c
Timer and SPI device registration                                               

src/main/target/BROTHERHOBBYF405V3/target.c

  • Register ICM42605 gyro on SPI1 bus
  • Define 9 timer hardware entries for PWM outputs
  • Configure LED strip on TIM8 CH3
+49/-0   
config.c
Target-specific configuration settings                                     

src/main/target/BROTHERHOBBYF405V3/config.c

  • Configure PINIO box with USER1 permanent ID
  • Enable PWM mode for beeper configuration
+31/-0   
CMakeLists.txt
CMake build configuration                                                               

src/main/target/BROTHERHOBBYF405V3/CMakeLists.txt

  • Add CMake target for STM32F405xG processor
+1/-0     

@sensei-hacker sensei-hacker self-assigned this Sep 20, 2025
@sensei-hacker
Copy link
Collaborator Author

sensei-hacker commented Sep 20, 2025

  • Samples received
  • Flash firmware
  • Calibrate
  • Orientation matches
  • Gyro working
  • Accel working
  • Baro working
  • UART1
  • UART2
  • UART3
  • UART4
  • UART5
  • UART6
  • LEDs working
  • Buzzer working
  • Motor outputs
  • DShot support on m1-4
  • Servo outputs
  • Blackbox
  • Voltage correct
  • Current correct
  • Analog RSSI
  • Mag I2C Bus
  • Analog Camera working
  • Video Out working
  • OSD working
  • PINIO1
  • PINIO2

@sensei-hacker sensei-hacker added the New target This PR adds a new target label Sep 20, 2025
@qodo-merge-pro
Copy link

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
⚡ Recommended focus areas for review

Duplicate Define

SPI device 1 is defined twice (USE_SPI_DEVICE_1 appears two times). This can cause confusion or macro redefinition issues; consolidate to a single definition.

#define USE_SPI
#define USE_SPI_DEVICE_1
#define SPI1_SCK_PIN            PA5
#define SPI1_MISO_PIN           PA6
#define SPI1_MOSI_PIN           PA7


#define USE_SPI_DEVICE_1
#define SPI1_NSS1_PIN           PA4
#define SPI1_NSS2_PIN           PA8
Inconsistent License

Mixed licensing headers across files (GPL in config.c/target.c vs MPL/GPL dual notice in target.h). Confirm intended license alignment for the new target files.

/*
 * This file is part of INAV Project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * Alternatively, the contents of this file may be used under the terms
 * of the GNU General Public License Version 3, as described below:
 *
 * This file is free software: you may copy, redistribute and/or modify
 * it under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.
 *
 * This file is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
 * Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see http://www.gnu.org/licenses/.
 */
Gyro ID Mismatch

The registered device uses DEVHW_ICM42605 with a variable name busdev_icm42688. Ensure the device ID, naming, and alignment constants match the actual sensor (ICM42605 vs ICM42688).

BUSDEV_REGISTER_SPI_TAG(busdev_icm42688,  DEVHW_ICM42605, ICM42605_SPI_BUS,  GYRO1_CS_PIN,  NONE,  0,  DEVFLAGS_NONE,  IMU_ICM42605_ALIGN);

@qodo-merge-pro
Copy link

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
High-level
Resolve inconsistent gyro configuration

The configuration enables USE_DUAL_GYRO in target.h but only registers one gyro
in target.c. To fix this inconsistency, either register the second gyro or
disable the dual gyro feature.

Examples:

src/main/target/BROTHERHOBBYF405V3/target.h [39]
#define USE_DUAL_GYRO
src/main/target/BROTHERHOBBYF405V3/target.c [29]
BUSDEV_REGISTER_SPI_TAG(busdev_icm42688,  DEVHW_ICM42605, ICM42605_SPI_BUS,  GYRO1_CS_PIN,  NONE,  0,  DEVFLAGS_NONE,  IMU_ICM42605_ALIGN);

Solution Walkthrough:

Before:

// src/main/target/BROTHERHOBBYF405V3/target.h
#define USE_DUAL_GYRO
...
#define GYRO1_CS_PIN            PA4
#define GYRO2_CS_PIN            PA8

// src/main/target/BROTHERHOBBYF405V3/target.c
BUSDEV_REGISTER_SPI_TAG(busdev_icm42688,  DEVHW_ICM42605, ...,  GYRO1_CS_PIN, ...);
// Note: No registration for a second gyro

After:

// src/main/target/BROTHERHOBBYF405V3/target.h
#define USE_DUAL_GYRO
...
#define GYRO1_CS_PIN            PA4
#define GYRO2_CS_PIN            PA8

// src/main/target/BROTHERHOBBYF405V3/target.c
// Option 1: Register the second gyro
BUSDEV_REGISTER_SPI_TAG(...,  DEVHW_ICM42605, ...,  GYRO1_CS_PIN, ...);
BUSDEV_REGISTER_SPI_TAG(...,  DEVHW_ICM42605, ...,  GYRO2_CS_PIN, ...);

/*
// Option 2: Disable dual gyro support if hardware has only one
// In target.h:
// #define USE_DUAL_GYRO // This line is removed
*/
Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies a critical configuration error where USE_DUAL_GYRO is defined but only one gyro is registered, which would likely cause runtime failures on the new hardware target.

High
Possible issue
Remove incorrect dual gyro definition

Remove the USE_DUAL_GYRO macro definition as only a single gyro is configured
for the target, preventing potential initialization issues.

src/main/target/BROTHERHOBBYF405V3/target.h [39-40]

-#define USE_DUAL_GYRO
 #define USE_TARGET_IMU_HARDWARE_DESCRIPTORS
  • Apply / Chat
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies that USE_DUAL_GYRO is defined while only one gyro is configured, which could lead to initialization failures or unexpected behavior.

Medium
General
Correct misleading gyro registration name

Change the gyro registration variable name from busdev_icm42688 to
busdev_icm42605 to match the actual device type DEVHW_ICM42605.

src/main/target/BROTHERHOBBYF405V3/target.c [29]

-BUSDEV_REGISTER_SPI_TAG(busdev_icm42688,  DEVHW_ICM42605, ICM42605_SPI_BUS,  GYRO1_CS_PIN,  NONE,  0,  DEVFLAGS_NONE,  IMU_ICM42605_ALIGN);
+BUSDEV_REGISTER_SPI_TAG(busdev_icm42605,  DEVHW_ICM42605, ICM42605_SPI_BUS,  GYRO1_CS_PIN,  NONE,  0,  DEVFLAGS_NONE,  IMU_ICM42605_ALIGN);
  • Apply / Chat
Suggestion importance[1-10]: 6

__

Why: The suggestion correctly identifies a misleading variable name in the gyro registration macro, which improves code clarity and prevents potential future bugs.

Low
  • More

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