-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add target BLUEBERRYH743 #11279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add target BLUEBERRYH743 #11279
Conversation
Branch Targeting SuggestionYou've targeted the
If This is an automated suggestion to help route contributions to the appropriate branch. |
PR Compliance Guide 🔍All compliance sections have been disabled in the configurations. |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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]
| 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); |
There was a problem hiding this comment.
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]
| 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); |
| #define SOFTSERIAL_1_TX_PIN PC6 //TX6 pad | ||
| #define SOFTSERIAL_1_RX_PIN PC6 //TX6 pad |
There was a problem hiding this comment.
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]
| #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 |
| serialConfigMutable()->portConfigs[findSerialPortIndexByIdentifier(SERIAL_PORT_USART1)].functionMask = FUNCTION_MSP; | ||
| serialConfigMutable()->portConfigs[findSerialPortIndexByIdentifier(SERIAL_PORT_USART1)].msp_baudrateIndex = BAUD_115200; |
There was a problem hiding this comment.
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]
| 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; | |
| } |
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
File Walkthrough
target.h
Complete hardware and peripheral definitionssrc/main/target/BLUEBERRYH743/target.h
variants
SPI buses
target.c
Timer and IMU bus device registrationsrc/main/target/BLUEBERRYH743/target.c
IMUs
TIM5, TIM4, TIM15, TIM1, TIM2, TIM8
config.c
Target-specific runtime configurationsrc/main/target/BLUEBERRYH743/config.c
CMakeLists.txt
Build system configurationsrc/main/target/BLUEBERRYH743/CMakeLists.txt