hwdef.dat 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. # hw definition file for processing by chibios_hwdef.py
  2. # for FMUv4 hardware
  3. define CONFIG_HAL_BOARD_SUBTYPE HAL_BOARD_SUBTYPE_CHIBIOS_FMUV4
  4. # MCU class and specific type
  5. MCU STM32F4xx STM32F427xx
  6. # board ID for firmware load
  7. APJ_BOARD_ID 11
  8. # crystal frequency
  9. OSCILLATOR_HZ 24000000
  10. # board voltage
  11. STM32_VDD 330U
  12. # ChibiOS system timer
  13. STM32_ST_USE_TIMER 5
  14. # flash size
  15. FLASH_SIZE_KB 2048
  16. env OPTIMIZE -O2
  17. # serial port for stdout disabled, use USB console
  18. # STDOUT_SERIAL SD7
  19. # STDOUT_BAUDRATE 57600
  20. # only one I2C bus
  21. I2C_ORDER I2C1
  22. # to match px4 we make the first bus number 1
  23. define HAL_I2C_BUS_BASE 1
  24. define HAL_I2C_INTERNAL_MASK 0
  25. # order of UARTs (and USB)
  26. UART_ORDER OTG1 UART4 USART2 USART3 UART8 USART1 UART7
  27. # UART4 is GPS
  28. PA0 UART4_TX UART4
  29. PA1 UART4_RX UART4
  30. PA2 BATT_VOLTAGE_SENS ADC1
  31. PA3 BATT_CURRENT_SENS ADC1
  32. PA4 VDD_5V_SENS ADC1 SCALE(2)
  33. # SPI1 is sensors bus
  34. PA5 SPI1_SCK SPI1
  35. PA6 SPI1_MISO SPI1
  36. PA7 SPI1_MOSI SPI1
  37. PA9 VBUS INPUT
  38. PA11 OTG_FS_DM OTG1
  39. PA12 OTG_FS_DP OTG1
  40. PA13 JTMS-SWDIO SWD
  41. PA14 JTCK-SWCLK SWD
  42. # PWM output for buzzer
  43. PA15 TIM2_CH1 TIM2 GPIO(77) ALARM
  44. # control of spektrum power pin
  45. PE4 SPEKTRUM_PWR OUTPUT LOW GPIO(70)
  46. define HAL_GPIO_SPEKTRUM_PWR 70
  47. # spektrum power is active low
  48. define HAL_SPEKTRUM_PWR_ENABLED 0
  49. # spektrum RC input pin, used as GPIO for bind for satellite receivers
  50. PB0 SPEKTRUM_RC INPUT PULLUP GPIO(71)
  51. define HAL_GPIO_SPEKTRUM_RC 71
  52. PB2 BOOT1 INPUT
  53. PB5 VDD_BRICK_VALID INPUT
  54. # USART1 is ESP8266
  55. PB6 USART1_TX USART1
  56. PB7 USART1_RX USART1
  57. PA8 USART1_RTS USART1
  58. # PE10 is not a hw CTS pin for USART1
  59. PE10 8266_CTS INPUT
  60. # make GPIOs for ESP8266 available via mavlink relay control as pins
  61. # 60 to 63
  62. PB4 8266_GPIO2 OUTPUT GPIO(60)
  63. PE2 8266_GPI0 INPUT PULLUP GPIO(61)
  64. PE5 8266_PD OUTPUT HIGH GPIO(62)
  65. PE6 8266_RST OUTPUT HIGH GPIO(63)
  66. PB8 I2C1_SCL I2C1
  67. PB9 I2C1_SDA I2C1
  68. # SPI2 is FRAM
  69. PB10 SPI2_SCK SPI2
  70. PB12 CAN2_RX CAN2
  71. PB13 CAN2_TX CAN2 # this is SPI2_SCK on beta board
  72. PB14 SPI2_MISO SPI2
  73. PB15 SPI2_MOSI SPI2
  74. PC0 VBUS_VALID INPUT
  75. PC1 RSSI_IN ADC1
  76. PC2 MPU9250_CS CS
  77. PC3 LED_SAFETY OUTPUT
  78. PC4 SAFETY_IN INPUT PULLDOWN
  79. PC5 VDD_PERIPH_EN OUTPUT HIGH
  80. PC7 TIM8_CH2 TIM8 RCININT FLOAT LOW # also USART6_RX for serial RC
  81. PC8 SDIO_D0 SDIO
  82. PC9 SDIO_D1 SDIO
  83. PC10 SDIO_D2 SDIO
  84. PC11 SDIO_D3 SDIO
  85. PC12 SDIO_CK SDIO
  86. PC13 SBUS_INV OUTPUT
  87. PC14 20608_DRDY INPUT
  88. PC15 20608_CS CS
  89. PD0 CAN1_RX CAN1
  90. PD1 CAN1_TX CAN1
  91. PD2 SDIO_CMD SDIO
  92. # USART2 serial2 telem1
  93. PD3 USART2_CTS USART2
  94. PD4 USART2_RTS USART2
  95. PD5 USART2_TX USART2
  96. PD6 USART2_RX USART2
  97. PD7 BARO_CS CS
  98. # USART3 serial3 telem2
  99. PD8 USART3_TX USART3
  100. PD9 USART3_RX USART3
  101. PD10 FRAM_CS CS
  102. PD11 USART3_CTS USART3
  103. PD12 USART3_RTS USART3
  104. PD15 MPU9250_DRDY INPUT
  105. # UART8 serial4 FrSky
  106. PE0 UART8_RX UART8
  107. PE1 UART8_TX UART8
  108. # allow this uart to be inverted for transmit under user control
  109. # the polarity is the value to use on the GPIO to change the polarity
  110. # to the opposite of the default
  111. PA10 UART8_TXINV OUTPUT HIGH GPIO(78) POL(0)
  112. PE3 VDD_SENSORS_EN OUTPUT HIGH
  113. # UART7 is debug
  114. PE7 UART7_RX UART7 NODMA
  115. PE8 UART7_TX UART7 NODMA
  116. PE14 TIM1_CH4 TIM1 PWM(1) GPIO(50)
  117. PE13 TIM1_CH3 TIM1 PWM(2) GPIO(51)
  118. PE11 TIM1_CH2 TIM1 PWM(3) GPIO(52)
  119. PE9 TIM1_CH1 TIM1 PWM(4) GPIO(53)
  120. PD13 TIM4_CH2 TIM4 PWM(5) GPIO(54)
  121. PD14 TIM4_CH3 TIM4 PWM(6) GPIO(55)
  122. PE12 MAG_DRDY INPUT
  123. PE15 MAG_CS CS
  124. # SPI device table. The DEVID values are chosen to match the PX4 port
  125. # of ArduPilot so users don't need to re-do their accel and compass calibrations
  126. # when moving to ChibiOS
  127. SPIDEV ms5611_int SPI2 DEVID3 BARO_CS MODE3 20*MHZ 20*MHZ
  128. SPIDEV mpu9250 SPI1 DEVID4 MPU9250_CS MODE3 2*MHZ 4*MHZ
  129. SPIDEV icm20608 SPI1 DEVID6 20608_CS MODE3 2*MHZ 8*MHZ
  130. SPIDEV hmc5843 SPI1 DEVID5 MAG_CS MODE3 11*MHZ 11*MHZ
  131. SPIDEV lis3mdl SPI1 DEVID5 MAG_CS MODE3 500*KHZ 500*KHZ
  132. SPIDEV ramtron SPI2 DEVID10 FRAM_CS MODE3 8*MHZ 8*MHZ
  133. define HAL_CHIBIOS_ARCH_FMUV4 1
  134. define HAL_BOARD_LOG_DIRECTORY "/APM/LOGS"
  135. define HAL_BOARD_TERRAIN_DIRECTORY "/APM/TERRAIN"
  136. define HAL_STORAGE_SIZE 16384
  137. # enable RAMTROM parameter storage
  138. define HAL_WITH_RAMTRON 1
  139. # fallback to flash is no FRAM fitted
  140. define STORAGE_FLASH_PAGE 22
  141. # enable FAT filesystem
  142. define HAL_OS_FATFS_IO 1
  143. # pixracer has 3 LEDs, Red, Green, Blue
  144. define HAL_HAVE_PIXRACER_LED
  145. define HAL_GPIO_LED_ON 0
  146. define HAL_GPIO_LED_OFF 1
  147. # LED setup for PixracerLED driver
  148. PB11 LED_RED OUTPUT GPIO(0)
  149. PB1 LED_GREEN OUTPUT GPIO(1)
  150. PB3 LED_BLUE OUTPUT GPIO(2)
  151. define HAL_GPIO_A_LED_PIN 0
  152. define HAL_GPIO_B_LED_PIN 1
  153. define HAL_GPIO_C_LED_PIN 2
  154. # enable RTSCTS
  155. define AP_FEATURE_RTSCTS 1
  156. # battery setup
  157. define HAL_BATT_VOLT_PIN 2
  158. define HAL_BATT_CURR_PIN 3
  159. define HAL_BATT_VOLT_SCALE 10.1
  160. define HAL_BATT_CURR_SCALE 17.0
  161. # setup serial port defaults for ESP8266
  162. define HAL_SERIAL5_PROTOCOL SerialProtocol_MAVLink
  163. define HAL_SERIAL5_BAUD 921600
  164. # 6 PWM available by default
  165. define BOARD_PWM_COUNT_DEFAULT 6
  166. # two IMUs
  167. IMU Invensense SPI:icm20608 ROTATION_ROLL_180_YAW_90
  168. IMU Invensense SPI:mpu9250 ROTATION_ROLL_180_YAW_90
  169. define HAL_DEFAULT_INS_FAST_SAMPLE 1
  170. # 2 compasses. R15 has LIS3MDL instead of HMC5843
  171. COMPASS HMC5843 SPI:hmc5843 false ROTATION_PITCH_180
  172. COMPASS LIS3MDL SPI:lis3mdl false ROTATION_NONE
  173. COMPASS AK8963:probe_mpu9250 0 ROTATION_ROLL_180_YAW_90
  174. # also probe all types of external I2C compasses
  175. define HAL_PROBE_EXTERNAL_I2C_COMPASSES
  176. # one barometer
  177. BARO MS56XX SPI:ms5611_int