Skip to content

Conversation

@sensei-hacker
Copy link
Member

@sensei-hacker sensei-hacker commented Oct 16, 2025

User description

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

PR Type

Other


Description

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

  • Adds new flight controller target BROTHERHOBBYF405V3

  • Configures 8 motor outputs with DShot support

  • Enables OSD, blackbox, and multiple UART ports

  • Sets up ICM42605 IMU with CW90 rotation


Diagram Walkthrough

flowchart LR
  target["BROTHERHOBBYF405V3 Target"] --> hardware["Hardware Configuration"]
  hardware --> timers["Timer/PWM Mapping"]
  hardware --> peripherals["Peripherals Setup"]
  peripherals --> sensors["Sensors: ICM42605, Baro, Mag"]
  peripherals --> comms["Communication: 6 UARTs, SPI, I2C"]
  peripherals --> features["Features: OSD, Blackbox, LED"]
Loading

File Walkthrough

Relevant files
New target
target.c
Configure timer hardware and PWM output mapping                   

src/main/target/BROTHERHOBBYF405V3/target.c

  • Defines timer hardware configuration for 8 motor outputs (S1-S8)
  • Maps timers to GPIO pins with DMA channels
  • Configures TIM8_CH4 for LED strip on PC9
+42/-0   
target.h
Define target hardware configuration and peripheral mappings

src/main/target/BROTHERHOBBYF405V3/target.h

  • Defines board identifier and USB product string
  • Configures 6 UARTs, 3 SPI buses, and I2C
  • Sets up ICM42605 gyro/accelerometer with CW90 alignment
  • Enables OSD (MAX7456), blackbox flash storage, and ADC channels
  • Configures default features: OSD, current meter, VBAT, telemetry
+155/-0 
Configuration changes
CMakeLists.txt
Add CMake build configuration for target                                 

src/main/target/BROTHERHOBBYF405V3/CMakeLists.txt

  • Adds CMake build target for STM32F405 MCU
+1/-0     

@qodo-code-review
Copy link
Contributor

qodo-code-review bot commented Oct 16, 2025

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
Misconfigured UART pins

Description: UART1 RX and TX are both mapped to pin PA10, which can lead to unintended pin
reconfiguration conflicts and undefined serial behavior; TX is typically PA9 on STM32F405
and should be verified against the board schematic.
target.h [41-42]

Referred Code
#define UART1_RX_PIN PA10
#define UART1_TX_PIN PA10
Excessive IO exposure

Description: Enabling all GPIO ports with TARGET_IO_PORT[A-F] set to 0xffff exposes every pin as target
IO, increasing the attack surface and risk of unintended peripheral activation; restrict
to actual used pins.
target.h [147-153]

Referred Code
#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
Ticket Compliance
🎫 No ticket provided
- [ ] Create ticket/issue <!-- /create_ticket --create_ticket=true -->

</details></td></tr>
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

@qodo-code-review
Copy link
Contributor

qodo-code-review bot commented Oct 16, 2025

PR Code Suggestions ✨

Latest suggestions up to b40c41d

CategorySuggestion                                                                                                                                    Impact
Possible issue
Fix UART1 pin conflict

Resolve the pin conflict for UART1 where both UART1_RX_PIN and UART1_TX_PIN are
incorrectly defined as PA10.

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

 #define USE_UART1
 #define UART1_RX_PIN PA10
-#define UART1_TX_PIN PA10
+#define UART1_TX_PIN PA9
  • Apply / Chat
Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies a critical pin conflict where UART1_RX_PIN and UART1_TX_PIN are both assigned to PA10, which would make the UART peripheral non-functional.

High
Incremental [*]
Guard against out-of-bounds write

Add a null pointer and bounds check before assigning to permanentId[0] to
prevent potential out-of-bounds writes and improve robustness.

src/main/target/BROTHERHOBBYF405V3/config.c [27-30]

 void targetConfiguration(void)
 {
-    pinioBoxConfigMutable()->permanentId[0] = BOX_PERMANENT_ID_USER1;
+    pinioBoxConfig_t *pinioCfg = pinioBoxConfigMutable();
+    if (pinioCfg && ARRAYLEN(pinioCfg->permanentId) > 0) {
+        pinioCfg->permanentId[0] = BOX_PERMANENT_ID_USER1;
+    }
 }
  • Apply / Chat
Suggestion importance[1-10]: 5

__

Why: The suggestion adds a null pointer and bounds check, which is good defensive programming that improves code robustness, even if it's unlikely to fail in the current configuration.

Low
General
Verify PC9 dual usage

Verify that the dual assignment of pin PC9 to both the LED strip (WS2811_PIN)
and a timer (TIM8_CH4) is intentional and correct.

src/main/target/BROTHERHOBBYF405V3/target.h [34]

+// Verify PC9 is correctly shared between WS2811 and TIM8_CH4
 #define WS2811_PIN PC9
  • Apply / Chat
Suggestion importance[1-10]: 5

__

Why: The suggestion correctly identifies that pin PC9 is used for both WS2811_PIN and a timer, which is a common and intentional configuration for driving LED strips, and correctly asks for verification.

Low
  • More

Previous suggestions

Suggestions up to commit 841c94b
CategorySuggestion                                                                                                                                    Impact
High-level
Correct invalid hardware pin assignments

Correct the hardware definition by assigning distinct pins for UART1 RX and TX,
which currently share the same pin. Also, remove redundant blackbox flash driver
definitions, enabling only the one corresponding to the board's actual hardware
to prevent conflicts and reduce firmware size.

Examples:

src/main/target/BROTHERHOBBYF405V3/target.h [41-42]
#define UART1_RX_PIN PA10
#define UART1_TX_PIN PA10
src/main/target/BROTHERHOBBYF405V3/target.h [116-130]
#define USE_FLASH_M25P16
#define M25P16_SPI_BUS BUS_SPI3
#define M25P16_CS_PIN PA15
#define USE_FLASH_W25M
#define W25M_SPI_BUS BUS_SPI3
#define W25M_CS_PIN PA15
#define USE_FLASH_W25M02G
#define W25M02G_SPI_BUS BUS_SPI3
#define W25M02G_CS_PIN PA15
#define USE_FLASH_W25M512

 ... (clipped 5 lines)

Solution Walkthrough:

Before:

// src/main/target/BROTHERHOBBYF405V3/target.h

// UART1 has RX and TX on the same pin
#define USE_UART1
#define UART1_RX_PIN PA10
#define UART1_TX_PIN PA10
...
// Multiple flash drivers are enabled for the same SPI bus and CS pin
#define USE_FLASH_M25P16
#define M25P16_SPI_BUS BUS_SPI3
#define M25P16_CS_PIN PA15
#define USE_FLASH_W25M
#define W25M_SPI_BUS BUS_SPI3
#define W25M_CS_PIN PA15
#define USE_FLASH_W25M02G
... // and so on for 3 more flash types

After:

// src/main/target/BROTHERHOBBYF405V3/target.h

// UART1 pins are corrected
#define USE_UART1
#define UART1_RX_PIN PA10 // Or correct pin
#define UART1_TX_PIN PA9  // Or correct pin
...
// Only the correct flash driver for the board is enabled
#define USE_FLASH_W25N01G // Example: assuming this is the correct chip
#define W25N01G_SPI_BUS BUS_SPI3
#define W25N01G_CS_PIN PA15
Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies two critical errors in the hardware definition: a non-functional UART1 due to shared RX/TX pins and a problematic blackbox configuration with multiple conflicting flash drivers, which are major bugs for a new target.

High
Possible issue
Correct UART1 pin configuration

UART1 is misconfigured with both RX and TX on pin PA10. Correct the pin
assignments, noting that the standard TX pin PA9 is already in use for motor S2,
which indicates a pin conflict that needs resolution.

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

 #define USE_UART1
 #define UART1_RX_PIN PA10
-#define UART1_TX_PIN PA10
+#define UART1_TX_PIN PA9 // Corrected TX pin, assuming standard pinout. Please verify.
Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies a critical configuration error where UART1's RX and TX are assigned to the same pin (PA10), and also points out the resulting pin conflict with motor S2 if the standard PA9 pin were used for TX.

High

@sensei-hacker sensei-hacker merged commit 38c6174 into iNavFlight:master Oct 17, 2025
21 checks passed
@MrD-RC MrD-RC added this to the 9.0 milestone Oct 26, 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.

2 participants