hwdef.dat 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. # hw definition file for processing by chibios_pins.py
  2. # Matek F405-Wing, developed by David Ingraham
  3. # Board configuration borrowed from Inav F405SE target
  4. # Read hwdef/fmuv3/hwdef.dat for more info on these options
  5. # SerialX ports are mapped as printed on the top board
  6. # R1/T1 -> Serial1
  7. # R2 -> Sbus (T2 not currently used or available)
  8. # R3/T3 -> Serial3
  9. # R4/T4 -> Serial4
  10. # R5/T5 -> Serial5
  11. # R6/T6 -> Serial6
  12. # Note: UART4/Serial4, UART5/Serial5, USART6/Serial6 have no DMA on RX (TX always DMA).
  13. # If sending highspeed serial data (eg. 921600 baud) to the board, use Serial1/Serial3.
  14. #################################################
  15. ### MCU CONFIGURATION ###
  16. #################################################
  17. # MCU class and specific type
  18. MCU STM32F4xx STM32F405xx
  19. define CONFIG_HAL_BOARD_SUBTYPE HAL_BOARD_SUBTYPE_CHIBIOS_MATEKF405WING
  20. # board ID for firmware load
  21. APJ_BOARD_ID 127
  22. # crystal frequency
  23. OSCILLATOR_HZ 8000000
  24. STM32_PLLM_VALUE 8
  25. define STM32_ST_USE_TIMER 5
  26. define CH_CFG_ST_RESOLUTION 32
  27. # reserve 16k for bootloader, 16k for OSD and 32k for flash storage
  28. FLASH_RESERVE_START_KB 64
  29. FLASH_SIZE_KB 1024
  30. define HAL_STORAGE_SIZE 15360
  31. define STORAGE_FLASH_PAGE 1
  32. # board voltage
  33. STM32_VDD 330U
  34. # I2C Buses
  35. I2C_ORDER I2C1 I2C2
  36. # order of UARTs
  37. UART_ORDER OTG1 USART3 USART1 EMPTY UART4 UART5 USART6
  38. #################################################
  39. ### PIN DEFINITIONS ###
  40. #################################################
  41. PA0 UART4_TX UART4
  42. PA1 UART4_RX UART4
  43. # USART 2 is used for RC Input
  44. # PA2 USART2_TX USART2
  45. # PA3 USART2_RX USART2
  46. PA3 TIM2_CH4 TIM2 RCININT FLOAT LOW
  47. PA4 MPU_CS CS
  48. # IMU SPI
  49. PA5 SPI1_SCK SPI1
  50. PA6 SPI1_MISO SPI1
  51. PA7 SPI1_MOSI SPI1
  52. PA9 USART1_TX USART1
  53. PA10 USART1_RX USART1
  54. PA11 OTG_FS_DM OTG1
  55. PA12 OTG_FS_DP OTG1
  56. PA14 LED_BLUE OUTPUT LOW GPIO(0)
  57. PA13 LED_GREEN OUTPUT LOW GPIO(1) # optional
  58. define HAL_GPIO_A_LED_PIN 0
  59. define HAL_GPIO_B_LED_PIN 1
  60. #pwm output
  61. PB7 TIM4_CH2 TIM4 PWM(1) GPIO(50)
  62. PB6 TIM4_CH1 TIM4 PWM(2) GPIO(51)
  63. PB0 TIM3_CH3 TIM3 PWM(3) GPIO(52)
  64. PB1 TIM3_CH4 TIM3 PWM(4) GPIO(53)
  65. PC8 TIM8_CH3 TIM8 PWM(5) GPIO(54)
  66. PC9 TIM8_CH4 TIM8 PWM(6) GPIO(55)
  67. PB14 TIM1_CH2N TIM1 PWM(7) GPIO(56)
  68. PB15 TIM1_CH3N TIM1 PWM(8) GPIO(57)
  69. PA8 TIM1_CH1 TIM1 PWM(9) GPIO(58)
  70. # SD CARD SPI
  71. PB3 SPI3_SCK SPI3
  72. PB4 SPI3_MISO SPI3
  73. PB5 SPI3_MOSI SPI3
  74. PC14 SDCARD_CS CS
  75. PB8 I2C1_SCL I2C1
  76. PB9 I2C1_SDA I2C1
  77. PB10 I2C2_SCL I2C2
  78. PB11 I2C2_SDA I2C2
  79. # OSD SPI
  80. PB12 OSD_CS CS
  81. PB13 SPI2_SCK SPI2
  82. PC2 SPI2_MISO SPI2
  83. PC3 SPI2_MOSI SPI2
  84. PC0 BATT_VOLTAGE_SENS ADC1 SCALE(1)
  85. PC1 BATT_CURRENT_SENS ADC1 SCALE(1)
  86. PC5 RSSI_ADC_PIN ADC1 SCALE(1)
  87. PC6 USART6_TX USART6
  88. PC7 USART6_RX USART6
  89. PC10 USART3_TX USART3
  90. PC11 USART3_RX USART3
  91. PC12 UART5_TX UART5
  92. PD2 UART5_RX UART5
  93. PC13 VBUS INPUT OPENDRAIN
  94. PC15 BUZZER OUTPUT GPIO(80) LOW
  95. define HAL_BUZZER_PIN 80
  96. define HAL_BUZZER_ON 1
  97. define HAL_BUZZER_OFF 0
  98. #################################################
  99. ### DEVICES ###
  100. #################################################
  101. # MPU6000 on SPI
  102. SPIDEV mpu6000 SPI1 DEVID1 MPU_CS MODE3 1*MHZ 4*MHZ
  103. # OSD on SPI
  104. SPIDEV osd SPI2 DEVID2 OSD_CS MODE0 10*MHZ 10*MHZ
  105. # SD Card on SPI
  106. SPIDEV sdcard SPI3 DEVID3 SDCARD_CS MODE0 400*KHZ 25*MHZ
  107. # one IMU
  108. IMU Invensense SPI:mpu6000 ROTATION_YAW_180
  109. # one baro
  110. BARO BMP280 I2C:0:0x76
  111. define HAL_OS_FATFS_IO 1
  112. define HAL_BOARD_LOG_DIRECTORY "/APM/LOGS"
  113. define HAL_BOARD_TERRAIN_DIRECTORY "/APM/TERRAIN"
  114. # define default battery setup
  115. define HAL_BATT_MONITOR_DEFAULT 4
  116. define HAL_BATT_VOLT_PIN 10
  117. define HAL_BATT_CURR_PIN 11
  118. define HAL_BATT_VOLT_SCALE 11
  119. define HAL_BATT_CURR_SCALE 31.7
  120. #analog rssi pin (also could be used as analog airspeed input)
  121. # PC5 - ADC12_CH15
  122. define BOARD_RSSI_ANA_PIN 15
  123. # no built-in compass, but probe the i2c bus for all possible
  124. # external compass types
  125. define ALLOW_ARM_NO_COMPASS
  126. define HAL_COMPASS_DEFAULT HAL_COMPASS_NONE
  127. define HAL_PROBE_EXTERNAL_I2C_COMPASSES
  128. define HAL_I2C_INTERNAL_MASK 0
  129. define HAL_COMPASS_AUTO_ROT_DEFAULT 2
  130. define OSD_ENABLED ENABLED
  131. define HAL_OSD_TYPE_DEFAULT 1
  132. ROMFS_WILDCARD libraries/AP_OSD/fonts/font*.bin
  133. define BOARD_PWM_COUNT_DEFAULT 9
  134. define STM32_PWM_USE_ADVANCED TRUE