# hw definition file for MATEK M9N-F405 # MCU class and specific type MCU STM32F4xx STM32F405xx # bootloader starts firmware at 64k FLASH_RESERVE_START_KB 64 FLASH_SIZE_KB 1024 # store parameters in pages 11 and 12 STORAGE_FLASH_PAGE 1 define HAL_STORAGE_SIZE 15360 # board ID for firmware load APJ_BOARD_ID 1014 define STM32_ST_USE_TIMER 5 define CH_CFG_ST_RESOLUTION 32 # crystal frequency OSCILLATOR_HZ 8000000 # --------------------- LED ----------------------- PA14 LED0 OUTPUT LOW GPIO(90) # blue marked as ACT PA13 LED1 OUTPUT LOW GPIO(91) # green marked as B/E define HAL_GPIO_A_LED_PIN 91 define HAL_GPIO_B_LED_PIN 90 define HAL_GPIO_LED_OFF 1 # --------------------- PWM ----------------------- PC6 TIM8_CH1 TIM8 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) PB0 TIM3_CH3 TIM3 PWM(5) GPIO(54) PB1 TIM3_CH4 TIM3 PWM(6) GPIO(55) PB6 TIM4_CH1 TIM4 PWM(7) GPIO(56) PB7 TIM4_CH2 TIM4 PWM(8) GPIO(57) PA15 TIM2_CH1 TIM2 PWM(9) GPIO(58) # LED pin define STM32_PWM_USE_ADVANCED TRUE # Beeper PA8 TIM1_CH1 TIM1 GPIO(32) ALARM # --------------------- SPI1 ----------------------- PA5 SPI1_SCK SPI1 PA6 SPI1_MISO SPI1 PA7 SPI1_MOSI SPI1 PA4 MPU_CS CS # --------------------- SPI2 ----------------------- PB13 SPI2_SCK SPI2 PB14 SPI2_MISO SPI2 PB15 SPI2_MOSI SPI2 PB12 MAG_CS CS # --------------------- SPI3 ----------------------- PB3 SPI3_SCK SPI3 PB4 SPI3_MISO SPI3 PB5 SPI3_MOSI SPI3 PC14 SDCARD_CS CS # -------------------- I2C bus -------------------- I2C_ORDER I2C2 PB10 I2C2_SCL I2C2 PB11 I2C2_SDA I2C2 define HAL_I2C_INTERNAL_MASK 0 # -------------------- CAN bus --------------------- PB8 CAN1_RX CAN1 PB9 CAN1_TX CAN1 PC13 GPIO_CAN1_SILENT OUTPUT PUSHPULL SPEED_LOW LOW GPIO(70) # --------------------- UARTs --------------------------- SERIAL_ORDER OTG1 USART1 USART3 UART4 UART5 USART2 PA11 OTG_FS_DM OTG1 PA12 OTG_FS_DP OTG1 # USART1 PA9 USART1_TX USART1 PA10 USART1_RX USART1 # USART2 # alternative using USART2 PA2 USART2_TX USART2 NODMA PA3 USART2_RX USART2 NODMA ALT(1) # default to timer for RC input PA3 TIM9_CH2 TIM9 RCININT PULLDOWN LOW # USART3 PC10 USART3_TX USART3 PC11 USART3_RX USART3 # UART4, for GPS PA0 UART4_TX UART4 PA1 UART4_RX UART4 # USART5 PC12 UART5_TX UART5 PD2 UART5_RX UART5 # --------------------- ICM20602 ----------------------- SPIDEV icm20602 SPI1 DEVID1 MPU_CS MODE3 1*MHZ 4*MHZ IMU Invensense SPI:icm20602 ROTATION_ROLL_180_YAW_90 define HAL_DEFAULT_INS_FAST_SAMPLE 1 # --------------------- RM3100 ------------------------- SPIDEV rm3100 SPI2 DEVID1 MAG_CS MODE0 1*MHZ 1*MHZ COMPASS RM3100 SPI:rm3100 false ROTATION_PITCH_180 # also probe for external compasses define ALLOW_ARM_NO_COMPASS define HAL_PROBE_EXTERNAL_I2C_COMPASSES # --------------------- SD ---------------------------- SPIDEV sdcard SPI3 DEVID3 SDCARD_CS MODE0 400*KHZ 25*MHZ define HAL_OS_FATFS_IO 1 define HAL_BOARD_LOG_DIRECTORY "/APM/LOGS" define HAL_BOARD_TERRAIN_DIRECTORY "/APM/TERRAIN" # --------------------- DPS310 ------------------------ BARO DPS280 I2C:0:0x76 # --------------------- ADC --------------------------- PC0 BATT_VOLTAGE_SENS ADC1 SCALE(1) PC1 BATT_CURRENT_SENS ADC1 SCALE(1) PC2 RSSI_ADC_PIN ADC1 SCALE(1) PC3 PRESSURE_SENS ADC1 SCALE(1) PC5 BATT2_VOLTAGE_SENS ADC1 SCALE(1) define HAL_BATT_MONITOR_DEFAULT 0 define HAL_BATT_VOLT_PIN 10 define HAL_BATT_VOLT_SCALE 21.0 define HAL_BATT_CURR_PIN 11 define HAL_BATT_CURR_SCALE 40.0 define BOARD_RSSI_ANA_PIN 12 define HAL_DEFAULT_AIRSPEED_PIN 13 define HAL_BATT2_VOLT_PIN 15 define HAL_BATT2_VOLT_SCALE 11.0 # --------------------- save flash ---------------------- define HAL_MINIMIZE_FEATURES 1 define AP_BATTMON_SMBUS_ENABLE 0 define AP_BATTMON_FUEL_ENABLE 0 define HAL_PARACHUTE_ENABLED 0 define HAL_SPRAYER_ENABLED 0 define HAL_WITH_DSP FALSE # reduce max size of embedded params for apj_tool.py define AP_PARAM_MAX_EMBEDDED_PARAM 1024