Skip to content

Conversation

@sunyanmeng963
Copy link
Contributor

@sunyanmeng963 sunyanmeng963 commented Jan 23, 2026

User description

Add target BLUEBERRYH743 to INAV master


PR Type

New Target


Description

  • Add BLUEBERRYH743 flight controller target with STM32H743 MCU

  • Configure dual gyro IMU support (MPU6000, ICM20602, ICM42605)

  • Define 12 servo outputs and comprehensive peripheral support

  • Set up UART, SPI, I2C, ADC, and SD card interfaces


Diagram Walkthrough

flowchart LR
  A["BLUEBERRYH743 Target"] --> B["Hardware Config"]
  A --> C["Peripheral Setup"]
  B --> D["STM32H743 MCU"]
  B --> E["Dual Gyro IMU"]
  C --> F["UART/SPI/I2C"]
  C --> G["ADC/SD Card"]
  C --> H["LED/Beeper"]
Loading

File Walkthrough

Relevant files
Configuration changes
target.h
Complete hardware and peripheral definitions                         

src/main/target/BLUEBERRYH743/target.h

  • Define board identifier and USB product string for BLUEBERRYH743
    variants
  • Configure dual gyro IMU hardware (MPU6000, ICM20602, ICM42605) with
    SPI buses
  • Set up 8 UART ports, I2C devices, ADC channels, and SD card support
  • Define GPIO pins for LEDs, beeper, PINIO controls, and LED strip
  • Configure default features including OSD, telemetry, blackbox logging
+213/-0 
target.c
Timer and IMU bus device registration                                       

src/main/target/BLUEBERRYH743/target.c

  • Register SPI bus devices for MPU6000, ICM42688, ICM20602, and ICM42605
    IMUs
  • Define 12 timer hardware outputs for servo/motor control on TIM3,
    TIM5, TIM4, TIM15, TIM1, TIM2, TIM8
  • Configure LED and beeper PWM outputs
  • Include commented-out PPM and software serial timer definitions
+60/-0   
config.c
Target-specific runtime configuration                                       

src/main/target/BLUEBERRYH743/config.c

  • Configure PINIO box permanent IDs for user-defined functions
  • Enable beeper PWM mode
  • Set USART1 as MSP serial port with 115200 baud rate
+34/-0   
CMakeLists.txt
Build system configuration                                                             

src/main/target/BLUEBERRYH743/CMakeLists.txt

  • Add build configuration for BLUEBERRYH743 and BLUEBERRYH743HD variants
  • Target STM32H743XI MCU for both variants
+2/-0     

@github-actions
Copy link

Branch Targeting Suggestion

You've targeted the master branch with this PR. Please consider if a version branch might be more appropriate:

  • maintenance-9.x - If your change is backward-compatible and won't create compatibility issues between INAV firmware and Configurator 9.x versions. This will allow your PR to be included in the next 9.x release.

  • maintenance-10.x - If your change introduces compatibility requirements between firmware and configurator that would break 9.x compatibility. This is for PRs which will be included in INAV 10.x

If master is the correct target for this change, no action is needed.


This is an automated suggestion to help route contributions to the appropriate branch.

@qodo-code-review
Copy link
Contributor

PR Compliance Guide 🔍

All compliance sections have been disabled in the configurations.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

High-level Suggestion

The target defines three IMUs while being configured for dual-gyro support (USE_DUAL_GYRO), which only uses two. The third IMU definition is superfluous and should be removed for code clarity. [High-level, importance: 6]

Solution Walkthrough:

Before:

// src/main/target/BLUEBERRYH743/target.h
#define USE_DUAL_GYRO
...
#define USE_IMU_MPU6000
...
#define USE_IMU_MPU6500 // for ICM20602
...
#define USE_IMU_ICM42605

// src/main/target/BLUEBERRYH743/target.c
BUSDEV_REGISTER_SPI_TAG(busdev_mpu6000, ..., 0, ...);  // IMU 1
BUSDEV_REGISTER_SPI_TAG(busdev_icm20602, ..., 1, ...); // IMU 2
BUSDEV_REGISTER_SPI_TAG(busdev_icm42605, ..., 2, ...); // IMU 3 (unused)

After:

// src/main/target/BLUEBERRYH743/target.h
#define USE_DUAL_GYRO
...
#define USE_IMU_MPU6000
...
#define USE_IMU_MPU6500 // for ICM20602
// #define USE_IMU_ICM42605 (removed)

// src/main/target/BLUEBERRYH743/target.c
BUSDEV_REGISTER_SPI_TAG(busdev_mpu6000, ..., 0, ...);  // IMU 1
BUSDEV_REGISTER_SPI_TAG(busdev_icm20602, ..., 1, ...); // IMU 2
// BUSDEV_REGISTER_SPI_TAG for icm42605 removed

DEF_TIM(TIM2, CH1, PA15, TIM_USE_BEEPER, 0, 0), // BEEPER PWM

// DEF_TIM(TIM8, CH2, PC7, TIM_USE_PPM, 0, 0), // RX6 PPM
DEF_TIM(TIM8, CH1, PC6, TIM_USE_ANY, 0, 0), // TX6 SoftwareSerial
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Resolve a pin conflict for PC6 which is used for both TIM8 (softserial) and UART6_TX_PIN. Comment out or remove the timer definition to avoid the conflict. [possible issue, importance: 9]

Suggested change
DEF_TIM(TIM8, CH1, PC6, TIM_USE_ANY, 0, 0), // TX6 SoftwareSerial
// DEF_TIM(TIM8, CH1, PC6, TIM_USE_ANY, 0, 0), // TX6 SoftwareSerial

#include "drivers/sensor.h"

BUSDEV_REGISTER_SPI_TAG(busdev_mpu6000, DEVHW_MPU6000, MPU6000_SPI_BUS, MPU6000_CS_PIN, NONE, 0, DEVFLAGS_NONE, IMU_MPU6000_ALIGN);
BUSDEV_REGISTER_SPI_TAG(busdev_icm42688, DEVHW_ICM42605, MPU6000_SPI_BUS, MPU6000_CS_PIN, NONE, 0, DEVFLAGS_NONE, IMU_MPU6000_ALIGN);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Correct the device hardware constant for busdev_icm42688 registration from DEVHW_ICM42605 to DEVHW_ICM42688 to match the intended IMU. [possible issue, importance: 9]

Suggested change
BUSDEV_REGISTER_SPI_TAG(busdev_icm42688, DEVHW_ICM42605, MPU6000_SPI_BUS, MPU6000_CS_PIN, NONE, 0, DEVFLAGS_NONE, IMU_MPU6000_ALIGN);
BUSDEV_REGISTER_SPI_TAG(busdev_icm42688, DEVHW_ICM42688, MPU6000_SPI_BUS, MPU6000_CS_PIN, NONE, 0, DEVFLAGS_NONE, IMU_MPU6000_ALIGN);

Comment on lines +156 to +157
#define SOFTSERIAL_1_TX_PIN PC6 //TX6 pad
#define SOFTSERIAL_1_RX_PIN PC6 //TX6 pad
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Resolve a pin conflict by assigning the software-serial RX pin to a different pin than PC6, as PC6 is already used for both software-serial TX and UART6_TX. [general, importance: 9]

Suggested change
#define SOFTSERIAL_1_TX_PIN PC6 //TX6 pad
#define SOFTSERIAL_1_RX_PIN PC6 //TX6 pad
#define SOFTSERIAL_1_TX_PIN PC6 // TX6 pad
#define SOFTSERIAL_1_RX_PIN PC7 // avoid UART6 and timer conflict

Comment on lines +32 to +33
serialConfigMutable()->portConfigs[findSerialPortIndexByIdentifier(SERIAL_PORT_USART1)].functionMask = FUNCTION_MSP;
serialConfigMutable()->portConfigs[findSerialPortIndexByIdentifier(SERIAL_PORT_USART1)].msp_baudrateIndex = BAUD_115200;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Add a check to ensure the index returned by findSerialPortIndexByIdentifier is valid (>= 0) before using it to access the portConfigs array to prevent potential crashes. [possible issue, importance: 8]

Suggested change
serialConfigMutable()->portConfigs[findSerialPortIndexByIdentifier(SERIAL_PORT_USART1)].functionMask = FUNCTION_MSP;
serialConfigMutable()->portConfigs[findSerialPortIndexByIdentifier(SERIAL_PORT_USART1)].msp_baudrateIndex = BAUD_115200;
int idx = findSerialPortIndexByIdentifier(SERIAL_PORT_USART1);
if (idx >= 0) {
serialConfigMutable()->portConfigs[idx].functionMask = FUNCTION_MSP;
serialConfigMutable()->portConfigs[idx].msp_baudrateIndex = BAUD_115200;
}

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