hwdef.dat 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. # hw definition file for processing by chibios_pins.py
  2. # for Sparky2 hardware
  3. # MCU class and specific type
  4. MCU STM32F4xx STM32F405xx
  5. # board ID for firmware load
  6. APJ_BOARD_ID 130
  7. # crystal frequency
  8. OSCILLATOR_HZ 8000000
  9. STM32_PLLM_VALUE 8
  10. define STM32_ST_USE_TIMER 5
  11. FLASH_SIZE_KB 1024
  12. # board voltage
  13. STM32_VDD 330U
  14. # use USB for stdout, so no STDOUT_SERIAL
  15. # STDOUT_SERIAL SD1
  16. # STDOUT_BAUDRATE 115200
  17. # --------LEDs-----------
  18. PB5 LED_BLUE OUTPUT LOW GPIO(0)
  19. PB6 LED_YELLOW OUTPUT LOW GPIO(1) # optional
  20. PB4 LED_RED OUTPUT LOW GPIO(2)
  21. define HAL_GPIO_A_LED_PIN 0
  22. define HAL_GPIO_B_LED_PIN 1
  23. define HAL_GPIO_C_LED_PIN 2
  24. define HAL_GPIO_LED_ON 0
  25. define HAL_GPIO_LED_OFF 1
  26. # ---------I2C-------------
  27. # only one I2C bus
  28. I2C_ORDER I2C1
  29. PB8 I2C1_SCL I2C1
  30. PB9 I2C1_SDA I2C1
  31. # ---------USB-------------
  32. PA11 OTG_FS_DM OTG1
  33. PA12 OTG_FS_DP OTG1
  34. PA8 VBUS INPUT OPENDRAIN
  35. # ---------UARTS-----------
  36. # order of UARTs (and USB)
  37. UART_ORDER OTG1 USART1 USART3
  38. # Main PORT
  39. PA9 USART1_TX USART1
  40. PA10 USART1_RX USART1
  41. # Flex PORT
  42. PB10 USART3_TX USART3
  43. PB11 USART3_RX USART3
  44. # -------RCIN-------------
  45. # Soft Serial for serial RC & PPM
  46. PC7 TIM8_CH2 TIM8 RCIN FLOAT LOW
  47. PC6 SBUS_INVERT OUTPUT
  48. # -------ADC-------------
  49. analog pins
  50. PC1 BATT_VOLTAGE_SENS ADC1 SCALE(1)
  51. PC2 BATT_CURRENT_SENS ADC1 SCALE(1)
  52. # define default battery setup No Voltage Divider
  53. define HAL_BATT_VOLT_PIN 12
  54. define HAL_BATT_CURR_PIN 13
  55. define HAL_BATT_VOLT_SCALE 10.1
  56. define HAL_BATT_CURR_SCALE 17.0
  57. # -----CAN BUS-------------
  58. PB13 CAN2_TX CAN2
  59. PB12 CAN2_RX CAN2
  60. # -----spi bus for IMU-----
  61. PA5 SPI1_SCK SPI1
  62. PA6 SPI1_MISO SPI1
  63. PA7 SPI1_MOSI SPI1
  64. PC4 MPU_CS CS
  65. PC5 EXTI_MPU9250 INPUT PULLUP
  66. # -----spi bus for FLASH-----
  67. PC10 SPI3_SCK SPI3
  68. PC11 SPI3_MISO SPI3
  69. PC12 SPI3_MOSI SPI3
  70. PB3 FLASH_CS CS
  71. # -----USB & SWD-----------
  72. # PA10 IO-debug-console
  73. PA13 JTMS-SWDIO SWD
  74. PA14 JTCK-SWCLK SWD
  75. # ----------PWM-----------
  76. PB0 TIM3_CH3 TIM3 PWM(1) GPIO(50)
  77. PB1 TIM3_CH4 TIM3 PWM(2) GPIO(51)
  78. PA3 TIM2_CH4 TIM2 PWM(3) GPIO(52)
  79. PA2 TIM2_CH3 TIM2 PWM(4) GPIO(53)
  80. PA1 TIM2_CH2 TIM2 PWM(5) GPIO(54)
  81. PA0 TIM2_CH1 TIM2 PWM(6) GPIO(55)
  82. # Buffered PWM N-Fets----
  83. # Require inverter to use
  84. # as standard pwm
  85. # PC9 TIM8_CH4 TIM8 PWM(7)
  86. # PC8 TIM8_CH3 TIM8 PWM(8)
  87. # PB15 TIM8_CH3N TIM8 PWM(9)
  88. PB14 TIM1_CH2N TIM1 PWM(7) GPIO(35)
  89. define HAL_STORAGE_SIZE 15360
  90. define STORAGE_FLASH_PAGE 1
  91. FLASH_SIZE_KB 1024
  92. # reserve 16k for bootloader and 32k for flash storage
  93. FLASH_RESERVE_START_KB 64
  94. # one IMU
  95. IMU Invensense SPI:mpu9250 ROTATION_NONE
  96. # one baro
  97. BARO MS56XX I2C:0:0x77
  98. # one compass in mpu9250
  99. COMPASS AK8963:probe_mpu9250 0 ROTATION_NONE
  100. define HAL_PROBE_EXTERNAL_I2C_COMPASSES
  101. define HAL_I2C_INTERNAL_MASK 0
  102. # SPI devices
  103. SPIDEV mpu9250 SPI1 DEVID4 MPU_CS MODE3 1*MHZ 4*MHZ
  104. SPIDEV dataflash SPI3 DEVID1 FLASH_CS MODE3 32*MHZ 32*MHZ
  105. # enable logging to dataflash
  106. define HAL_LOGGING_DATAFLASH
  107. define CONFIG_HAL_BOARD_SUBTYPE HAL_BOARD_SUBTYPE_CHIBIOS_SPARKY2
  108. define STM32_PWM_USE_ADVANCED TRUE
  109. define BOARD_PWM_COUNT_DEFAULT 7