2018-05-16 07:25:27 -03:00
|
|
|
# hw definition file for MatekF405 hardware
|
|
|
|
# tested on the MatekF405-OSD board
|
|
|
|
# with thanks to betaflight for pinout
|
|
|
|
|
|
|
|
|
|
|
|
# MCU class and specific type
|
|
|
|
MCU STM32F4xx STM32F405xx
|
|
|
|
|
|
|
|
# board ID for firmware load
|
2018-06-16 08:09:31 -03:00
|
|
|
APJ_BOARD_ID 125
|
2018-05-16 07:25:27 -03:00
|
|
|
|
|
|
|
# crystal frequency
|
|
|
|
OSCILLATOR_HZ 8000000
|
|
|
|
|
|
|
|
define STM32_ST_USE_TIMER 4
|
|
|
|
define CH_CFG_ST_RESOLUTION 16
|
|
|
|
|
|
|
|
FLASH_SIZE_KB 1024
|
|
|
|
|
|
|
|
|
|
|
|
# only one I2C bus
|
|
|
|
I2C_ORDER I2C1
|
|
|
|
|
|
|
|
# order of UARTs (and USB)
|
2020-04-24 08:10:08 -03:00
|
|
|
SERIAL_ORDER OTG1 USART3 UART4 USART1 UART5 USART2
|
2018-05-16 07:25:27 -03:00
|
|
|
|
|
|
|
# LEDs
|
|
|
|
PB9 LED_BLUE OUTPUT LOW GPIO(0)
|
|
|
|
PA14 LED_GREEN OUTPUT LOW GPIO(1)
|
|
|
|
|
|
|
|
define HAL_GPIO_A_LED_PIN 0
|
|
|
|
define HAL_GPIO_B_LED_PIN 1
|
|
|
|
|
|
|
|
# buzzer
|
|
|
|
PC13 BUZZER OUTPUT GPIO(80) LOW
|
|
|
|
define HAL_BUZZER_PIN 80
|
|
|
|
define HAL_BUZZER_ON 1
|
|
|
|
define HAL_BUZZER_OFF 0
|
|
|
|
|
|
|
|
# spi1 bus for IMU
|
|
|
|
PA5 SPI1_SCK SPI1
|
|
|
|
PA6 SPI1_MISO SPI1
|
|
|
|
PA7 SPI1_MOSI SPI1
|
|
|
|
|
|
|
|
# spi2 for OSD
|
|
|
|
PB13 SPI2_SCK SPI2
|
|
|
|
PB14 SPI2_MISO SPI2
|
|
|
|
PB15 SPI2_MOSI SPI2
|
|
|
|
PB10 MAX7456_CS CS
|
|
|
|
|
2018-05-26 06:11:34 -03:00
|
|
|
# spi3 for sdcard and onboard flash
|
|
|
|
PB3 SPI3_SCK SPI3
|
|
|
|
PB4 SPI3_MISO SPI3
|
|
|
|
PB5 SPI3_MOSI SPI3
|
|
|
|
PC1 SDCARD_CS CS
|
|
|
|
PC0 M25P16_CS CS
|
2018-05-16 07:25:27 -03:00
|
|
|
|
|
|
|
PC2 MPU6000_CS CS
|
|
|
|
|
|
|
|
# only one I2C bus in normal config
|
|
|
|
PB6 I2C1_SCL I2C1
|
|
|
|
PB7 I2C1_SDA I2C1
|
|
|
|
|
|
|
|
# analog pins
|
|
|
|
PC5 BATT_VOLTAGE_SENS ADC1 SCALE(1)
|
|
|
|
PC4 BATT_CURRENT_SENS ADC1 SCALE(1)
|
|
|
|
PB1 RSSI_ADC_PIN ADC1 SCALE(1)
|
|
|
|
|
|
|
|
# define default battery setup
|
2018-07-15 17:31:02 -03:00
|
|
|
# PC5 - ADC12_CH15
|
|
|
|
define HAL_BATT_VOLT_PIN 15
|
|
|
|
# PC4 - ADC12_CH14
|
|
|
|
define HAL_BATT_CURR_PIN 14
|
2018-05-16 07:25:27 -03:00
|
|
|
define HAL_BATT_VOLT_SCALE 10.1
|
|
|
|
define HAL_BATT_CURR_SCALE 17.0
|
|
|
|
|
2018-07-15 17:31:02 -03:00
|
|
|
#analog rssi pin (also could be used as analog airspeed input)
|
|
|
|
# PB1 - ADC12_CH9
|
|
|
|
define BOARD_RSSI_ANA_PIN 9
|
|
|
|
|
2018-05-16 07:25:27 -03:00
|
|
|
# USART1
|
|
|
|
PA9 USART1_TX USART1
|
|
|
|
PA10 USART1_RX USART1
|
|
|
|
|
2020-01-02 19:34:39 -04:00
|
|
|
# RC input using timer
|
|
|
|
PA3 TIM9_CH2 TIM9 RCININT PULLDOWN
|
2018-05-16 07:25:27 -03:00
|
|
|
|
2020-01-02 19:34:39 -04:00
|
|
|
# alternative RC input using UART
|
|
|
|
PA2 USART2_TX USART2 NODMA
|
|
|
|
PA3 USART2_RX USART2 NODMA ALT(1)
|
2018-05-16 07:25:27 -03:00
|
|
|
|
|
|
|
# USART3
|
|
|
|
PC10 USART3_TX USART3
|
|
|
|
PC11 USART3_RX USART3
|
|
|
|
|
|
|
|
# UART4
|
|
|
|
PA0 UART4_TX UART4
|
|
|
|
PA1 UART4_RX UART4
|
|
|
|
|
|
|
|
# UART5
|
|
|
|
PD2 UART5_RX UART5
|
|
|
|
PC12 UART5_TX UART5
|
|
|
|
|
|
|
|
# PA10 IO-debug-console
|
|
|
|
PA11 OTG_FS_DM OTG1
|
|
|
|
PA12 OTG_FS_DP OTG1
|
|
|
|
|
|
|
|
# USB detection
|
|
|
|
PB12 VBUS INPUT OPENDRAIN
|
|
|
|
|
2018-05-26 06:11:34 -03:00
|
|
|
# debug (disabled out to allow for both LEDs)
|
|
|
|
#PA13 JTMS-SWDIO SWD
|
|
|
|
#PA14 JTCK-SWCLK SWD
|
2018-05-16 07:25:27 -03:00
|
|
|
|
|
|
|
# PWM out pins. Note that channel order follows the ArduPilot motor
|
|
|
|
# order conventions
|
|
|
|
PC6 TIM3_CH1 TIM3 PWM(1) GPIO(50)
|
|
|
|
PC7 TIM8_CH2 TIM8 PWM(2) GPIO(51)
|
|
|
|
PC8 TIM8_CH3 TIM8 PWM(3) GPIO(52)
|
|
|
|
PC9 TIM8_CH4 TIM8 PWM(4) GPIO(53)
|
|
|
|
PA15 TIM2_CH1 TIM2 PWM(5) GPIO(54)
|
|
|
|
PA8 TIM1_CH1 TIM1 PWM(6) GPIO(55)
|
|
|
|
|
2018-06-23 05:00:05 -03:00
|
|
|
define HAL_STORAGE_SIZE 15360
|
2018-06-16 08:09:31 -03:00
|
|
|
define STORAGE_FLASH_PAGE 2
|
2018-05-16 07:25:27 -03:00
|
|
|
|
2018-06-16 08:09:31 -03:00
|
|
|
# reserve 32k for bootloader and 32k for flash storage
|
2018-05-16 07:25:27 -03:00
|
|
|
FLASH_RESERVE_START_KB 64
|
|
|
|
|
2019-05-29 23:32:51 -03:00
|
|
|
# one IMU
|
|
|
|
IMU Invensense SPI:mpu6000 ROTATION_YAW_180
|
|
|
|
|
2019-06-11 14:19:29 -03:00
|
|
|
# probe for I2C BMP280, but allow init on board variants without onboard baro too
|
2019-05-29 23:32:51 -03:00
|
|
|
BARO BMP280 I2C:0:0x76
|
2019-06-11 14:19:29 -03:00
|
|
|
define HAL_PROBE_EXTERNAL_I2C_BAROS
|
|
|
|
define HAL_BARO_ALLOW_INIT_NO_BARO
|
2018-05-16 07:25:27 -03:00
|
|
|
|
2018-07-13 07:14:03 -03:00
|
|
|
# no built-in compass, but probe the i2c bus for all possible
|
|
|
|
# external compass types
|
2018-05-16 07:25:27 -03:00
|
|
|
define ALLOW_ARM_NO_COMPASS
|
2018-07-13 07:14:03 -03:00
|
|
|
define HAL_COMPASS_DEFAULT HAL_COMPASS_NONE
|
|
|
|
define HAL_PROBE_EXTERNAL_I2C_COMPASSES
|
|
|
|
define HAL_I2C_INTERNAL_MASK 0
|
2018-07-28 02:36:37 -03:00
|
|
|
define HAL_COMPASS_AUTO_ROT_DEFAULT 2
|
2018-05-16 07:25:27 -03:00
|
|
|
|
|
|
|
# SPI devices
|
|
|
|
SPIDEV mpu6000 SPI1 DEVID1 MPU6000_CS MODE3 1*MHZ 8*MHZ
|
2018-05-26 06:11:34 -03:00
|
|
|
SPIDEV sdcard SPI3 DEVID1 SDCARD_CS MODE0 400*KHZ 25*MHZ
|
2018-06-24 07:36:15 -03:00
|
|
|
SPIDEV osd SPI2 DEVID1 MAX7456_CS MODE0 10*MHZ 10*MHZ
|
2018-05-26 06:11:34 -03:00
|
|
|
|
|
|
|
# filesystem setup on sdcard
|
|
|
|
define HAL_OS_FATFS_IO 1
|
|
|
|
define HAL_BOARD_LOG_DIRECTORY "/APM/LOGS"
|
|
|
|
define HAL_BOARD_TERRAIN_DIRECTORY "/APM/TERRAIN"
|
2018-05-16 07:25:27 -03:00
|
|
|
|
|
|
|
# 8 PWM available by default
|
|
|
|
define BOARD_PWM_COUNT_DEFAULT 8
|
|
|
|
|
2018-06-24 07:36:15 -03:00
|
|
|
# setup for OSD
|
2019-12-20 13:46:24 -04:00
|
|
|
define OSD_ENABLED 1
|
2018-10-31 21:10:21 -03:00
|
|
|
define HAL_OSD_TYPE_DEFAULT 1
|
2018-07-09 04:58:57 -03:00
|
|
|
ROMFS_WILDCARD libraries/AP_OSD/fonts/font*.bin
|
2020-01-18 04:38:19 -04:00
|
|
|
|
|
|
|
# disable SMBUS and fuel battery monitors to save flash
|
|
|
|
define HAL_BATTMON_SMBUS_ENABLE 0
|
|
|
|
define HAL_BATTMON_FUEL_ENABLE 0
|
|
|
|
|
|
|
|
# disable parachute and sprayer to save flash
|
|
|
|
define HAL_PARACHUTE_ENABLED 0
|
|
|
|
define HAL_SPRAYER_ENABLED 0
|
2020-01-30 19:53:03 -04:00
|
|
|
|
|
|
|
# reduce max size of embedded params for apj_tool.py
|
|
|
|
define AP_PARAM_MAX_EMBEDDED_PARAM 1024
|