diff --git a/libraries/AP_HAL_ChibiOS/hwdef/ARK_FPV/README.md b/libraries/AP_HAL_ChibiOS/hwdef/ARK_FPV/README.md new file mode 100644 index 0000000000000..46a30e8d77700 --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/ARK_FPV/README.md @@ -0,0 +1,87 @@ +# ARK FPV Flight Controller + +https://arkelectron.com/product/ark-fpv-flight-controller/ + + +## Features +#### Processor +- STM32H743 32-bit processor +- 480MHz +- 2MB Flash +- 1MB RAM +#### Sensors +- Invensense IIM-42653 Industrial IMU with heater resistor +- Bosch BMP390 Barometer +- ST IIS2MDC Magnetometer +#### Power +- 5.5V - 54V (2S - 12S) input +- 12V, 2A output +- 5V, 2A output. 300ma for main system, 200ma for heater +#### Interfaces +- **Micro SD** +- **USB-C** + - VBUS In, USB +- **PWM** + - VBAT In, Analog Current Input, Telem RX, 4x PWM and Bidirectional-DSHOT capable + - JST-GH 8 Pin +- **PWM EXTRA** + - 5x PWM and Bidirectional-DSHOT capable + - JST-SH 6 Pin +- **RC Input** + - 5V Out, UART + - JST-GH 4 Pin +- **POWER AUX** + - 12V Out, VBAT In/Out + - JST-GH 3 Pin +- **TELEM** + - 5V Out, UART with flow control + - JST-GH 6 Pin +- **GPS** + - 5V Out, UART, I2C + - JST-GH 6 Pin +- **CAN** + - 5V Out, CAN + - JST-GH 4 Pin +- **VTX** + - 12V Out, UART TX/RX, UART RX + - JST-GH 6 Pin +- **SPI** (OSD or External IMU) + - 5V Out, SPI + - JST-SH 8 Pin +- **DEBUG** + - 3.3V Out, UART, SWD + - JST-SH 6 Pin + +##### Dimensions +- Size: 3.6 × 3.6 × 0.8 cm +- Weight: 7.5g with MicroSD card + +## Pinout +TODO + +## UART Mapping + +|Name|Function| +|:-|:-| +|SERIAL0|USB| +|SERIAL1|UART7 (Telem)| +|SERIAL2|UART5 (VTX - DJI Air Unit, RX/TXT)| +|SERIAL3|USART1 (GPS1)| +|SERIAL4|USART2 (VTX - DJI Air Unit, RX only)| +|SERIAL5|UART4 (ESC Telem, RX only)| +|SERIAL6|USART6 (RC Input)| +|SERIAL7|OTG2 (SLCAN)| + +All UARTS support DMA. + +## OSD Support + +This flight controller has an MSP-DisplayPort output on a 6-pin DJI-compatible JST SH. + +## Motor Output + +Motors 1-8 are capable of Bidirectional-DSHOT and PWM. + +All outputs in the motor groups below must be either PWM or DShot: +Motors 1-4 Group1 (TIM5) +Motors 5-8 Group2 (TIM8) diff --git a/libraries/AP_HAL_ChibiOS/hwdef/ARK_FPV/common.inc b/libraries/AP_HAL_ChibiOS/hwdef/ARK_FPV/common.inc new file mode 100644 index 0000000000000..700a76bf47f3a --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/ARK_FPV/common.inc @@ -0,0 +1,32 @@ +# MCU class and specific type +MCU STM32H7xx STM32H743xx + +# board ID for firmware load +APJ_BOARD_ID 59 + +# crystal frequency +OSCILLATOR_HZ 16000000 + +# 480Hz is only value support on H7 +# MCU_CLOCKRATE_MHZ 320 + +# flash size +FLASH_SIZE_KB 2048 + +# enable DFU reboot for installing bootloader +# note that if firmware is build with --secure-bl then DFU is +# disabled +ENABLE_DFU_BOOT 1 + +# USB +PA11 OTG_FS_DM OTG1 +PA12 OTG_FS_DP OTG1 +PA9 VBUS INPUT OPENDRAIN + +# SWD +PA13 JTMS-SWDIO SWD +PA14 JTCK-SWCLK SWD + +# debug uart +PD8 USART3_TX USART3 +PD9 USART3_RX USART3 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/ARK_FPV/hwdef-bl.dat b/libraries/AP_HAL_ChibiOS/hwdef/ARK_FPV/hwdef-bl.dat index e7f8ce5f0d530..bdde76cb59ad3 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/ARK_FPV/hwdef-bl.dat +++ b/libraries/AP_HAL_ChibiOS/hwdef/ARK_FPV/hwdef-bl.dat @@ -1,14 +1,6 @@ -# hw definition file for processing by chibios_hwdef.py -# for the ARKV6X hardware +# processed by chibios_hwdef.py -# MCU class and specific type -MCU STM32H7xx STM32H743xx - -# crystal frequency -OSCILLATOR_HZ 16000000 - -# board ID for firmware load -APJ_BOARD_ID 59 +include common.inc # bootloader is installed at zero offset FLASH_RESERVE_START_KB 0 @@ -16,46 +8,26 @@ FLASH_RESERVE_START_KB 0 # the location where the bootloader will put the firmware FLASH_BOOTLOADER_LOAD_KB 128 -# flash size -FLASH_SIZE_KB 2048 - env OPTIMIZE -Os # order of UARTs (and USB) SERIAL_ORDER OTG1 UART7 UART5 USART3 -# USB -PA11 OTG_FS_DM OTG1 -PA12 OTG_FS_DP OTG1 -PA9 VBUS INPUT OPENDRAIN - -# pins for SWD debugging -PA13 JTMS-SWDIO SWD -PA14 JTCK-SWCLK SWD - # CS pins - -# ICM20602 +# SPI1 - IIM42653 PI9 IMU1_CS CS -# BMMI088 Accel -PI4 BMI088_A_CS CS -# BMMI088 Gyro -PI8 BMI088_G_CS CS -# Unused -# PG7 FRAM_CS CS +# SPI6 - external PI10 EXT1_CS CS # telem1 -PE8 UART7_TX UART7 -PF6 UART7_RX UART7 +PE8 UART7_TX UART7 +PF6 UART7_RX UART7 +PF8 UART7_RTS UART7 +PE10 UART7_CTS UART7 # telem2 PC12 UART5_TX UART5 -PD2 UART5_RX UART5 - -# debug uart -PD8 USART3_TX USART3 -PD9 USART3_RX USART3 +PD2 UART5_RX UART5 # armed indication PE6 nARMED OUTPUT HIGH @@ -70,6 +42,3 @@ define HAL_LED_ON 0 define HAL_USE_EMPTY_STORAGE 1 define HAL_STORAGE_SIZE 16384 - -# enable DFU by default -ENABLE_DFU_BOOT 1 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/ARK_FPV/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/ARK_FPV/hwdef.dat index 936bb5a773362..e6b743945a884 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/ARK_FPV/hwdef.dat +++ b/libraries/AP_HAL_ChibiOS/hwdef/ARK_FPV/hwdef.dat @@ -1,23 +1,10 @@ -# hw definition file for processing by chibios_hwdef.py -# for the ARK FPV hardware +# processed by chibios_hwdef.py -# MCU class and specific type -MCU STM32H7xx STM32H743xx - -# crystal frequency -OSCILLATOR_HZ 16000000 - -# TODO: changing clockrate causes the build to fail -# MCU_CLOCKRATE_MHZ 320 +include common.inc # ChibiOS system timer STM32_ST_USE_TIMER 2 -# board ID for firmware load -APJ_BOARD_ID 59 - -# flash size -FLASH_SIZE_KB 2048 # bootloader takes first sector FLASH_RESERVE_START_KB 128 @@ -42,46 +29,29 @@ STDOUT_BAUDRATE 57600 # default to all pins low to avoid ESD issues DEFAULTGPIO OUTPUT LOW PULLDOWN -# USB -PA11 OTG_FS_DM OTG1 -PA12 OTG_FS_DP OTG1 -PA9 VBUS INPUT OPENDRAIN - -# pins for SWD debugging -PA13 JTMS-SWDIO SWD -PA14 JTCK-SWCLK SWD - -# telem1 -PE8 UART7_TX UART7 -PF6 UART7_RX UART7 -PF8 UART7_RTS UART7 +# Telem1 - Telem +PE8 UART7_TX UART7 +PF6 UART7_RX UART7 +PF8 UART7_RTS UART7 PE10 UART7_CTS UART7 -# telem2 -PC8 UART5_RTS UART5 -PC9 UART5_CTS UART5 +# Telem2 - VTX (DJI Air Unit) PC12 UART5_TX UART5 -PD2 UART5_RX UART5 - -# telem3 -PA3 USART2_RX USART2 -PD5 USART2_TX USART2 -PD3 USART2_CTS USART2 -PD4 USART2_RTS USART2 +PD2 UART5_RX UART5 # GPS1 PB6 USART1_TX USART1 PB7 USART1_RX USART1 -# uart4 +# Telem3 - VTX (DJI Air Unit, RX only) +PA3 USART2_RX USART2 +PD5 USART2_TX USART2 + +# ESC telem RX only PH13 UART4_TX UART4 PH14 UART4_RX UART4 -# debug uart -PD8 USART3_TX USART3 -PD9 USART3_RX USART3 - -# used for RC SBUS +# RC Input PC6 USART6_TX USART6 PC7 USART6_RX USART6 @@ -95,27 +65,27 @@ PB1 VDD_5V_SENS ADC1 SCALE(2) PB0 BATT_VOLTAGE_SENS ADC1 SCALE(1) PC2 BATT_CURRENT_SENS ADC1 SCALE(1) -# Now setup the default battery pins driver analog pins and default -# scaling for the power brick. +# Analog battery input scaling # See STM32H743xx.py define HAL_BATT_VOLT_PIN 9 define HAL_BATT_CURR_PIN 12 define HAL_BATT_VOLT_SCALE 21 define HAL_BATT_CURR_SCALE 120 +define HAL_BATT_MONITOR_DEFAULT 4 # ESC Telem on UART4 define HAL_SERIAL_ESC_COMM_ENABLED 1 define HAL_WITH_ESC_TELEM 1 define DEFAULT_SERIAL4_PROTOCOL SerialProtocol_ESCTelemetry -# SPI1 - IIM42653 +# SPI1 - IIM42653 IMU PA5 SPI1_SCK SPI1 PB5 SPI1_MOSI SPI1 PG9 SPI1_MISO SPI1 PI9 IMU1_CS CS PF2 IMU1_DRDY INPUT -# SPI6 - external1 +# SPI6 - external PB3 SPI6_SCK SPI6 PA6 SPI6_MISO SPI6 PG14 SPI6_MOSI SPI6 @@ -123,22 +93,25 @@ PI10 EXT1_CS CS PD11 DRDY_ADIS16507 INPUT GPIO(93) # use GPIO(93) for data ready on ADIS16507 -#define ADIS_DRDY_PIN 93 - -# PWM output pins -PI0 TIM5_CH4 TIM5 PWM(1) GPIO(50) -PH12 TIM5_CH3 TIM5 PWM(2) GPIO(51) -PH11 TIM5_CH2 TIM5 PWM(3) GPIO(52) -PH10 TIM5_CH1 TIM5 PWM(4) GPIO(53) -PI5 TIM8_CH1 TIM8 PWM(5) GPIO(54) -PI6 TIM8_CH2 TIM8 PWM(6) GPIO(55) -PI7 TIM8_CH3 TIM8 PWM(7) GPIO(56) -PI2 TIM8_CH4 TIM8 PWM(8) GPIO(57) +# define ADIS_DRDY_PIN 93 + +# Motors +PI0 TIM5_CH4 TIM5 PWM(1) GPIO(50) BIDIR +PH12 TIM5_CH3 TIM5 PWM(2) GPIO(51) BIDIR +PH11 TIM5_CH2 TIM5 PWM(3) GPIO(52) BIDIR +PH10 TIM5_CH1 TIM5 PWM(4) GPIO(53) BIDIR +PI5 TIM8_CH1 TIM8 PWM(5) GPIO(54) BIDIR +PI6 TIM8_CH2 TIM8 PWM(6) GPIO(55) BIDIR +PI7 TIM8_CH3 TIM8 PWM(7) GPIO(56) BIDIR +PI2 TIM8_CH4 TIM8 PWM(8) GPIO(57) BIDIR PD12 TIM4_CH1 TIM4 PWM(9) GPIO(58) +# PWM output for buzzer +PF9 TIM14_CH1 TIM14 GPIO(77) ALARM + # CAN bus -PD0 CAN1_RX CAN1 -PD1 CAN1_TX CAN1 +PD0 CAN1_RX CAN1 +PD1 CAN1_TX CAN1 # I2C1 (GPS1 compass, external) PB9 I2C1_SDA I2C1 @@ -173,18 +146,17 @@ PE6 nARMED OUTPUT HIGH PC13 VDD_3V3_SD_CARD_EN OUTPUT HIGH PI11 VDD_3V3_SENSORS1_EN OUTPUT HIGH -# start peripheral power off, then enable after init +# (12V EN) start peripheral power off, then enable after init # this prevents a problem with radios that use RTS for # bootloader hold -# 12V EN -PG4 nVDD_5V_PERIPH_EN OUTPUT HIGH +PG4 nVDD_5V_PERIPH_EN OUTPUT HIGH # power sensing PE15 VDD_5V_PERIPH_nOC INPUT PULLUP PF13 VDD_5V_HIPOWER_nOC INPUT PULLUP PG1 VDD_BRICK_nVALID INPUT PULLUP -# microSD support +# MicroSD PD6 SDMMC2_CK SDMMC2 PD7 SDMMC2_CMD SDMMC2 PB14 SDMMC2_D0 SDMMC2 @@ -207,43 +179,30 @@ PG0 HW_VER_REV_DRIVE OUTPUT LOW # PH3 HW_VER_SENS ADC3 SCALE(1) # PH4 HW_REV_SENS ADC3 SCALE(1) -# PWM output for buzzer -PF9 TIM14_CH1 TIM14 GPIO(77) ALARM - -# barometer on i2c_2 +# Barometer on i2c_2 BARO BMP388 I2C:1:0x76 -# compass -define HAL_PROBE_EXTERNAL_I2C_COMPASSES - -# builtin compass +# Compass COMPASS IIS2MDC I2C:2:0x1E false ROTATION_NONE +define HAL_PROBE_EXTERNAL_I2C_COMPASSES -# IIM42653 on SPI1 +# IIM42653 IMU on SPI1 SPIDEV iim42653 SPI1 DEVID1 IMU1_CS MODE3 2*MHZ 8*MHZ -#SPIDEV adis16507 SPI6 DEVID1 EXT1_CS MODE3 1*MHZ 2*MHZ - -# IIM42653 IMU IMU Invensensev3 SPI:iim42653 ROTATION_YAW_270 -# IMU Invensensev3 SPI:iim42652 ROTATION_YAW_270 -#IMU ADIS1647x SPI:adis16507 ROTATION_NONE ADIS_DRDY_PIN + +# SPI6 external bus +# SPIDEV adis16507 SPI6 DEVID1 EXT1_CS MODE3 1*MHZ 2*MHZ +# IMU ADIS1647x SPI:adis16507 ROTATION_NONE ADIS_DRDY_PIN define HAL_DEFAULT_INS_FAST_SAMPLE 1 -# analog voltage and current -define HAL_BATT_MONITOR_DEFAULT 4 +DMA_PRIORITY SDMMC* SPI* -DMA_PRIORITY SDMMC* USART6* ADC* UART* USART* SPI* TIM* +DMA_NOSHARE SPI* TIM5* TIM8* # enable FAT filesystem support (needs a microSD defined via SDMMC) define HAL_OS_FATFS_IO 1 -# ROMFS io_firmware.bin Tools/IO_Firmware/iofirmware_lowpolh.bin - -# enable DFU reboot for installing bootloader -# note that if firmware is build with --secure-bl then DFU is -# disabled -ENABLE_DFU_BOOT 1 # bootloader embedding / bootloader flashing not available define AP_BOOTLOADER_FLASHING_ENABLED 0