2024-02-12 17:52:45 -04:00
|
|
|
# hw definition file for processing by chibios_hwdef.py
|
|
|
|
# for the CBUnmanned H743 Stamp hardware
|
|
|
|
|
|
|
|
# default to all pins low to avoid ESD issues
|
|
|
|
#DEFAULTGPIO OUTPUT LOW PULLDOWN
|
|
|
|
|
|
|
|
# MCU class and specific type
|
|
|
|
MCU STM32H7xx STM32H743xx
|
|
|
|
|
|
|
|
# crystal frequency
|
|
|
|
OSCILLATOR_HZ 16000000
|
|
|
|
|
|
|
|
# ChibiOS system timer
|
|
|
|
STM32_ST_USE_TIMER 12
|
|
|
|
define CH_CFG_ST_RESOLUTION 16
|
|
|
|
|
|
|
|
MCU_CLOCKRATE_MHZ 480
|
|
|
|
|
|
|
|
# board ID for firmware load
|
|
|
|
APJ_BOARD_ID AP_HW_CBU_StampH743
|
|
|
|
|
|
|
|
FLASH_RESERVE_START_KB 128
|
|
|
|
|
|
|
|
# flash size
|
|
|
|
FLASH_SIZE_KB 2048
|
|
|
|
|
|
|
|
env OPTIMIZE -Os
|
|
|
|
|
|
|
|
# order of UARTs (and USB)
|
|
|
|
SERIAL_ORDER OTG1 USART1 USART2 USART3 UART4 UART5 USART6 UART7 UART8 OTG2
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
|
|
|
PB6 USART1_TX USART1 NODMA
|
|
|
|
PB7 USART1_RX USART1 NODMA
|
|
|
|
|
|
|
|
PA3 USART2_RX USART2
|
|
|
|
PD5 USART2_TX USART2
|
|
|
|
PD3 USART2_CTS USART2
|
|
|
|
PD4 USART2_RTS USART2
|
|
|
|
|
|
|
|
# GPS 1
|
|
|
|
PD8 USART3_TX USART3
|
|
|
|
PD9 USART3_RX USART3
|
|
|
|
|
|
|
|
# GPS 2
|
|
|
|
PH13 UART4_TX UART4
|
|
|
|
PH14 UART4_RX UART4
|
|
|
|
|
|
|
|
PC8 UART5_RTS UART5
|
|
|
|
PC9 UART5_CTS UART5
|
|
|
|
PC12 UART5_TX UART5
|
|
|
|
PD2 UART5_RX UART5
|
|
|
|
|
|
|
|
# RCIN
|
|
|
|
PC6 USART6_TX USART6
|
|
|
|
PC7 USART6_RX USART6
|
|
|
|
define DEFAULT_SERIAL6_PROTOCOL SerialProtocol_RCIN
|
|
|
|
define DEFAULT_SERIAL6_BAUD 115
|
|
|
|
|
|
|
|
PE8 UART7_TX UART7
|
|
|
|
PF6 UART7_RX UART7
|
|
|
|
PF8 UART7_RTS UART7
|
|
|
|
PE10 UART7_CTS UART7
|
|
|
|
|
|
|
|
PE1 UART8_TX UART8 NODMA
|
|
|
|
PE0 UART8_RX UART8 NODMA
|
|
|
|
|
|
|
|
PC1 ETH_MDC ETH1
|
|
|
|
PA2 ETH_MDIO ETH1
|
|
|
|
PC4 ETH_RMII_RXD0 ETH1
|
|
|
|
PC5 ETH_RMII_RXD1 ETH1
|
|
|
|
PG13 ETH_RMII_TXD0 ETH1
|
|
|
|
PG12 ETH_RMII_TXD1 ETH1
|
|
|
|
PB11 ETH_RMII_TX_EN ETH1
|
|
|
|
PA7 ETH_RMII_CRS_DV ETH1
|
|
|
|
PA1 ETH_RMII_REF_CLK ETH1
|
|
|
|
|
|
|
|
# PHY DP83825IRMQR
|
|
|
|
define BOARD_PHY_ID MII_DP83825I_ID
|
|
|
|
define BOARD_PHY_RMII
|
|
|
|
|
|
|
|
# ADC
|
|
|
|
PA0 BATT_CURRENT_SENS ADC1 SCALE(1) # Current
|
|
|
|
PA4 BATT_VOLTAGE_SENS ADC1 SCALE(1) # Voltage
|
|
|
|
PB1 SPARE_SENS ADC1 SCALE(1) # Spare
|
|
|
|
|
|
|
|
# define default battery setup
|
|
|
|
define HAL_BATT_MONITOR_DEFAULT 4
|
|
|
|
define HAL_BATT_VOLT_PIN 18
|
|
|
|
define HAL_BATT_CURR_PIN 16
|
|
|
|
define HAL_BATT_VOLT_SCALE 11.1
|
|
|
|
define HAL_BATT_CURR_SCALE 64
|
|
|
|
|
|
|
|
# IMU1 ICM-42760-P
|
|
|
|
PI9 IMU1_CS CS
|
|
|
|
PF2 IMU1_DRDY INPUT
|
|
|
|
|
|
|
|
# IMU2 ICM-42688-P
|
|
|
|
PH5 IMU2_CS CS
|
|
|
|
PA10 IMU2_DRDY INPUT
|
|
|
|
|
|
|
|
# IMU3 ICM-42688-P
|
|
|
|
PI4 IMU3_CS CS
|
|
|
|
PI6 IMU3_DRDY INPUT
|
|
|
|
|
|
|
|
# SPI4 - External
|
|
|
|
PE2 SPI4_SCK SPI4
|
|
|
|
PE5 SPI4_MISO SPI4
|
|
|
|
PE6 SPI4_MOSI SPI4
|
|
|
|
PI7 SP4_DRDY INPUT
|
|
|
|
PE4 SP4_CS1 CS
|
|
|
|
|
|
|
|
# SPI6 - IMUs
|
|
|
|
PA5 SPI6_SCK SPI6
|
|
|
|
PA6 SPI6_MISO SPI6
|
|
|
|
PG14 SPI6_MOSI SPI6
|
|
|
|
|
|
|
|
# PWM output pins
|
|
|
|
PH10 TIM5_CH1 TIM5 PWM(1) GPIO(50) BIDIR
|
|
|
|
PH11 TIM5_CH2 TIM5 PWM(2) GPIO(51)
|
|
|
|
PH12 TIM5_CH3 TIM5 PWM(3) GPIO(52) BIDIR
|
|
|
|
PI0 TIM5_CH4 TIM5 PWM(4) GPIO(53)
|
|
|
|
PD12 TIM4_CH1 TIM4 PWM(5) GPIO(54) BIDIR
|
|
|
|
PD13 TIM4_CH2 TIM4 PWM(6) GPIO(55)
|
|
|
|
PD14 TIM4_CH3 TIM4 PWM(7) GPIO(56) BIDIR
|
|
|
|
PD15 TIM4_CH4 TIM4 PWM(8) GPIO(57)
|
|
|
|
PA15 TIM2_CH1 TIM2 PWM(9) GPIO(58)
|
|
|
|
PB3 TIM2_CH2 TIM2 PWM(10) GPIO(59)
|
|
|
|
|
|
|
|
PF9 TIM14_CH1 TIM14 GPIO(61) ALARM
|
|
|
|
|
|
|
|
# CAN bus
|
|
|
|
PD0 CAN1_RX CAN1
|
|
|
|
PD1 CAN1_TX CAN1
|
|
|
|
PB12 CAN2_RX CAN2
|
|
|
|
PB13 CAN2_TX CAN2
|
|
|
|
|
|
|
|
# I2C buses
|
|
|
|
|
|
|
|
# I2C1 - BMM150
|
|
|
|
PB9 I2C1_SDA I2C1
|
|
|
|
PB8 I2C1_SCL I2C1
|
|
|
|
|
|
|
|
# I2C2 - DPS310
|
|
|
|
PF1 I2C2_SCL I2C2
|
|
|
|
PF0 I2C2_SDA I2C2
|
|
|
|
|
|
|
|
# I2C3 - GPS1 external compass
|
|
|
|
PA8 I2C3_SCL I2C3
|
|
|
|
PH8 I2C3_SDA I2C3
|
|
|
|
|
|
|
|
# I2C4 - GPS2 external compass
|
|
|
|
PF14 I2C4_SCL I2C4
|
|
|
|
PF15 I2C4_SDA I2C4
|
|
|
|
|
|
|
|
# order of I2C buses
|
|
|
|
I2C_ORDER I2C1 I2C2 I2C3 I2C4
|
|
|
|
define HAL_I2C_INTERNAL_MASK 3
|
|
|
|
|
|
|
|
# power enable pins
|
|
|
|
PI11 IMU1_PWR_EN OUTPUT HIGH
|
|
|
|
PF4 IMU2_PWR_EN OUTPUT HIGH
|
|
|
|
PE7 IMU3_PWR_EN OUTPUT HIGH
|
|
|
|
PG8 MAG_PWR_EN OUTPUT HIGH
|
|
|
|
PC13 SD_PWR_EN OUTPUT HIGH
|
|
|
|
PG15 Ethernet_PWR_EN OUTPUT HIGH
|
|
|
|
|
|
|
|
# microSD support
|
|
|
|
PD6 SDMMC2_CK SDMMC2
|
|
|
|
PD7 SDMMC2_CMD SDMMC2
|
|
|
|
PB14 SDMMC2_D0 SDMMC2
|
|
|
|
PB15 SDMMC2_D1 SDMMC2
|
|
|
|
PG11 SDMMC2_D2 SDMMC2
|
|
|
|
PB4 SDMMC2_D3 SDMMC2
|
|
|
|
define FATFS_HAL_DEVICE SDCD2
|
|
|
|
|
|
|
|
# safety
|
|
|
|
PF5 SAFETY_IN INPUT PULLDOWN
|
|
|
|
|
|
|
|
# LED
|
|
|
|
PE3 LED_RED OUTPUT HIGH GPIO(90)
|
|
|
|
|
2024-07-09 00:19:56 -03:00
|
|
|
define AP_NOTIFY_GPIO_LED_1_ENABLED 1
|
2024-02-12 17:52:45 -04:00
|
|
|
define HAL_GPIO_A_LED_PIN 90
|
|
|
|
define HAL_GPIO_LED_ON 1
|
|
|
|
|
|
|
|
# barometers
|
|
|
|
BARO DPS310 I2C:1:0x77
|
|
|
|
|
|
|
|
# compass
|
|
|
|
COMPASS BMM150 I2C:0:0x10 false ROTATION_YAW_180
|
|
|
|
define HAL_PROBE_EXTERNAL_I2C_COMPASSES
|
|
|
|
|
|
|
|
# IMUs
|
|
|
|
SPIDEV icm42688 SPI6 DEVID1 IMU2_CS MODE3 2*MHZ 16*MHZ
|
|
|
|
SPIDEV icm42688_2 SPI6 DEVID2 IMU3_CS MODE3 2*MHZ 16*MHZ
|
|
|
|
SPIDEV icm42670 SPI6 DEVID3 IMU1_CS MODE3 2*MHZ 8*MHZ
|
|
|
|
|
|
|
|
IMU Invensensev3 SPI:icm42688 ROTATION_PITCH_180
|
|
|
|
IMU Invensensev3 SPI:icm42688_2 ROTATION_ROLL_180
|
|
|
|
IMU Invensensev3 SPI:icm42670 ROTATION_PITCH_180_YAW_90
|
|
|
|
|
|
|
|
define HAL_DEFAULT_INS_FAST_SAMPLE 7
|
|
|
|
|
|
|
|
# use last 2 pages for flash storage
|
|
|
|
# H743 has 16 pages of 128k each
|
|
|
|
define HAL_STORAGE_SIZE 32768
|
|
|
|
STORAGE_FLASH_PAGE 14
|
|
|
|
|
|
|
|
DMA_PRIORITY SDMMC* TIM* SPI6*
|
|
|
|
DMA_NOSHARE TIM2* TIM4* TIM5*
|
|
|
|
|
|
|
|
# enable FAT filesystem support (needs a microSD defined via SDMMC)
|
|
|
|
define HAL_OS_FATFS_IO 1
|
|
|
|
|
|
|
|
# enable DFU reboot for installing bootloader
|
|
|
|
# note that if firmware is build with --secure-bl then DFU is
|
|
|
|
# disabled
|
|
|
|
ENABLE_DFU_BOOT 1
|
|
|
|
|
|
|
|
# build ABIN for flash-from-bootloader support:
|
|
|
|
env BUILD_ABIN True
|
|
|
|
|
|
|
|
# ethernet consumes a big chunk of flash
|
|
|
|
define AP_BATTERY_SCRIPTING_ENABLED 1
|