hwdef.dat 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. # hw definition file for MatekF405 hardware
  2. # tested on the MatekF405-OSD board
  3. # with thanks to betaflight for pinout
  4. # STATUS:
  5. # This port is mostly complete. Main missing feature are OSD,
  6. # dataflash
  7. # MCU class and specific type
  8. MCU STM32F4xx STM32F405xx
  9. # board ID for firmware load
  10. APJ_BOARD_ID 125
  11. # crystal frequency
  12. OSCILLATOR_HZ 8000000
  13. STM32_PLLM_VALUE 8
  14. define STM32_ST_USE_TIMER 4
  15. define CH_CFG_ST_RESOLUTION 16
  16. FLASH_SIZE_KB 1024
  17. # board voltage
  18. STM32_VDD 330U
  19. # only one I2C bus
  20. I2C_ORDER I2C1
  21. # order of UARTs (and USB)
  22. UART_ORDER OTG1 USART1 USART3 UART4 UART5
  23. # LEDs
  24. PB9 LED_BLUE OUTPUT LOW GPIO(0)
  25. PA14 LED_GREEN OUTPUT LOW GPIO(1)
  26. define HAL_GPIO_A_LED_PIN 0
  27. define HAL_GPIO_B_LED_PIN 1
  28. # buzzer
  29. PC13 BUZZER OUTPUT GPIO(80) LOW
  30. define HAL_BUZZER_PIN 80
  31. define HAL_BUZZER_ON 1
  32. define HAL_BUZZER_OFF 0
  33. # spi1 bus for IMU
  34. PA5 SPI1_SCK SPI1
  35. PA6 SPI1_MISO SPI1
  36. PA7 SPI1_MOSI SPI1
  37. # spi2 for OSD
  38. PB13 SPI2_SCK SPI2
  39. PB14 SPI2_MISO SPI2
  40. PB15 SPI2_MOSI SPI2
  41. PB10 MAX7456_CS CS
  42. # spi3 for sdcard and onboard flash
  43. PB3 SPI3_SCK SPI3
  44. PB4 SPI3_MISO SPI3
  45. PB5 SPI3_MOSI SPI3
  46. PC1 SDCARD_CS CS
  47. PC0 M25P16_CS CS
  48. PC2 MPU6000_CS CS
  49. # only one I2C bus in normal config
  50. PB6 I2C1_SCL I2C1
  51. PB7 I2C1_SDA I2C1
  52. # analog pins
  53. PC5 BATT_VOLTAGE_SENS ADC1 SCALE(1)
  54. PC4 BATT_CURRENT_SENS ADC1 SCALE(1)
  55. PB1 RSSI_ADC_PIN ADC1 SCALE(1)
  56. # define default battery setup
  57. # PC5 - ADC12_CH15
  58. define HAL_BATT_VOLT_PIN 15
  59. # PC4 - ADC12_CH14
  60. define HAL_BATT_CURR_PIN 14
  61. define HAL_BATT_VOLT_SCALE 10.1
  62. define HAL_BATT_CURR_SCALE 17.0
  63. #analog rssi pin (also could be used as analog airspeed input)
  64. # PB1 - ADC12_CH9
  65. define BOARD_RSSI_ANA_PIN 9
  66. # USART1
  67. PA9 USART1_TX USART1
  68. PA10 USART1_RX USART1
  69. # USART2 (RCIN)
  70. #PA2 USART3_TX USART3
  71. #PA3 USART3_RX USART3
  72. # rcinput
  73. PA3 TIM9_CH2 TIM9 RCININT FLOAT LOW
  74. # USART3
  75. PC10 USART3_TX USART3
  76. PC11 USART3_RX USART3
  77. # UART4
  78. PA0 UART4_TX UART4
  79. PA1 UART4_RX UART4
  80. # UART5
  81. PD2 UART5_RX UART5
  82. PC12 UART5_TX UART5
  83. # PA10 IO-debug-console
  84. PA11 OTG_FS_DM OTG1
  85. PA12 OTG_FS_DP OTG1
  86. # USB detection
  87. PB12 VBUS INPUT OPENDRAIN
  88. # debug (disabled out to allow for both LEDs)
  89. #PA13 JTMS-SWDIO SWD
  90. #PA14 JTCK-SWCLK SWD
  91. # PWM out pins. Note that channel order follows the ArduPilot motor
  92. # order conventions
  93. PC6 TIM3_CH1 TIM3 PWM(1) GPIO(50)
  94. PC7 TIM8_CH2 TIM8 PWM(2) GPIO(51)
  95. PC8 TIM8_CH3 TIM8 PWM(3) GPIO(52)
  96. PC9 TIM8_CH4 TIM8 PWM(4) GPIO(53)
  97. PA15 TIM2_CH1 TIM2 PWM(5) GPIO(54)
  98. PA8 TIM1_CH1 TIM1 PWM(6) GPIO(55)
  99. define HAL_STORAGE_SIZE 15360
  100. define STORAGE_FLASH_PAGE 2
  101. # reserve 32k for bootloader and 32k for flash storage
  102. FLASH_RESERVE_START_KB 64
  103. # one IMU
  104. IMU Invensense SPI:mpu6000 ROTATION_YAW_180
  105. # probe for I2C BMP280, but allow init on board variants without onboard baro too
  106. BARO BMP280 I2C:0:0x76
  107. define HAL_PROBE_EXTERNAL_I2C_BAROS
  108. define HAL_BARO_ALLOW_INIT_NO_BARO
  109. # no built-in compass, but probe the i2c bus for all possible
  110. # external compass types
  111. define ALLOW_ARM_NO_COMPASS
  112. define HAL_COMPASS_DEFAULT HAL_COMPASS_NONE
  113. define HAL_PROBE_EXTERNAL_I2C_COMPASSES
  114. define HAL_I2C_INTERNAL_MASK 0
  115. define HAL_COMPASS_AUTO_ROT_DEFAULT 2
  116. # SPI devices
  117. SPIDEV mpu6000 SPI1 DEVID1 MPU6000_CS MODE3 1*MHZ 8*MHZ
  118. SPIDEV sdcard SPI3 DEVID1 SDCARD_CS MODE0 400*KHZ 25*MHZ
  119. SPIDEV osd SPI2 DEVID1 MAX7456_CS MODE0 10*MHZ 10*MHZ
  120. # filesystem setup on sdcard
  121. define HAL_OS_FATFS_IO 1
  122. define HAL_BOARD_LOG_DIRECTORY "/APM/LOGS"
  123. define HAL_BOARD_TERRAIN_DIRECTORY "/APM/TERRAIN"
  124. # 8 PWM available by default
  125. define BOARD_PWM_COUNT_DEFAULT 8
  126. # uncomment the lines below to enable strict API
  127. # checking in ChibiOS
  128. #define CH_DBG_ENABLE_ASSERTS TRUE
  129. #define CH_DBG_ENABLE_CHECKS TRUE
  130. #define CH_DBG_SYSTEM_STATE_CHECK TRUE
  131. #define CH_DBG_ENABLE_STACK_CHECK TRUE
  132. # setup for OSD
  133. define OSD_ENABLED ENABLED
  134. define HAL_OSD_TYPE_DEFAULT 1
  135. ROMFS_WILDCARD libraries/AP_OSD/fonts/font*.bin