2024-01-27 16:12:05 -04:00
|
|
|
include common.inc
|
|
|
|
|
|
|
|
env OPTIMIZE -Os
|
|
|
|
|
|
|
|
# bootloader takes first sector
|
|
|
|
FLASH_RESERVE_START_KB 128
|
|
|
|
|
|
|
|
# use last 2 pages for flash storage
|
|
|
|
# H743 has 16 pages of 128k each
|
|
|
|
define HAL_STORAGE_SIZE 32768
|
|
|
|
STORAGE_FLASH_PAGE 14
|
|
|
|
|
|
|
|
# ChibiOS system timer
|
|
|
|
STM32_ST_USE_TIMER 12
|
|
|
|
define CH_CFG_ST_RESOLUTION 16
|
|
|
|
|
|
|
|
# SPI1 for IMU1 (ICM42688)
|
|
|
|
PA5 SPI1_SCK SPI1
|
|
|
|
PA6 SPI1_MISO SPI1
|
|
|
|
PA7 SPI1_MOSI SPI1
|
|
|
|
PC4 IMU1_CS CS
|
|
|
|
|
|
|
|
# SPI2 for flash (W25Q64JVZPIQ (64Mbit))
|
|
|
|
PA9 SPI2_SCK SPI2
|
|
|
|
PB14 SPI2_MISO SPI2
|
|
|
|
PB15 SPI2_MOSI SPI2
|
|
|
|
PE11 FLASH_CS CS
|
|
|
|
|
|
|
|
# two I2C buses
|
|
|
|
I2C_ORDER I2C2 I2C1
|
|
|
|
|
|
|
|
# I2C1
|
|
|
|
PB8 I2C1_SCL I2C1 PULLUP
|
|
|
|
PB9 I2C1_SDA I2C1 PULLUP
|
|
|
|
|
|
|
|
# I2C2
|
|
|
|
PB10 I2C2_SCL I2C2 PULLUP
|
|
|
|
PB11 I2C2_SDA I2C2 PULLUP
|
|
|
|
|
|
|
|
# ADC
|
|
|
|
PA4 BATT_VOLTAGE_SENS ADC1 SCALE(1)
|
|
|
|
PA0 BATT_CURRENT_SENS ADC1 SCALE(1)
|
|
|
|
|
|
|
|
define HAL_BATT_MONITOR_DEFAULT 4 # Analog voltage and current
|
|
|
|
define HAL_BATT_VOLT_PIN 18 # ADC channel
|
|
|
|
define HAL_BATT_CURR_PIN 16
|
|
|
|
define HAL_BATT_VOLT_SCALE 11.44 # Nominally a 11x divider. 11.44 is based on experimenting.
|
|
|
|
define HAL_BATT_CURR_SCALE 40.0 # This depends on the ESC's V/mA output ratio.
|
|
|
|
|
|
|
|
# LED
|
|
|
|
PC13 LED0 OUTPUT LOW GPIO(90) # Amber; System status.
|
|
|
|
PC0 LED1 OUTPUT LOW GPIO(91) # Not connected; GPS Status. (Required, or the system status LED won't work.)
|
|
|
|
define HAL_GPIO_A_LED_PIN 90
|
|
|
|
define HAL_GPIO_B_LED_PIN 91
|
|
|
|
|
|
|
|
# order of UARTs (and USB) OTG2 may be required for SLCAN.
|
|
|
|
SERIAL_ORDER OTG1 USART1 USART2 USART3 UART4 UART7 UART8 #OTG2
|
|
|
|
|
|
|
|
# USART1
|
|
|
|
PB6 USART1_TX USART1
|
|
|
|
PB7 USART1_RX USART1
|
|
|
|
|
|
|
|
# USART2 (MSP Displayport OSD)
|
|
|
|
PA2 USART2_TX USART2
|
|
|
|
PA3 USART2_RX USART2
|
|
|
|
|
|
|
|
# USART3
|
|
|
|
PD8 USART3_TX USART3
|
|
|
|
PD9 USART3_RX USART3
|
|
|
|
|
|
|
|
# UART4
|
|
|
|
PC10 UART4_TX UART4
|
|
|
|
PC11 UART4_RX UART4
|
|
|
|
|
|
|
|
# UART7 (ELRS receiver)
|
|
|
|
PB4 UART7_TX UART7
|
|
|
|
PB3 UART7_RX UART7
|
|
|
|
|
|
|
|
PE1 UART8_TX UART8
|
|
|
|
PE0 UART8_RX UART8
|
|
|
|
|
|
|
|
# CAN bus
|
|
|
|
PD0 CAN1_RX CAN1
|
|
|
|
PD1 CAN1_TX CAN1
|
|
|
|
|
|
|
|
# Motors
|
|
|
|
PC6 TIM3_CH1 TIM3 PWM(1) GPIO(50) BIDIR
|
|
|
|
PC7 TIM3_CH2 TIM3 PWM(2) GPIO(51)
|
|
|
|
PC8 TIM3_CH3 TIM3 PWM(3) GPIO(52) BIDIR
|
|
|
|
PC9 TIM3_CH4 TIM3 PWM(4) GPIO(53)
|
|
|
|
PE5 TIM15_CH1 TIM15 PWM(5) GPIO(54) BIDIR
|
|
|
|
PE6 TIM15_CH2 TIM15 PWM(6) GPIO(55)
|
|
|
|
PE13 TIM1_CH3 TIM1 PWM(7) GPIO(56) BIDIR
|
|
|
|
PE14 TIM1_CH4 TIM1 PWM(8) GPIO(57)
|
|
|
|
|
|
|
|
# Beeper
|
|
|
|
PE9 TIM1_CH1 TIM1 GPIO(58) ALARM
|
|
|
|
|
|
|
|
DMA_PRIORITY S*
|
|
|
|
|
|
|
|
DMA_NOSHARE SPI1* TIM3* TIM15* TIM1*
|
|
|
|
|
|
|
|
# SPI devices
|
|
|
|
SPIDEV icm42688 SPI1 DEVID1 IMU1_CS MODE3 2*MHZ 16*MHZ
|
|
|
|
SPIDEV dataflash SPI2 DEVID1 FLASH_CS MODE3 104*MHZ 104*MHZ
|
|
|
|
|
|
|
|
# IMU
|
|
|
|
IMU Invensensev3 SPI:icm42688 ROTATION_PITCH_180_YAW_270
|
|
|
|
define HAL_DEFAULT_INS_FAST_SAMPLE 1
|
|
|
|
|
|
|
|
# DPS310 integrated on I2C2 bus, multiple possible choices for external barometer
|
|
|
|
BARO DPS310 I2C:0:0x77
|
|
|
|
|
2024-05-22 12:00:24 -03:00
|
|
|
# no built-in compass, but probe the i2c bus for all possible
|
|
|
|
# external compass types
|
|
|
|
define ALLOW_ARM_NO_COMPASS
|
|
|
|
define HAL_PROBE_EXTERNAL_I2C_COMPASSES
|
|
|
|
define HAL_I2C_INTERNAL_MASK 0
|
|
|
|
define HAL_COMPASS_AUTO_ROT_DEFAULT 2
|
|
|
|
|
2024-01-27 16:12:05 -04:00
|
|
|
# setup for OSD
|
|
|
|
define OSD_ENABLED 1
|
|
|
|
define HAL_OSD_TYPE_DEFAULT 5 # MSP Displayport
|
2024-05-22 12:00:24 -03:00
|
|
|
define HAL_LOGGING_DATAFLASH_ENABLED 1
|