From 88d49fb654a5c680b36b6ebde18f5f6fe37adb05 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 21 Jun 2022 13:23:54 +1000 Subject: [PATCH] hwdef: added Pixhawk6C support --- .../hwdef/Pixhawk6C/hwdef-bl.dat | 72 +++++ .../AP_HAL_ChibiOS/hwdef/Pixhawk6C/hwdef.dat | 248 ++++++++++++++++++ 2 files changed, 320 insertions(+) create mode 100644 libraries/AP_HAL_ChibiOS/hwdef/Pixhawk6C/hwdef-bl.dat create mode 100644 libraries/AP_HAL_ChibiOS/hwdef/Pixhawk6C/hwdef.dat diff --git a/libraries/AP_HAL_ChibiOS/hwdef/Pixhawk6C/hwdef-bl.dat b/libraries/AP_HAL_ChibiOS/hwdef/Pixhawk6C/hwdef-bl.dat new file mode 100644 index 0000000000..0629141759 --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/Pixhawk6C/hwdef-bl.dat @@ -0,0 +1,72 @@ +# hw definition file for processing by chibios_hwdef.py +# for the HolybroV6C hardware + +# MCU class and specific type +MCU STM32H7xx STM32H743xx + +# crystal frequency +OSCILLATOR_HZ 16000000 + +# USB setup +USB_VENDOR 0x3162 # ONLY FOR USE BY Holybro +USB_PRODUCT 0x0053 +USB_STRING_MANUFACTURER "Holybro" + +# board ID for firmware load +APJ_BOARD_ID 53 + +# 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 + +# flash size +FLASH_SIZE_KB 2048 + +env OPTIMIZE -Os + +# order of UARTs (and USB) +SERIAL_ORDER OTG1 UART7 UART5 USART3 + +# 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 + +# CS pins +PC13 ICM42688_CS CS +PC14 BMI055_G_CS CS +PC15 BMI055_A_CS CS +PD4 FRAM_CS CS + +# telem1 +PE8 UART7_TX UART7 +PE7 UART7_RX UART7 + +# telem2 +PC12 UART5_TX UART5 +PD2 UART5_RX UART5 + +# debug uart +PD8 USART3_TX USART3 +PD9 USART3_RX USART3 + +# start peripheral power off +PC10 nVDD_5V_HIPOWER_EN OUTPUT HIGH +PE2 nVDD_5V_PERIPH_EN OUTPUT HIGH + +# LEDs +PD10 LED_ACTIVITY OUTPUT OPENDRAIN GPIO(90) HIGH # red +PD11 LED_BOOTLOADER OUTPUT OPENDRAIN GPIO(92) HIGH # blue +define HAL_LED_ON 0 + +define HAL_USE_EMPTY_STORAGE 1 +define HAL_STORAGE_SIZE 16384 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/Pixhawk6C/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/Pixhawk6C/hwdef.dat new file mode 100644 index 0000000000..9e8130e114 --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/Pixhawk6C/hwdef.dat @@ -0,0 +1,248 @@ +# hw definition file for processing by chibios_hwdef.py +# for the HolybroV6C hardware + +# MCU class and specific type +MCU STM32H7xx STM32H743xx + +# crystal frequency +OSCILLATOR_HZ 16000000 + +# ChibiOS system timer +STM32_ST_USE_TIMER 2 + +# USB setup +USB_VENDOR 0x3162 # ONLY FOR USE BY Holybro +USB_PRODUCT 0x0053 +USB_STRING_MANUFACTURER "Holybro" + +# board ID for firmware load +APJ_BOARD_ID 53 + +FLASH_RESERVE_START_KB 128 + +# to be compatible with the px4 bootloader we need +# to use a different RAM_MAP +env USE_ALT_RAM_MAP 1 + +# flash size +FLASH_SIZE_KB 2048 + +env OPTIMIZE -O2 + +# order of UARTs (and USB) +SERIAL_ORDER OTG1 UART7 UART5 USART1 UART8 USART2 USART3 OTG2 + +# default the 2nd interface to MAVLink2 +define HAL_OTG2_PROTOCOL SerialProtocol_MAVLink2 + +# 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 +PE7 UART7_RX UART7 +PE9 UART7_RTS UART7 +PE10 UART7_CTS UART7 + +# telem2 +PC12 UART5_TX UART5 +PD2 UART5_RX UART5 +PC8 UART5_RTS UART5 +PC9 UART5_CTS UART5 + +# GPS1 +PB6 USART1_TX USART1 +PA10 USART1_RX USART1 + +# GPS2 +PE1 UART8_TX UART8 +PE0 UART8_RX UART8 + +# uart2 telem3 +PD5 USART2_TX USART2 +PA3 USART2_RX USART2 + +# debug uart +PD8 USART3_TX USART3 +PD9 USART3_RX USART3 + +# USART6 is for IOMCU +PC6 USART6_TX USART6 +PC7 USART6_RX USART6 + +IOMCU_UART USART6 + +# ADC + +PC5 BATT_VOLTAGE_SENS ADC1 SCALE(1) +PC4 BATT_CURRENT_SENS ADC1 SCALE(1) + +PB1 BATT2_VOLTAGE_SENS ADC1 SCALE(1) +PA2 BATT2_CURRENT_SENS ADC1 SCALE(1) + +PA4 VDD_5V_SENS ADC1 SCALE(2) + +# SPI1 - IMUs +PA5 SPI1_SCK SPI1 +PA6 SPI1_MISO SPI1 +PA7 SPI1_MOSI SPI1 +PC13 ICM42688_CS CS +PC14 BMI055_G_CS CS +PC15 BMI055_A_CS CS +PE4 BMI055_DRDY_A INPUT +PE5 BMI055_DRDY_G INPUT +PE6 ICM42688_DRDY INPUT + +# SPI2 - FRAM +PD3 SPI2_SCK SPI2 +PC2 SPI2_MISO SPI2 +PC3 SPI2_MOSI SPI2 +PD4 FRAM_CS CS + +# PWM output pins +PA8 TIM1_CH1 TIM1 PWM(1) GPIO(50) +PE11 TIM1_CH2 TIM1 PWM(2) GPIO(51) +PE13 TIM1_CH3 TIM1 PWM(3) GPIO(52) +PE14 TIM1_CH4 TIM1 PWM(4) GPIO(53) +PD14 TIM4_CH3 TIM4 PWM(5) GPIO(54) +PD15 TIM4_CH4 TIM4 PWM(6) GPIO(55) +PA0 TIM5_CH1 TIM5 PWM(7) GPIO(56) +PA1 TIM5_CH2 TIM5 PWM(8) GPIO(57) + +# CAN bus +PD0 CAN1_RX CAN1 +PD1 CAN1_TX CAN1 + +PB5 CAN2_RX CAN2 +PB13 CAN2_TX CAN2 + + +# I2C buses + +# I2C1, GPS+MAG +PB7 I2C1_SDA I2C1 +PB8 I2C1_SCL I2C1 + +# I2C2, GPS2+MAG +PB10 I2C2_SCL I2C2 +PB11 I2C2_SDA I2C2 + +# I2C4 internal +PD12 I2C4_SCL I2C4 +PD13 I2C4_SDA I2C4 + +# order of I2C buses +I2C_ORDER I2C4 I2C1 I2C2 +define HAL_I2C_INTERNAL_MASK 1 + +# heater +PB9 HEATER_EN OUTPUT LOW GPIO(80) +define HAL_HEATER_GPIO_PIN 80 + +# Setup the IMU heater +define HAL_HAVE_IMU_HEATER 1 +define HAL_IMU_TEMP_DEFAULT 45 +define HAL_IMUHEAT_P_DEFAULT 50 +define HAL_IMUHEAT_I_DEFAULT 0.07 + +# power enable pins +PB2 VDD_3V3_SENSORS1_EN OUTPUT HIGH + +# start peripheral power off, then enable after init +# this prevents a problem with radios that use RTS for +# bootloader hold +PC10 nVDD_5V_HIPOWER_EN OUTPUT HIGH +PE2 nVDD_5V_PERIPH_EN OUTPUT HIGH + +# Control of Spektrum power pin +PH2 SPEKTRUM_PWR OUTPUT HIGH GPIO(73) +define HAL_GPIO_SPEKTRUM_PWR 73 + +# Spektrum Power is Active High +define HAL_SPEKTRUM_PWR_ENABLED 1 + +# power sensing +PE3 VDD_5V_PERIPH_nOC INPUT PULLUP +PF13 VDD_5V_HIPOWER_nOC INPUT PULLUP + +PA15 VDD_BRICK_nVALID INPUT PULLUP +PB12 VDD_BRICK2_nVALID INPUT PULLUP + +# microSD support +PD6 SDMMC2_CK SDMMC2 +PD7 SDMMC2_CMD SDMMC2 +PB14 SDMMC2_D0 SDMMC2 +PB15 SDMMC2_D1 SDMMC2 +PB3 SDMMC2_D2 SDMMC2 +PB4 SDMMC2_D3 SDMMC2 +define FATFS_HAL_DEVICE SDCD2 + +# LEDs +PD10 LED_RED OUTPUT OPENDRAIN GPIO(90) HIGH +PD11 LED_BLUE OUTPUT OPENDRAIN GPIO(92) HIGH + +# setup for BoardLED2 +define HAL_GPIO_A_LED_PIN 90 +define HAL_GPIO_B_LED_PIN 92 +define HAL_GPIO_LED_ON 0 + +# ID pins +PE12 HW_VER_REV_DRIVE OUTPUT LOW +# PC0 HW_REV_SENS ADC1 SCALE(1) +# PC1 HW_VER_SENS ADC1 SCALE(1) + +# PWM output for buzzer +PB0 TIM3_CH3 TIM3 GPIO(77) ALARM + +# barometers +BARO MS56XX I2C:0:0x76 +BARO MS56XX I2C:0:0x77 +BARO BMP388 I2C:0:0x77 + +# prototypes may have no baro +define HAL_BARO_ALLOW_INIT_NO_BARO 1 + +# compass +define HAL_PROBE_EXTERNAL_I2C_COMPASSES +COMPASS IST8310 I2C:0:0x0C false ROTATION_NONE + +# we need to stop the probe of an IST8310 as an internal compass with PITCH_180 +define HAL_COMPASS_DISABLE_IST8310_INTERNAL_PROBE + +# SPI devices +SPIDEV bmi055_g SPI1 DEVID1 BMI055_G_CS MODE3 10*MHZ 10*MHZ +SPIDEV bmi055_a SPI1 DEVID2 BMI055_A_CS MODE3 10*MHZ 10*MHZ +SPIDEV icm42688 SPI1 DEVID3 ICM42688_CS MODE3 2*MHZ 8*MHZ +SPIDEV ramtron SPI2 DEVID1 FRAM_CS MODE3 8*MHZ 8*MHZ + +# 2 IMUs +IMU Invensensev3 SPI:icm42688 ROTATION_PITCH_180_YAW_90 +IMU BMI055 SPI:bmi055_a SPI:bmi055_g ROTATION_PITCH_180 + +define HAL_DEFAULT_INS_FAST_SAMPLE 3 + +# 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 + +DMA_PRIORITY SDMMC* USART6* ADC* UART* USART* SPI* TIM* + +# enable FAT filesystem support (needs a microSD defined via SDMMC) +define HAL_OS_FATFS_IO 1 + +define HAL_BOARD_LOG_DIRECTORY "/APM/LOGS" +define HAL_BOARD_TERRAIN_DIRECTORY "/APM/TERRAIN" + +ROMFS io_firmware.bin Tools/IO_Firmware/iofirmware_lowpolh.bin