AP_HAL_ChibiOS: add board X-MAV-AP-H743v2

Co-authored-by: Henry Wurzburg <hwurzburg@yahoo.com>
This commit is contained in:
tompsontan 2024-09-28 08:22:29 -05:00 committed by Andrew Tridgell
parent 8e5ee61b02
commit 84fbaa3abc
5 changed files with 334 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 520 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

View File

@ -0,0 +1,97 @@
# AP-H743v2 Flight Controller
The AP-H743v2 is a flight controller designed and produced by X-MAV
## Features
- STM32H743 microcontroller
- BMI088/ICM42688P dual IMUs
- DPS310 barometer
- IST8310 magnetometer
- AT7456E OSD
- 9V 3A BEC; 5V 3A BEC
- MicroSD Card Slot
- 8 UARTs
- 8 PWM outputs
- 1 CAN
- 1 I2C
- 1 SWD
## Physical
![X-MAV AP-H743v2 Front View](AP-H743v2_TopPort.png)
![X-MAV AP-H743v2 Back View](AP-H743v2_BottomPort.png)
## UART Mapping
- SERIAL0 -> USB
- SERIAL1 -> UART2 (MAVLink2)
- SERIAL2 -> UART4 (User)
- SERIAL3 -> UART1 (GPS)
- SERIAL4 -> UART6 (User)
- SERIAL5 -> UART8 (User)
- SERIAL6 -> UART3 (DisplayPort)
- SERIAL7 -> UART5 (RCIN)
- SERIAL8 -> UART7 (RX only, ESC Telemetry)
## RC Input
The default RC input is configured on the UART5 and supports all RC protocols except PPM. The SBUS pin is inverted and connected to RX5. When using RX5 or SBUS, the other input should be unconnected. RC can be attached to any UART port as long as the serial port protocol is set to `SERIALn_PROTOCOL=23` and SERIAL7_Protocol is changed to something other than '23'.
## OSD Support
The AP-H743v2 supports onboard analog SD OSD using a MAX7456 chip. Simultaneously, DisplayPort HD OSD is available on the DJI connector for HD VTX. Both on board OSD and DisplayPort OSD can be operated simultaneously.
## VTX Support
The SH1.0-6P connector supports a DJI Air Unit / HD VTX connection. Protocol defaults to DisplayPort. Pin 1 of the connector is 9v so be careful not to connect this to a peripheral requiring 5v.
## PWM Output
The AP-H743v2 supports up to 8 PWM outputs.
All the channels support DShot and BiDir DShot.
Outputs are grouped and every output within a group must use the same output protocol:
1, 2, 3, 4 are Group 1;
5, 6 are Group 2;
7, 8 are Group 3;
## Battery Monitoring
The board has a internal voltage sensor and connections on the ESC connector for an external current sensor input.
The voltage sensor can handle up to 6S LiPo batteries.
The default battery parameters are:
- BATT_MONITOR 4
- BATT_VOLT_PIN 4
- BATT_CURR_PIN 8
- BATT_VOLT_MULT 10.2
- BATT_CURR_SCALE 20.4
## Compass
The AP-H743v2 has a built-in compass sensor (IST8310), and you can also attach an external compass using I2C on the SDA and SCL connector.
## Mechanical
- Mounting: 30.5 x 30.5mm, Φ4mm
- Dimensions: 36 x 36 x 8 mm
- Weight: 9g
## Loading Firmware
Initial firmware load can be done with DFU by plugging in USB with the bootloader button pressed. Then you should load the "with_bl.hex" firmware, using your favorite DFU loading tool.
Once the initial firmware is loaded you can update the firmware using any ArduPilot ground station software. Updates should be done with the "\*.apj" firmware files.

View File

@ -0,0 +1,57 @@
# hw definition file for processing by chibios_hwdef.py
# for the X-MAV-AP-H743V2 hardware
# MCU class and specific type
MCU STM32H7xx STM32H743xx
# board ID for firmware load
APJ_BOARD_ID AP_HW_X-MAV-AP-H743V2
# crystal frequency
OSCILLATOR_HZ 8000000
# flash size
FLASH_SIZE_KB 2048
# bootloader is installed at zero offset
FLASH_RESERVE_START_KB 0
# the location where the bootloader will put the firmware
FLASH_BOOTLOADER_LOAD_KB 128
# order of UARTs (and USB)
SERIAL_ORDER OTG1
# USB
PA11 OTG_FS_DM OTG1
PA12 OTG_FS_DP OTG1
# pins for SWD debugging
PA13 JTMS-SWDIO SWD
PA14 JTCK-SWCLK SWD
# CS pins
PA3 BMI088_1_G_CS CS
PA2 BMI088_1_A_CS CS
PC13 ICM42688P_CS CS
# LEDs
PD11 LED_ACTIVITY OUTPUT HIGH GPIO(91) #green
PB15 LED_BOOTLOADER OUTPUT HIGH GPIO(92) #blue
define HAL_LED_ON 1
# microSD support
PC12 SDMMC1_CK SDMMC1
PD2 SDMMC1_CMD SDMMC1
PC8 SDMMC1_D0 SDMMC1
PC9 SDMMC1_D1 SDMMC1
PC10 SDMMC1_D2 SDMMC1
PC11 SDMMC1_D3 SDMMC1
define FATFS_HAL_DEVICE SDCD1
# enable FAT filesystem support (needs a microSD defined via SDMMC)
define HAL_OS_FATFS_IO 1
define AP_BOOTLOADER_FLASH_FROM_SD_ENABLED 1

View File

@ -0,0 +1,180 @@
# hw definition file for processing by chibios_hwdef.py
# for the X-MAV-AP-H743V2 hardware
# MCU class and specific type
MCU STM32H7xx STM32H743xx
# board ID for firmware load
APJ_BOARD_ID AP_HW_X-MAV-AP-H743V2
# crystal frequency
OSCILLATOR_HZ 8000000
# ChibiOS system timer
STM32_ST_USE_TIMER 12
define CH_CFG_ST_RESOLUTION 16
# flash size
FLASH_SIZE_KB 2048
FLASH_RESERVE_START_KB 128
define HAL_STORAGE_SIZE 32768
STORAGE_FLASH_PAGE 14
# default to all pins low to avoid ESD issues
DEFAULTGPIO OUTPUT LOW PULLDOWN
# order of UARTs (and USB)
SERIAL_ORDER OTG1 USART2 UART4 USART1 USART6 UART8 USART3 UART5 UART7
# USB
PA11 OTG_FS_DM OTG1
PA12 OTG_FS_DP OTG1
PD0 VBUS INPUT OPENDRAIN
# Serial1
PD6 USART2_RX USART2
PD5 USART2_TX USART2
# Serial2
PB9 UART4_TX UART4
PB8 UART4_RX UART4
# GPS1/Serial3
PA9 USART1_TX USART1
PA10 USART1_RX USART1
# Serial4
PC6 USART6_TX USART6
PC7 USART6_RX USART6
# Serial5
PE0 UART8_RX UART8
PE1 UART8_TX UART8
# DJI O3/Serial6
PD8 USART3_TX USART3
PD9 USART3_RX USART3
# RC_INPUT/Serial7
PB13 UART5_TX UART5
PB12 UART5_RX UART5
PD14 SBUS_INV OUTPUT LOW
# ESC/Serial8
PE7 UART7_RX UART7
# SWD
PA13 JTMS-SWDIO SWD
PA14 JTCK-SWCLK SWD
# two I2C bus
I2C_ORDER I2C1 I2C4
# I2C1 - baro
PB6 I2C1_SCL I2C1
PB7 I2C1_SDA I2C1
# I2C4 - CONNECTOR
PD12 I2C4_SCL I2C4
PD13 I2C4_SDA I2C4
# PWM output pins
PE9 TIM1_CH1 TIM1 PWM(1) GPIO(50) BIDIR
PE11 TIM1_CH2 TIM1 PWM(2) GPIO(51)
PE13 TIM1_CH3 TIM1 PWM(3) GPIO(52) BIDIR
PE14 TIM1_CH4 TIM1 PWM(4) GPIO(53)
PB1 TIM3_CH4 TIM3 PWM(5) GPIO(54) BIDIR
PB0 TIM3_CH3 TIM3 PWM(6) GPIO(55)
PB10 TIM2_CH3 TIM2 PWM(7) GPIO(56) BIDIR
PB11 TIM2_CH4 TIM2 PWM(8) GPIO(57)
# GPIOs
PA4 PINIO1 OUTPUT GPIO(81) LOW
PC1 PINIO2 OUTPUT GPIO(82) LOW
PC0 PINIO3 OUTPUT GPIO(83) LOW
# LEDs
PD15 LED_RED OUTPUT HIGH GPIO(90)
PD11 LED_GREEN OUTPUT HIGH GPIO(91)
PB15 LED_BLUE OUTPUT HIGH GPIO(92)
define AP_NOTIFY_GPIO_LED_RGB_RED_PIN 90
define AP_NOTIFY_GPIO_LED_RGB_GREEN_PIN 91
define AP_NOTIFY_GPIO_LED_RGB_BLUE_PIN 92
define HAL_GPIO_LED_ON 1
define AP_NOTIFY_GPIO_LED_RGB_ENABLED 1
# ADC for Power
PC4 BATT_VOLTAGE_SENS ADC1 SCALE(1)
PC5 BATT_CURRENT_SENS ADC2 SCALE(1)
#BATTERY MONITOR ON
define BATT_MONITOR 4
define HAL_BATT_VOLT_PIN 4
define HAL_BATT_CURR_PIN 8
define HAL_BATT_VOLT_SCALE 10.2
define HAL_BATT_CURR_SCALE 20.4
# microSD support
PC12 SDMMC1_CK SDMMC1
PD2 SDMMC1_CMD SDMMC1
PC8 SDMMC1_D0 SDMMC1
PC9 SDMMC1_D1 SDMMC1
PC10 SDMMC1_D2 SDMMC1
PC11 SDMMC1_D3 SDMMC1
define FATFS_HAL_DEVICE SDCD1
# SPI1 - IMU0
PA5 SPI1_SCK SPI1
PA6 SPI1_MISO SPI1
PA7 SPI1_MOSI SPI1
PA3 BMI088_1_G_CS CS
PA2 BMI088_1_A_CS CS
# SPI3 - CONNECTOR
PB3 SPI3_SCK SPI3
PB4 SPI3_MISO SPI3
PB2 SPI3_MOSI SPI3
PA15 AT7456E_CS CS
# SPI4 - IMU1
PE6 SPI4_MOSI SPI4
PE2 SPI4_SCK SPI4
PE5 SPI4_MISO SPI4
PC13 ICM42688P_CS CS
# barometers
BARO DPS310 I2C:0:0x76
# SPI devices
SPIDEV imu0_a SPI1 DEVID1 BMI088_1_A_CS MODE3 10*MHZ 10*MHZ
SPIDEV imu0_g SPI1 DEVID2 BMI088_1_G_CS MODE3 10*MHZ 10*MHZ
SPIDEV imu1 SPI4 DEVID3 ICM42688P_CS MODE3 10*MHZ 10*MHZ
SPIDEV osd SPI3 DEVID5 AT7456E_CS MODE0 10*MHZ 10*MHZ
# 2 IMUs
IMU BMI088 SPI:imu0_a SPI:imu0_g ROTATION_ROLL_180_YAW_90
IMU Invensensev3 SPI:imu1 ROTATION_ROLL_180
# compasses
define HAL_COMPASS_DISABLE_IST8310_INTERNAL_PROBE
define HAL_PROBE_EXTERNAL_I2C_COMPASSES
COMPASS IST8310 I2C:ALL_EXTERNAL:0x0E true ROTATION_NONE
COMPASS IST8310 I2C:ALL_INTERNAL:0x0E false ROTATION_YAW_90
# enable FAT filesystem support (needs a microSD defined via SDMMC)
define HAL_OS_FATFS_IO 1
#Serial Port defaults
define DEFAULT_SERIAL4_PROTOCOL SerialProtocol_None
define DEFAULT_SERIAL6_PROTOCOL SerialProtocol_MSP_DisplayPort
define DEFAULT_SERIAL7_PROTOCOL SerialProtocol_RCIN
define DEFAULT_SERIAL8_PROTOCOL SerialProtocol_ESCTelemetry
# setup for OSD
define OSD_ENABLED 1
define HAL_OSD_TYPE_DEFAULT 5
ROMFS_WILDCARD libraries/AP_OSD/fonts/font*.bin