From fd2195d6fe3d99c97f4d607468acfbf1234949d9 Mon Sep 17 00:00:00 2001 From: QioTek <71515778+QioTek@users.noreply.github.com> Date: Mon, 18 Oct 2021 09:20:22 +1100 Subject: [PATCH] HAL_ChibiOS: added QioTekZealotH743 support --- .../hwdef/QioTekZealotH743/README.md | 51 ++++ .../hwdef/QioTekZealotH743/defaults.parm | 20 ++ .../hwdef/QioTekZealotH743/hwdef-bl.dat | 60 +++++ .../hwdef/QioTekZealotH743/hwdef.dat | 231 ++++++++++++++++++ 4 files changed, 362 insertions(+) create mode 100644 libraries/AP_HAL_ChibiOS/hwdef/QioTekZealotH743/README.md create mode 100644 libraries/AP_HAL_ChibiOS/hwdef/QioTekZealotH743/defaults.parm create mode 100644 libraries/AP_HAL_ChibiOS/hwdef/QioTekZealotH743/hwdef-bl.dat create mode 100644 libraries/AP_HAL_ChibiOS/hwdef/QioTekZealotH743/hwdef.dat diff --git a/libraries/AP_HAL_ChibiOS/hwdef/QioTekZealotH743/README.md b/libraries/AP_HAL_ChibiOS/hwdef/QioTekZealotH743/README.md new file mode 100644 index 0000000000..610738a4c3 --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/QioTekZealotH743/README.md @@ -0,0 +1,51 @@ +## QioTekZealotH743 Flight Controller + +The QioTek Zealot H743 flight controller is sold by a range of resellers listed on the QIOTEK(http://www.Qio-Tek.com) + +## Features + +• STM32H743VIT6 microcontroller + +• Three IMUs, one ICM42688-P(SPI), one ICM42605(SPI), one ICM20689(SPI), ADIS1647X for reserve(SPI) + +• internal heater for IMUs temperature control + +• internal Soft Rubber Damping Ball isolation for All interna IMUs + +• Two DPS310(SPI) barometers + +• builtin QMC5883L or IST8310 magnetometer(internal I2C) + +• builtin analog OSD(SPI) + +• builtin RAMTRON(SPI) + +• microSD card slot + +• 5 UARTs and USB(Type-C) + +• PPM & S.Bus input + +• 14 PWM outputs + +• 4 Relay outputs + +• tow I2C ports and two FDCAN ports + +• one S.Bus output(inverter Share Serial5) + +• External Buzzer + +• builtin RGB LED + +• two voltage & current monitoring and servo rail voltage monitoring(support to 36V)) + +• two ADC inputs(default one for RSSI, one for Airspeed sensor, both support to 6.6V) + +• servo rail BEC independent power input for servos + +• builtin BEC(6S 1.5A)power input(share power2 module voltage monitoring) + +• external safety Switch + +• external USB connectors (Type-C USB and JST GH1.25) diff --git a/libraries/AP_HAL_ChibiOS/hwdef/QioTekZealotH743/defaults.parm b/libraries/AP_HAL_ChibiOS/hwdef/QioTekZealotH743/defaults.parm new file mode 100644 index 0000000000..178a393a5a --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/QioTekZealotH743/defaults.parm @@ -0,0 +1,20 @@ +# setup the heater temperature to 45 degree +BRD_IMU_TARGTEMP 45 + +# setup serial2 port defaults for ESP8266 +define HAL_SERIAL2_PROTOCOL SerialProtocol_MAVLink2 +define HAL_SERIAL2_BAUD 921600 + +# setup the parameter for the ADC power module +BATT_VOLT_PIN 16 +BATT_CURR_PIN 17 +BATT_VOLT_MULT 20.000 +BATT_AMP_PERVLT 17.000 +BATT2_VOLT_PIN 10 +BATT2_CURR_PIN 11 +BATT2_VOLT_MULT 20.000 +BATT2_AMP_PERVLT 17.000 + +# setup the parameter for the two Relays GPIO others for reserve +define RELAY1_PIN_DEFAULT 1 +define RELAY2_PIN_DEFAULT 2 \ No newline at end of file diff --git a/libraries/AP_HAL_ChibiOS/hwdef/QioTekZealotH743/hwdef-bl.dat b/libraries/AP_HAL_ChibiOS/hwdef/QioTekZealotH743/hwdef-bl.dat new file mode 100644 index 0000000000..8310604265 --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/QioTekZealotH743/hwdef-bl.dat @@ -0,0 +1,60 @@ +# hw definition file for processing by chibios_hwdef.py +# for Qiotek ZealotH743 + +# MCU class and specific type +MCU STM32H7xx STM32H743xx + +# crystal frequency +OSCILLATOR_HZ 8000000 + +# board ID for firmware load +APJ_BOARD_ID 1036 + +FLASH_SIZE_KB 2048 + +# bootloader is installed at zero offset +FLASH_RESERVE_START_KB 0 + +# the location where the bootloader will put the firmware +# the H743 has 128k sectors +FLASH_BOOTLOADER_LOAD_KB 128 + +# ChibiOS system timer +STM32_ST_USE_TIMER 2 + +#define LED pins +PE2 LED_BOOTLOADER OUTPUT OPENDRAIN HIGH # red +PE1 LED_ACTIVITY OUTPUT OPENDRAIN HIGH # green +PE0 LED_RED OUTPUT OPENDRAIN HIGH # blue + +define HAL_LED_ON 1 + +# order of UARTs (and USB) +SERIAL_ORDER OTG1 UART7 + +# UART7 is debug +PE7 UART7_RX UART7 NODMA +PE8 UART7_TX UART7 NODMA + +PA11 OTG_FS_DM OTG1 +PA12 OTG_FS_DP OTG1 +PA9 VBUS INPUT + +PA13 JTMS-SWDIO SWD +PA14 JTCK-SWCLK SWD + +define HAL_USE_EMPTY_STORAGE 1 +define HAL_STORAGE_SIZE 32768 + +define BOOTLOADER_DEBUG SD7 + +# Add CS pins to ensure they are high in bootloader +PB2 IMU1_CS CS +PE10 IMU2_CS CS +PE12 IMU3_CS CS +PA10 FRAM_CS CS +PA15 ADIS1647X_CS CS +PA8 AT7456_CS CS +PE3 MS5611_CS CS +PD7 DPS310_CS CS +PC10 FLASH_CS CS \ No newline at end of file diff --git a/libraries/AP_HAL_ChibiOS/hwdef/QioTekZealotH743/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/QioTekZealotH743/hwdef.dat new file mode 100644 index 0000000000..3de53861f4 --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/QioTekZealotH743/hwdef.dat @@ -0,0 +1,231 @@ +# hw definition file for processing by chibios_hwdef.py for Qiotek ZealotH743 +# MCU class and specific type +MCU STM32H7xx STM32H743xx + +# crystal frequency +OSCILLATOR_HZ 8000000 + +# board ID for firmware load +APJ_BOARD_ID 1036 + +FLASH_SIZE_KB 2048 + +# with 2M flash we can afford to optimize for speed +env OPTIMIZE -O2 + +# ChibiOS system timer +STM32_ST_USE_TIMER 2 + +# bootloader takes first sector +FLASH_RESERVE_START_KB 128 + +# order of UARTs (and USB) +SERIAL_ORDER OTG1 USART1 USART2 USART3 UART4 UART7 + +# now we define the pins that USB is connected on +PA11 OTG_FS_DM OTG1 +PA12 OTG_FS_DP OTG1 +PA9 VBUS INPUT + +# these are the pins for SWD debugging with a STlinkv2 or black-magic probe +PA13 JTMS-SWDIO SWD +PA14 JTCK-SWCLK SWD + +# SPI1 - internal sensors and OSD +PA5 SPI1_SCK SPI1 +PA6 SPI1_MISO SPI1 +PA7 SPI1_MOSI SPI1 + +# SPI2 - FRAM and SmartCard +PD3 SPI2_SCK SPI2 +PC2 SPI2_MISO SPI2 +PC3 SPI2_MOSI SPI2 + +# SPI3 - ADIS16470 sensor +PB3 SPI3_SCK SPI3 +PB4 SPI3_MISO SPI3 +PB5 SPI3_MOSI SPI3 + +# sensor + +PB2 IMU1_CS CS +PE10 IMU2_CS CS +PE12 IMU3_CS CS +PE3 BARO1_CS CS +PD7 BARO2_CS CS +PA8 AT7456_CS CS +PA10 FRAM_CS CS +PC10 FLASH_CS CS +PA15 ADIS16470_CS CS + +# use GPIO(93) for data ready on ADIS16470 +define ADIS_DRDY_PIN 93 + +# define the order that I2C buses +I2C_ORDER I2C2 I2C1 + +# I2C1 is on GPS port +PB6 I2C1_SCL I2C1 +PB7 I2C1_SDA I2C1 + +# I2C2 +PB10 I2C2_SCL I2C2 +PB11 I2C2_SDA I2C2 + +define HAL_I2C_INTERNAL_MASK 1 + +# define UARTs + +# USART1 is telem1 +PB15 USART1_RX USART1 +PB14 USART1_TX USART1 + +# USART2 is telem2 +PD6 USART2_RX USART2 +PD5 USART2_TX USART2 + +# USART3 is GPS1 +PD9 USART3_RX USART3 +PD8 USART3_TX USART3 NODMA + +# USART4 is GPS2 +PB8 UART4_RX UART4 NODMA +PB9 UART4_TX UART4 NODMA + +# UART7 is debug +PE7 UART7_RX UART7 NODMA +PE8 UART7_TX UART7 NODMA + +# PWM AUX channels +PA2 TIM5_CH3 TIM5 PWM(1) GPIO(50) +PA3 TIM5_CH4 TIM5 PWM(2) GPIO(51) +PB0 TIM3_CH3 TIM3 PWM(3) GPIO(52) +PC9 TIM3_CH4 TIM3 PWM(4) GPIO(53) +PE9 TIM1_CH1 TIM1 PWM(5) GPIO(54) +PE11 TIM1_CH2 TIM1 PWM(6) GPIO(55) +PE13 TIM1_CH3 TIM1 PWM(7) GPIO(56) +PE14 TIM1_CH4 TIM1 PWM(8) GPIO(57) + +PD12 TIM4_CH1 TIM4 PWM(9) GPIO(58) +PD13 TIM4_CH2 TIM4 PWM(10) GPIO(59) +PD14 TIM4_CH3 TIM4 PWM(11) GPIO(60) +PD15 TIM4_CH4 TIM4 PWM(12) GPIO(61) +PC6 TIM3_CH1 TIM3 PWM(13) GPIO(62) NODMA +PC7 TIM3_CH2 TIM3 PWM(14) GPIO(63) NODMA + + +# PWM output for buzzer +PE5 TIM15_CH1 TIM15 GPIO(77) ALARM + +# RC input +PC8 TIM8_CH3 TIM8 RCININT PULLUP LOW + +# analog in +PA0 BATT_VOLTAGE_SENS ADC1 SCALE(2) +PA1 BATT_CURRENT_SENS ADC1 SCALE(2) +PC0 BATT2_VOLTAGE_SENS ADC1 SCALE(2) +PC1 BATT2_CURRENT_SENS ADC1 SCALE(2) + +# Board VCC and servo rail VCC +PA4 VDD_5V_SENS ADC1 SCALE(2) +PC4 FMU_SERVORAIL_VCC_SENS ADC1 SCALE(12) + +# analog in ADC6.6 +PC5 PRESSURE_SENS ADC1 SCALE(2) +PB1 RSSI_IN ADC1 SCALE(2) + + +# CAN bus +PD0 CAN1_RX CAN1 +PD1 CAN1_TX CAN1 + +# 2nd CAN bus +PB12 CAN2_RX CAN2 +PB13 CAN2_TX CAN2 + +# control for silent (no output) for CAN +PD11 GPIO_CAN1_SILENT OUTPUT PUSHPULL SPEED_LOW LOW GPIO(70) +PD10 GPIO_CAN2_SILENT OUTPUT PUSHPULL SPEED_LOW LOW GPIO(71) + + +# SPI devices +SPIDEV adis16470 SPI3 DEVID1 ADIS16470_CS MODE3 1*MHZ 2*MHZ +SPIDEV imu1 SPI1 DEVID1 IMU1_CS MODE3 2*MHZ 8*MHZ +SPIDEV imu2 SPI1 DEVID2 IMU2_CS MODE3 2*MHZ 8*MHZ +SPIDEV imu3 SPI1 DEVID3 IMU3_CS MODE3 2*MHZ 8*MHZ +SPIDEV baro1 SPI1 DEVID2 BARO1_CS MODE3 5*MHZ 5*MHZ +SPIDEV baro2 SPI1 DEVID1 BARO2_CS MODE3 5*MHZ 5*MHZ +SPIDEV osd SPI1 DEVID2 AT7456_CS MODE0 10*MHZ 10*MHZ +SPIDEV ramtron SPI2 DEVID2 FRAM_CS MODE3 8*MHZ 8*MHZ +SPIDEV sdcard SPI2 DEVID3 FLASH_CS MODE0 400*KHZ 10*MHZ + + +# four IMUs, ADIS1647X for reserve +IMU ADIS1647x SPI:adis16470 ROTATION_PITCH_180_YAW_270 ADIS_DRDY_PIN +IMU Invensense SPI:imu1 ROTATION_ROLL_180 +IMU Invensensev3 SPI:imu1 ROTATION_YAW_270 +IMU Invensense SPI:imu2 ROTATION_ROLL_180 +IMU Invensensev3 SPI:imu2 ROTATION_YAW_270 +IMU Invensense SPI:imu3 ROTATION_ROLL_180 + + +# two Baro sensors +BARO DPS280 SPI:baro1 +BARO DPS280 SPI:baro2 + + +define HAL_DEFAULT_INS_FAST_SAMPLE 5 + + +# look for I2C compass +COMPASS IST8310 I2C:0:0x0E false ROTATION_ROLL_180_YAW_270 +COMPASS QMC5883L I2C:0:0x0D false ROTATION_ROLL_180_YAW_270 +define HAL_PROBE_EXTERNAL_I2C_COMPASSES +define HAL_I2C_INTERNAL_MASK 1 + + +# LED setup is similar to PixRacer +define HAL_HAVE_PIXRACER_LED +PE2 LED_RED OUTPUT GPIO(10) +PE1 LED_GREEN OUTPUT GPIO(11) +PE0 LED_BLUE OUTPUT GPIO(12) + +define HAL_GPIO_A_LED_PIN 10 +define HAL_GPIO_B_LED_PIN 11 +define HAL_GPIO_C_LED_PIN 12 + +define HAL_GPIO_LED_ON 0 +define HAL_GPIO_LED_OFF 1 + +#define GPIOs + +PE15 HEATER_EN OUTPUT LOW GPIO(80) +define HAL_HEATER_GPIO_PIN 80 +define HAL_HAVE_IMU_HEATER 1 + +PC11 EXTERN_GPIO1 OUTPUT GPIO(1) +PC12 EXTERN_GPIO2 OUTPUT GPIO(2) +PD2 EXTERN_GPIO3 OUTPUT GPIO(3) +PE6 EXTERN_GPIO4 OUTPUT GPIO(4) + +# enable FAT filesystem support +define HAL_OS_FATFS_IO 1 +define HAL_BOARD_LOG_DIRECTORY "/APM/LOGS" +define HAL_BOARD_TERRAIN_DIRECTORY "/APM/TERRAIN" + +# enable RAMTROM parameter storage +define HAL_STORAGE_SIZE 32768 +define HAL_WITH_RAMTRON 1 + +# allow to have have a dedicated safety switch pin +define HAL_HAVE_SAFETY_SWITCH 1 +PC13 LED_SAFETY OUTPUT +PE4 SAFETY_IN INPUT PULLDOWN + +# setup for OSD +define OSD_ENABLED 1 +define HAL_OSD_TYPE_DEFAULT 1 +ROMFS_WILDCARD libraries/AP_OSD/fonts/font*.bin + +DMA_PRIORITY ADC* SPI1* TIM*UP* +DMA_NOSHARE SPI1* TIM*UP*