From b963be7ee866c8638d2db87bdaebafbd902515a6 Mon Sep 17 00:00:00 2001 From: James Harton Date: Fri, 20 May 2022 09:41:34 +1200 Subject: [PATCH] AP_HAL_ChibiOS: Add on-board baro support to iFlight BeastH7 V2 target. iFlight's own website says that there is no barometer on this device, however on my one there is a DPS310 connected on I2C. This PR adds support for the on-board baro but leaves it as optional. --- libraries/AP_HAL_ChibiOS/hwdef/BeastH7v2/README.md | 8 ++++---- libraries/AP_HAL_ChibiOS/hwdef/BeastH7v2/hwdef.dat | 11 ++++++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/libraries/AP_HAL_ChibiOS/hwdef/BeastH7v2/README.md b/libraries/AP_HAL_ChibiOS/hwdef/BeastH7v2/README.md index 90def7f831..5f2ee0d6e1 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/BeastH7v2/README.md +++ b/libraries/AP_HAL_ChibiOS/hwdef/BeastH7v2/README.md @@ -9,8 +9,8 @@ The Beast H7 AIO is a flight controller produced by [iFlight](https://shop.iflig - MCU: BGA-STM32H743 - Gyro: BMI270 - 16Mb Onboard Flash - - BEC output: 5V 2.5A - - No Barometer + - BEC output: 5V 2.5A + - Barometer: DPS310 or None - OSD: AT7456E - 5 UARTS: (UART1, UART2, UART3, UART4, UART7) - I2C for external compass. UART3 pins are used for I2C (BRD_ALT_CONFIG=1) @@ -36,9 +36,9 @@ receive pin for UARTn. The Tn pin is the transmit pin for UARTn. All UARTS support DMA. ## RC Input - + RC input is configured on the (UART2_RX/UART2_TX) pins which forms part of the DJI connector. It supports all RC protocols. - + ## OSD Support The Beast H7 v2 AIO supports OSD using OSD_TYPE 1 (MAX7456 driver). diff --git a/libraries/AP_HAL_ChibiOS/hwdef/BeastH7v2/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/BeastH7v2/hwdef.dat index 51d4546974..7e0811717c 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/BeastH7v2/hwdef.dat +++ b/libraries/AP_HAL_ChibiOS/hwdef/BeastH7v2/hwdef.dat @@ -20,8 +20,8 @@ APJ_BOARD_ID 1056 PB4 TIM3_CH1 TIM3 PWM(2) GPIO(51) BIDIR # 2 PB5 TIM3_CH2 TIM3 PWM(3) GPIO(52) # 3 -# only one I2C bus -I2C_ORDER I2C2 +I2C_ORDER I2C1 I2C2 +define HAL_I2C_INTERNAL_MASK 0 # order of UARTs (and USB) SERIAL_ORDER OTG1 USART1 USART2 USART3 UART4 EMPTY EMPTY UART7 @@ -42,6 +42,10 @@ define HAL_SERIAL2_PROTOCOL SerialProtocol_RCIN PB11 USART3_RX USART3 PB10 USART3_TX USART3 +# I2C1 for baro +PB8 I2C1_SCL I2C1 PULLUP +PB9 I2C1_SDA I2C1 PULLUP + # I2C2 for compass. These pins can also be used as USART3 PB10 I2C2_SCL I2C2 ALT(1) PB11 I2C2_SDA I2C2 ALT(1) @@ -55,5 +59,6 @@ define HAL_PROBE_EXTERNAL_I2C_COMPASSES # one IMU IMU BMI270 SPI:bmi270 ROTATION_ROLL_180_YAW_225 -# v2 has no BARO +# Some boards have no baro, some have a DPS310 Baro on I2C1 define HAL_BARO_ALLOW_INIT_NO_BARO 1 +BARO DPS310 I2C:0:0x76