2018-01-10 06:33:37 -04:00
|
|
|
# hw definition file for processing by chibios_hwdef.py
|
|
|
|
# for FMUv4 hardware
|
|
|
|
|
2018-03-01 02:51:39 -04:00
|
|
|
define CONFIG_HAL_BOARD_SUBTYPE HAL_BOARD_SUBTYPE_CHIBIOS_FMUV4
|
|
|
|
|
2018-01-10 06:33:37 -04:00
|
|
|
# MCU class and specific type
|
|
|
|
MCU STM32F4xx STM32F427xx
|
|
|
|
|
|
|
|
# board ID for firmware load
|
|
|
|
APJ_BOARD_ID 11
|
|
|
|
|
|
|
|
# crystal frequency
|
|
|
|
OSCILLATOR_HZ 24000000
|
|
|
|
|
|
|
|
# board voltage
|
|
|
|
STM32_VDD 330U
|
|
|
|
|
2018-01-28 14:31:21 -04:00
|
|
|
# ChibiOS system timer
|
|
|
|
STM32_ST_USE_TIMER 5
|
|
|
|
|
2018-01-12 17:33:58 -04:00
|
|
|
# flash size
|
|
|
|
FLASH_SIZE_KB 2048
|
|
|
|
|
2019-02-14 08:11:08 -04:00
|
|
|
env OPTIMIZE -O3
|
|
|
|
|
2018-11-04 23:57:46 -04:00
|
|
|
# serial port for stdout disabled, use USB console
|
|
|
|
# STDOUT_SERIAL SD7
|
|
|
|
# STDOUT_BAUDRATE 57600
|
2018-01-10 06:33:37 -04:00
|
|
|
|
|
|
|
# only one I2C bus
|
|
|
|
I2C_ORDER I2C1
|
|
|
|
|
2018-01-19 18:01:06 -04:00
|
|
|
# to match px4 we make the first bus number 1
|
|
|
|
define HAL_I2C_BUS_BASE 1
|
2018-07-17 22:41:28 -03:00
|
|
|
define HAL_I2C_INTERNAL_MASK 0
|
2018-01-19 18:01:06 -04:00
|
|
|
|
2018-01-11 19:20:49 -04:00
|
|
|
# order of UARTs (and USB)
|
2018-06-27 08:33:50 -03:00
|
|
|
UART_ORDER OTG1 UART4 USART2 USART3 UART8 USART1 UART7
|
2018-01-11 19:20:49 -04:00
|
|
|
|
2018-01-10 06:33:37 -04:00
|
|
|
# UART4 is GPS
|
|
|
|
PA0 UART4_TX UART4
|
|
|
|
PA1 UART4_RX UART4
|
|
|
|
PA2 BATT_VOLTAGE_SENS ADC1
|
|
|
|
PA3 BATT_CURRENT_SENS ADC1
|
2018-01-13 01:56:29 -04:00
|
|
|
PA4 VDD_5V_SENS ADC1 SCALE(2)
|
2018-01-10 06:33:37 -04:00
|
|
|
|
|
|
|
# SPI1 is sensors bus
|
|
|
|
PA5 SPI1_SCK SPI1
|
|
|
|
PA6 SPI1_MISO SPI1
|
|
|
|
PA7 SPI1_MOSI SPI1
|
|
|
|
|
|
|
|
PA9 VBUS INPUT
|
|
|
|
|
|
|
|
PA11 OTG_FS_DM OTG1
|
|
|
|
PA12 OTG_FS_DP OTG1
|
|
|
|
|
|
|
|
PA13 JTMS-SWDIO SWD
|
|
|
|
PA14 JTCK-SWCLK SWD
|
|
|
|
|
2018-01-28 14:31:21 -04:00
|
|
|
# PWM output for buzzer
|
|
|
|
PA15 TIM2_CH1 TIM2 GPIO(77) ALARM
|
|
|
|
|
2018-04-10 03:15:23 -03:00
|
|
|
# control of spektrum power pin
|
|
|
|
PE4 SPEKTRUM_PWR OUTPUT LOW GPIO(70)
|
|
|
|
define HAL_GPIO_SPEKTRUM_PWR 70
|
|
|
|
|
|
|
|
# spektrum power is active low
|
|
|
|
define HAL_SPEKTRUM_PWR_ENABLED 0
|
|
|
|
|
|
|
|
# spektrum RC input pin, used as GPIO for bind for satellite receivers
|
|
|
|
PB0 SPEKTRUM_RC INPUT PULLUP GPIO(71)
|
|
|
|
define HAL_GPIO_SPEKTRUM_RC 71
|
|
|
|
|
2018-01-10 06:33:37 -04:00
|
|
|
PB2 BOOT1 INPUT
|
|
|
|
PB5 VDD_BRICK_VALID INPUT
|
|
|
|
|
|
|
|
# USART1 is ESP8266
|
|
|
|
PB6 USART1_TX USART1
|
|
|
|
PB7 USART1_RX USART1
|
2018-02-04 00:35:24 -04:00
|
|
|
PA8 USART1_RTS USART1
|
|
|
|
# PE10 is not a hw CTS pin for USART1
|
|
|
|
PE10 8266_CTS INPUT
|
|
|
|
|
|
|
|
# make GPIOs for ESP8266 available via mavlink relay control as pins
|
|
|
|
# 60 to 63
|
|
|
|
PB4 8266_GPIO2 OUTPUT GPIO(60)
|
|
|
|
PE2 8266_GPI0 INPUT PULLUP GPIO(61)
|
|
|
|
PE5 8266_PD OUTPUT HIGH GPIO(62)
|
|
|
|
PE6 8266_RST OUTPUT HIGH GPIO(63)
|
|
|
|
|
2018-01-10 06:33:37 -04:00
|
|
|
PB8 I2C1_SCL I2C1
|
|
|
|
PB9 I2C1_SDA I2C1
|
|
|
|
|
|
|
|
# SPI2 is FRAM
|
|
|
|
PB10 SPI2_SCK SPI2
|
|
|
|
PB12 CAN2_RX CAN2
|
2018-01-17 20:42:36 -04:00
|
|
|
PB13 CAN2_TX CAN2 # this is SPI2_SCK on beta board
|
2018-01-10 06:33:37 -04:00
|
|
|
PB14 SPI2_MISO SPI2
|
|
|
|
PB15 SPI2_MOSI SPI2
|
|
|
|
|
|
|
|
PC0 VBUS_VALID INPUT
|
|
|
|
PC1 RSSI_IN ADC1
|
2018-01-11 22:27:25 -04:00
|
|
|
PC2 MPU9250_CS CS
|
2018-01-10 06:33:37 -04:00
|
|
|
PC3 LED_SAFETY OUTPUT
|
2018-04-14 00:55:03 -03:00
|
|
|
PC4 SAFETY_IN INPUT PULLDOWN
|
2018-01-10 06:33:37 -04:00
|
|
|
PC5 VDD_PERIPH_EN OUTPUT HIGH
|
2018-03-13 21:28:42 -03:00
|
|
|
PC7 TIM8_CH2 TIM8 RCIN FLOAT LOW # also USART6_RX for serial RC
|
2018-01-10 06:33:37 -04:00
|
|
|
|
|
|
|
PC8 SDIO_D0 SDIO
|
|
|
|
PC9 SDIO_D1 SDIO
|
|
|
|
PC10 SDIO_D2 SDIO
|
|
|
|
PC11 SDIO_D3 SDIO
|
|
|
|
PC12 SDIO_CK SDIO
|
|
|
|
|
|
|
|
PC13 SBUS_INV OUTPUT
|
|
|
|
PC14 20608_DRDY INPUT
|
2018-01-11 22:27:25 -04:00
|
|
|
PC15 20608_CS CS
|
2018-01-10 06:33:37 -04:00
|
|
|
|
|
|
|
PD0 CAN1_RX CAN1
|
|
|
|
PD1 CAN1_TX CAN1
|
|
|
|
PD2 SDIO_CMD SDIO
|
|
|
|
|
|
|
|
# USART2 serial2 telem1
|
|
|
|
PD3 USART2_CTS USART2
|
|
|
|
PD4 USART2_RTS USART2
|
|
|
|
PD5 USART2_TX USART2
|
|
|
|
PD6 USART2_RX USART2
|
|
|
|
|
2018-01-11 22:27:25 -04:00
|
|
|
PD7 BARO_CS CS
|
2018-01-10 06:33:37 -04:00
|
|
|
|
|
|
|
# USART3 serial3 telem2
|
|
|
|
PD8 USART3_TX USART3
|
|
|
|
PD9 USART3_RX USART3
|
2018-01-11 22:27:25 -04:00
|
|
|
PD10 FRAM_CS CS
|
2018-01-10 06:33:37 -04:00
|
|
|
PD11 USART3_CTS USART3
|
|
|
|
PD12 USART3_RTS USART3
|
|
|
|
|
|
|
|
PD15 MPU9250_DRDY INPUT
|
|
|
|
|
|
|
|
# UART8 serial4 FrSky
|
|
|
|
PE0 UART8_RX UART8
|
|
|
|
PE1 UART8_TX UART8
|
2018-11-10 07:09:07 -04:00
|
|
|
|
|
|
|
# allow this uart to be inverted for transmit under user control
|
|
|
|
# the polarity is the value to use on the GPIO to change the polarity
|
|
|
|
# to the opposite of the default
|
|
|
|
PA10 UART8_TXINV OUTPUT HIGH GPIO(78) POL(0)
|
|
|
|
|
2018-01-10 06:33:37 -04:00
|
|
|
PE3 VDD_SENSORS_EN OUTPUT HIGH
|
|
|
|
|
|
|
|
# UART7 is debug
|
2018-06-27 08:33:50 -03:00
|
|
|
PE7 UART7_RX UART7 NODMA
|
|
|
|
PE8 UART7_TX UART7 NODMA
|
|
|
|
|
2018-11-19 22:32:46 -04:00
|
|
|
PE14 TIM1_CH4 TIM1 PWM(1) GPIO(50)
|
|
|
|
PE13 TIM1_CH3 TIM1 PWM(2) GPIO(51)
|
2018-01-13 01:34:48 -04:00
|
|
|
PE11 TIM1_CH2 TIM1 PWM(3) GPIO(52)
|
2018-11-19 22:32:46 -04:00
|
|
|
PE9 TIM1_CH1 TIM1 PWM(4) GPIO(53)
|
|
|
|
PD13 TIM4_CH2 TIM4 PWM(5) GPIO(54)
|
|
|
|
PD14 TIM4_CH3 TIM4 PWM(6) GPIO(55)
|
|
|
|
|
2018-01-11 21:01:06 -04:00
|
|
|
PE12 MAG_DRDY INPUT
|
2018-01-11 22:27:25 -04:00
|
|
|
PE15 MAG_CS CS
|
2018-01-11 21:01:06 -04:00
|
|
|
|
|
|
|
# SPI device table. The DEVID values are chosen to match the PX4 port
|
|
|
|
# of ArduPilot so users don't need to re-do their accel and compass calibrations
|
|
|
|
# when moving to ChibiOS
|
|
|
|
SPIDEV ms5611_int SPI2 DEVID3 BARO_CS MODE3 20*MHZ 20*MHZ
|
2018-01-17 03:15:36 -04:00
|
|
|
SPIDEV mpu9250 SPI1 DEVID4 MPU9250_CS MODE3 2*MHZ 4*MHZ
|
|
|
|
SPIDEV icm20608 SPI1 DEVID6 20608_CS MODE3 2*MHZ 8*MHZ
|
2018-01-11 21:01:06 -04:00
|
|
|
SPIDEV hmc5843 SPI1 DEVID5 MAG_CS MODE3 11*MHZ 11*MHZ
|
|
|
|
SPIDEV lis3mdl SPI1 DEVID5 MAG_CS MODE3 500*KHZ 500*KHZ
|
|
|
|
SPIDEV ramtron SPI2 DEVID10 FRAM_CS MODE3 8*MHZ 8*MHZ
|
2018-01-14 04:00:47 -04:00
|
|
|
|
|
|
|
define HAL_CHIBIOS_ARCH_FMUV4 1
|
|
|
|
|
|
|
|
define HAL_BOARD_LOG_DIRECTORY "/APM/LOGS"
|
2018-08-24 06:43:27 -03:00
|
|
|
define HAL_BOARD_TERRAIN_DIRECTORY "/APM/TERRAIN"
|
2018-01-14 04:00:47 -04:00
|
|
|
|
|
|
|
define HAL_STORAGE_SIZE 16384
|
|
|
|
|
|
|
|
# enable RAMTROM parameter storage
|
|
|
|
define HAL_WITH_RAMTRON 1
|
|
|
|
|
|
|
|
# fallback to flash is no FRAM fitted
|
|
|
|
define STORAGE_FLASH_PAGE 22
|
|
|
|
|
|
|
|
# enable FAT filesystem
|
|
|
|
define HAL_OS_FATFS_IO 1
|
|
|
|
|
2018-02-11 04:28:43 -04:00
|
|
|
# pixracer has 3 LEDs, Red, Green, Blue
|
|
|
|
define HAL_HAVE_PIXRACER_LED
|
|
|
|
|
|
|
|
define HAL_GPIO_LED_ON 0
|
|
|
|
define HAL_GPIO_LED_OFF 1
|
|
|
|
|
2018-10-06 05:55:42 -03:00
|
|
|
# LED setup for PixracerLED driver
|
|
|
|
PB11 LED_RED OUTPUT GPIO(0)
|
|
|
|
PB1 LED_GREEN OUTPUT GPIO(1)
|
|
|
|
PB3 LED_BLUE OUTPUT GPIO(2)
|
|
|
|
|
2018-01-14 04:00:47 -04:00
|
|
|
define HAL_GPIO_A_LED_PIN 0
|
|
|
|
define HAL_GPIO_B_LED_PIN 1
|
|
|
|
define HAL_GPIO_C_LED_PIN 2
|
|
|
|
|
2018-01-19 18:43:01 -04:00
|
|
|
# enable RTSCTS
|
|
|
|
define AP_FEATURE_RTSCTS 1
|
2018-02-04 00:09:19 -04:00
|
|
|
|
|
|
|
# battery setup
|
|
|
|
define HAL_BATT_VOLT_PIN 2
|
|
|
|
define HAL_BATT_CURR_PIN 3
|
|
|
|
define HAL_BATT_VOLT_SCALE 10.1
|
|
|
|
define HAL_BATT_CURR_SCALE 17.0
|
2018-02-04 00:42:54 -04:00
|
|
|
|
|
|
|
# setup serial port defaults for ESP8266
|
|
|
|
define HAL_SERIAL5_PROTOCOL SerialProtocol_MAVLink
|
|
|
|
define HAL_SERIAL5_BAUD 921600
|
2018-03-01 02:51:39 -04:00
|
|
|
|
2018-04-06 22:32:50 -03:00
|
|
|
# 6 PWM available by default
|
|
|
|
define BOARD_PWM_COUNT_DEFAULT 6
|
2018-03-01 02:51:39 -04:00
|
|
|
|
2019-05-29 08:00:34 -03:00
|
|
|
|
|
|
|
# two IMUs
|
|
|
|
IMU Invensense SPI:icm20608 ROTATION_ROLL_180_YAW_90
|
|
|
|
IMU Invensense SPI:mpu9250 ROTATION_ROLL_180_YAW_90
|
|
|
|
define HAL_DEFAULT_INS_FAST_SAMPLE 1
|
|
|
|
|
|
|
|
# 2 compasses. R15 has LIS3MDL instead of HMC5843
|
|
|
|
COMPASS HMC5843 SPI:hmc5843 false ROTATION_PITCH_180
|
|
|
|
COMPASS LIS3MDL SPI:lis3mdl false ROTATION_NONE
|
|
|
|
COMPASS AK8963:probe_mpu9250 0 ROTATION_ROLL_180_YAW_90
|
|
|
|
|
|
|
|
# also probe all types of external I2C compasses
|
|
|
|
define HAL_PROBE_EXTERNAL_I2C_COMPASSES
|
|
|
|
|
|
|
|
# one barometer
|
|
|
|
BARO MS56XX SPI:ms5611_int
|