2018-01-10 06:33:37 -04:00
|
|
|
# hw definition file for processing by chibios_hwdef.py
|
2018-02-11 05:48:07 -04:00
|
|
|
# for FMUv3 hardware (ie. for Pixhawk1, Pixhawk2 cube, XUAV2.1 etc)
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# This hwdef.dat file contains a lot of comments so it can act as a
|
2018-02-11 05:48:07 -04:00
|
|
|
# reference for developers adding new boards.
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# The hwdef.dat file defines all the hardware peripherals and pins for
|
2018-02-11 05:48:07 -04:00
|
|
|
# a port of ArduPilot to a board using the ChibiOS HAL. You should be
|
|
|
|
# able to write the hwdef.dat file for a new board with just the
|
2018-08-01 11:59:31 -03:00
|
|
|
# schematic for the board.
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# This file is processed by chibios_hwdef.py to create hwdef.h for
|
2018-02-11 05:48:07 -04:00
|
|
|
# this board. You may find it useful to run chibios_hwdef.py manually
|
|
|
|
# when building this file for a new board. The resulting hwdef.h file
|
|
|
|
# is formatted to make it quite readable. It is strongly suggested
|
|
|
|
# that you read the resulting hwdef.h file when porting to a new board
|
2018-08-01 11:59:31 -03:00
|
|
|
# to make sure it has resulted in what you want.
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-02-11 17:04:52 -04:00
|
|
|
# You should read this file in conjunction with the schematic for your
|
|
|
|
# board, the datasheet for the MCU for your board and the python
|
|
|
|
# tables file that we have extracted from the datasheet for your
|
|
|
|
# MCU. The python tables file is particularly important, so if you
|
|
|
|
# haven't seen it before go and look at it now. For the STM32F427 it
|
|
|
|
# it called STM32F427xx.py and it is in the hwdef/script/ directory
|
|
|
|
# inside the HAL_ChibiOS directory. That file tells you what each pin
|
|
|
|
# can do (the alternate functions table) and what DMA channels can be
|
|
|
|
# used for each peripheral type. The alternative functions table is
|
|
|
|
# particularly useful when doing a new hwdef.dat file as you can work
|
|
|
|
# out peripheral numbers given a port/pin name.
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# We need to start off by saying what main CPU is on the board. There
|
2018-02-11 05:48:07 -04:00
|
|
|
# are two CPU identifiers that you need to specify. The first is the
|
|
|
|
# ChibiOS MCU type. So far we only support STM32F4xx for all STM32F4
|
|
|
|
# board types. In the future we will add F7 and other MCU types
|
|
|
|
# The second string needs to match the name of a config file in the
|
|
|
|
# libraries/AP_HAL_ChibiOS/hwdef/script directory. In this case we are
|
|
|
|
# using a F427 MCU, so we select STM32F427xx to match the
|
|
|
|
# STM32F427xx.py file in the script directory. If you are supporting a
|
|
|
|
# board type that doesn't have a python hardware database file yet
|
|
|
|
# then you will need to create one. There are scripts in the scripts
|
|
|
|
# directory to help with that by parsing the STM32 datasheets to
|
|
|
|
# extract the required DMA and alternate function tables.
|
2018-01-05 02:19:51 -04:00
|
|
|
|
|
|
|
# MCU class and specific type
|
|
|
|
MCU STM32F4xx STM32F427xx
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# We set a specific HAL_BOARD_SUBTYPE, allowing for custom config in
|
2018-03-01 02:51:39 -04:00
|
|
|
# drivers. For this to be used the subtype needs to be added to
|
2018-08-01 11:59:31 -03:00
|
|
|
# AP_HAL/AP_HAL_Boards.h as well.
|
2018-03-01 02:51:39 -04:00
|
|
|
define CONFIG_HAL_BOARD_SUBTYPE HAL_BOARD_SUBTYPE_CHIBIOS_FMUV3
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Now we need to specify the APJ_BOARD_ID. This is the ID that the
|
2018-02-11 05:48:07 -04:00
|
|
|
# bootloader presents to GCS software so it knows if this firmware is
|
|
|
|
# suitable for the board. Please see
|
|
|
|
# https://github.com/ArduPilot/Bootloader/blob/master/hw_config.h for
|
|
|
|
# a list of current board IDs. If you add a new board type then please
|
|
|
|
# get it added to that repository so we don't get conflicts.
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Note that APJ is "ArduPilot JSON Firmware Format".
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-01-05 02:19:51 -04:00
|
|
|
# board ID for firmware load
|
|
|
|
APJ_BOARD_ID 9
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Now you need to say what crystal frequency you have for this
|
2018-02-11 05:48:07 -04:00
|
|
|
# board. All of the clocks are scaled against this. Typical values are
|
2018-08-01 11:59:31 -03:00
|
|
|
# 24000000 or 8000000.
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-01-05 02:19:51 -04:00
|
|
|
# crystal frequency
|
|
|
|
OSCILLATOR_HZ 24000000
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# On some boards you will need to also set the various PLL values. See
|
2018-02-11 05:48:07 -04:00
|
|
|
# the defaults in common/mcuconf.h, and use the define mechanism
|
|
|
|
# explained later in this file to override values suitable for your
|
|
|
|
# board. Refer to your MCU datasheet or examples from supported boards
|
|
|
|
# in ChibiOS for the right values.
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Now define the voltage the MCU runs at. This is needed for ChibiOS
|
|
|
|
# to set various internal driver limits. It is in 0.01 volt units.
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-01-05 02:19:51 -04:00
|
|
|
# board voltage
|
|
|
|
STM32_VDD 330U
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# This is the STM32 timer that ChibiOS will use for the low level
|
2018-02-11 05:48:07 -04:00
|
|
|
# driver. This must be a 32 bit timer. We currently only support
|
2018-08-01 11:59:31 -03:00
|
|
|
# timers 2, 3, 4, 5 and 21. See hal_st_lld.c in ChibiOS for details.
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-02-08 17:23:18 -04:00
|
|
|
# ChibiOS system timer
|
|
|
|
STM32_ST_USE_TIMER 5
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Now the size of flash in kilobytes, for creating the ld.script.
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-01-12 17:33:58 -04:00
|
|
|
# flash size
|
|
|
|
FLASH_SIZE_KB 2048
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Now define which UART is used for printf(). We rarely use printf()
|
2018-02-11 05:48:07 -04:00
|
|
|
# in ChibiOS, so this is really only for debugging very early startup
|
|
|
|
# in drivers.
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Serial port for stdout. This is optional. If you leave it out then
|
|
|
|
# output from printf() lines will go to the ArduPilot console, which is the
|
|
|
|
# first UART in the UART_ORDER list. But note that some startup code
|
|
|
|
# runs before USB is set up.
|
|
|
|
# The value for STDOUT_SERIAL is a serial device name, and must be for a
|
|
|
|
# serial device for which pins are defined in this file. For example, SD7
|
|
|
|
# is for UART7 (SD7 == "serial device 7" in ChibiOS).
|
2018-03-21 22:23:14 -03:00
|
|
|
#STDOUT_SERIAL SD7
|
|
|
|
#STDOUT_BAUDRATE 57600
|
2018-01-05 02:19:51 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Now the USB setup, if you have USB. All of these settings are
|
2018-02-11 05:48:07 -04:00
|
|
|
# option, and the ones below are the defaults. It ends up creating a
|
|
|
|
# USB ID on Linux like this:
|
|
|
|
# /dev/serial/by-id/usb-ArduPilot_fmuv3_3E0031000B51353233343932-if00
|
2018-08-01 11:59:31 -03:00
|
|
|
# If creating a board for a RTF vehicle you may wish to customise these.
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-01-05 02:19:51 -04:00
|
|
|
# USB setup
|
|
|
|
USB_VENDOR 0x0483 # ST
|
|
|
|
USB_PRODUCT 0x5740
|
|
|
|
USB_STRING_MANUFACTURER "ArduPilot"
|
2018-02-05 18:48:41 -04:00
|
|
|
USB_STRING_PRODUCT "%BOARD%"
|
|
|
|
USB_STRING_SERIAL "%SERIAL%"
|
2018-01-05 02:19:51 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Now define the order that I2C buses are presented in the hal.i2c API
|
2018-02-11 17:04:52 -04:00
|
|
|
# in ArduPilot. For historical reasons inherited from HAL_PX4 the
|
|
|
|
# 'external' I2C bus should be bus 1 in hal.i2c, and internal I2C bus
|
|
|
|
# should be bus 0. On fmuv3 the STM32 I2C1 is our external bus and
|
|
|
|
# I2C2 is our internal bus, so we need to setup the order as I2C2
|
|
|
|
# followed by I2C1 in order to achieve the conventional order that
|
2018-08-01 11:59:31 -03:00
|
|
|
# drivers expect.
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-01-10 06:33:37 -04:00
|
|
|
# order of I2C buses
|
|
|
|
I2C_ORDER I2C2 I2C1
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Now the UART order. These map to the hal.uartA to hal.uartF
|
2018-02-11 05:48:07 -04:00
|
|
|
# objects. If you use a shorter list then HAL_Empty::UARTDriver
|
|
|
|
# objects are substituted for later UARTs, or you can leave a gap by
|
2018-08-01 11:59:31 -03:00
|
|
|
# listing one or more of the uarts as EMPTY.
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# The normal usage of this ordering is:
|
2018-02-11 05:48:07 -04:00
|
|
|
# 1) SERIAL0: console (primary mavlink, usually USB)
|
|
|
|
# 2) SERIAL3: primary GPS
|
|
|
|
# 3) SERIAL1: telem1
|
|
|
|
# 4) SERIAL2: telem2
|
|
|
|
# 5) SERIAL4: GPS2
|
|
|
|
# 6) SERIAL5: extra UART (usually RTOS debug console)
|
|
|
|
|
2018-01-11 19:20:49 -04:00
|
|
|
# order of UARTs (and USB)
|
2018-03-21 22:23:14 -03:00
|
|
|
UART_ORDER OTG1 UART4 USART2 USART3 UART8 UART7
|
2018-01-11 19:20:49 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# If the board has an IOMCU connected via a UART then this defines the
|
|
|
|
# UART to talk to that MCU. Leave it out for boards with no IOMCU.
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-01-11 19:20:49 -04:00
|
|
|
# UART for IOMCU
|
|
|
|
IOMCU_UART USART6
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Now we start on the pin definitions. Every pin used by ArduPilot
|
|
|
|
# needs to be in this file. The pins in this file can be defined in any order.
|
|
|
|
|
|
|
|
# The format is P+port+pin. So PC4 is portC pin4.
|
|
|
|
# For every pin the second column is the label. If this is a
|
2018-02-11 05:48:07 -04:00
|
|
|
# peripheral that has an alternate function defined in the STM32
|
|
|
|
# datasheet then the label must be the name of that alternative
|
|
|
|
# function. The names are looked up in the python database for this
|
|
|
|
# MCU. Please see STM32F427xx.py for the F427 database. That database
|
|
|
|
# is used to automatically fill in the alternative function (and later
|
|
|
|
# for the DMA channels).
|
|
|
|
|
|
|
|
# The third column is the peripheral type. This must be one of the
|
|
|
|
# following: UARTn, USARTn, OTGn, SPIn, I2Cn, ADCn, TIMn, SWD, SDIO,
|
2018-08-01 11:59:31 -03:00
|
|
|
# INPUT, OUTPUT, CS.
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# The fourth and later columns are for modifiers on the pin. The
|
|
|
|
# possible modifiers are:
|
2018-02-11 05:48:07 -04:00
|
|
|
# pin speed: SPEED_VERYLOW, SPEED_LOW, SPEED_MEDIUM, SPEED_HIGH
|
|
|
|
# pullup: PULLUP, PULLDOWN, FLOATING
|
|
|
|
# out type: OPENDRAIN, PUSHPULL
|
|
|
|
# default value: LOW, HIGH
|
|
|
|
|
|
|
|
# Additionally, each class of pin peripheral can have extra modifiers
|
2018-08-01 11:59:31 -03:00
|
|
|
# suitable for that pin type. For example, for an OUTPUT you can map
|
|
|
|
# it to a GPIO number in hal.gpio using the GPIO(n) modifier. For ADC
|
|
|
|
# inputs you can apply a scaling factor (to bring it to unit volts)
|
|
|
|
# using the SCALE(x) modifier. See the examples below for more
|
|
|
|
# modifiers, or read the python code in chibios_hwdef.py.
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Now we define UART4 which is for the GPS. Be careful
|
2018-02-11 05:48:07 -04:00
|
|
|
# of the difference between USART and UART. Check the STM32F427xx.py
|
|
|
|
# if unsure which it is. For a UART we need to specify at least TX and
|
|
|
|
# RX pins.
|
|
|
|
|
2018-01-05 02:19:51 -04:00
|
|
|
# UART4 serial GPS
|
|
|
|
PA0 UART4_TX UART4
|
|
|
|
PA1 UART4_RX UART4
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Now define the primary battery connectors. The labels we choose here
|
2018-02-11 05:48:07 -04:00
|
|
|
# are used to create defines for pins in the various drivers, so
|
|
|
|
# choose names that match existing board setups where possible. Here
|
|
|
|
# we define two pins PA2 and PA3 for voltage and current sensing, with
|
|
|
|
# a scale factor of 1.0 and connected on ADC1. The pin number this
|
|
|
|
# maps to in hal.adc is automatically determined using the datasheet
|
2018-08-01 11:59:31 -03:00
|
|
|
# tables in STM32F427xx.py.
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-01-13 00:48:43 -04:00
|
|
|
PA2 BATT_VOLTAGE_SENS ADC1 SCALE(1)
|
|
|
|
PA3 BATT_CURRENT_SENS ADC1 SCALE(1)
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Now the VDD sense pin. This is used to sense primary board voltage.
|
2018-01-13 00:48:43 -04:00
|
|
|
PA4 VDD_5V_SENS ADC1 SCALE(2)
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Now the first SPI bus. At minimum you need SCK, MISO and MOSI pin
|
2018-02-11 05:48:07 -04:00
|
|
|
definitions. You can add speed modifiers if you want them, otherwise
|
|
|
|
the defaults for the peripheral class are used.
|
|
|
|
|
2018-01-05 02:19:51 -04:00
|
|
|
PA5 SPI1_SCK SPI1
|
|
|
|
PA6 SPI1_MISO SPI1
|
|
|
|
PA7 SPI1_MOSI SPI1
|
|
|
|
|
2019-06-08 19:42:18 -03:00
|
|
|
# This defines an output pin which will default to output LOW. It is a
|
|
|
|
# pin that enables peripheral power on this board.
|
|
|
|
|
|
|
|
PA8 VDD_5V_PERIPH_EN OUTPUT LOW
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# This is the pin that senses USB being connected. It is an input pin
|
|
|
|
# setup as OPENDRAIN.
|
2018-01-05 02:19:51 -04:00
|
|
|
PA9 VBUS INPUT OPENDRAIN
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# This is a commented out pin for talking to the debug UART on the
|
2018-02-11 05:48:07 -04:00
|
|
|
# IOMCU, not used yet, but left as a comment (with a '#' in front) for
|
|
|
|
# future reference
|
2018-01-05 02:19:51 -04:00
|
|
|
# PA10 IO-debug-console
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Now we define the pins that USB is connected on.
|
2018-01-05 02:19:51 -04:00
|
|
|
PA11 OTG_FS_DM OTG1
|
|
|
|
PA12 OTG_FS_DP OTG1
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# These are the pins for SWD debugging with a STlinkv2 or black-magic probe.
|
2018-01-05 02:19:51 -04:00
|
|
|
PA13 JTMS-SWDIO SWD
|
|
|
|
PA14 JTCK-SWCLK SWD
|
2018-02-08 17:23:18 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# This defines the PWM pin for the buzzer (if there is one). It is
|
2018-02-11 05:48:07 -04:00
|
|
|
# also mapped to a GPIO output so you can play with the buzzer via
|
2018-08-01 11:59:31 -03:00
|
|
|
# MAVLink relay commands if you want to.
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-02-08 17:23:18 -04:00
|
|
|
# PWM output for buzzer
|
|
|
|
PA15 TIM2_CH1 TIM2 GPIO(77) ALARM
|
2018-01-05 02:19:51 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# This defines a couple of general purpose outputs, mapped to GPIO
|
|
|
|
# numbers 1 and 2 for users.
|
2018-01-13 01:34:48 -04:00
|
|
|
PB0 EXTERN_GPIO1 OUTPUT GPIO(1)
|
|
|
|
PB1 EXTERN_GPIO2 OUTPUT GPIO(2)
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# This defines some input pins, currently unused.
|
2018-01-05 02:19:51 -04:00
|
|
|
PB2 BOOT1 INPUT
|
|
|
|
PB3 FMU_SW0 INPUT
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# This defines the pins for the 2nd CAN interface, if available.
|
2018-02-01 15:34:06 -04:00
|
|
|
PB6 CAN2_TX CAN2
|
2018-02-11 05:48:07 -04:00
|
|
|
PB12 CAN2_RX CAN2
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Now the first I2C bus. The pin speeds are automatically setup
|
2018-02-11 05:48:07 -04:00
|
|
|
# correctly, but can be overridden here if needed.
|
2018-01-05 02:19:51 -04:00
|
|
|
PB8 I2C1_SCL I2C1
|
|
|
|
PB9 I2C1_SDA I2C1
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# the 2nd I2C bus
|
2018-01-05 02:19:51 -04:00
|
|
|
PB10 I2C2_SCL I2C2
|
|
|
|
PB11 I2C2_SDA I2C2
|
2018-02-11 05:48:07 -04:00
|
|
|
|
|
|
|
# the 2nd SPI bus
|
2018-01-05 02:19:51 -04:00
|
|
|
PB13 SPI2_SCK SPI2
|
|
|
|
PB14 SPI2_MISO SPI2
|
|
|
|
PB15 SPI2_MOSI SPI2
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# This input pin is used to detect that power is valid on USB.
|
2018-01-05 02:19:51 -04:00
|
|
|
PC0 VBUS_VALID INPUT
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# This defines the CS pin for the magnetometer and first IMU. Note
|
2018-02-11 05:48:07 -04:00
|
|
|
# that CS pins are software controlled, and are not tied to a particular
|
2018-08-01 11:59:31 -03:00
|
|
|
# SPI bus.
|
2018-01-11 22:27:25 -04:00
|
|
|
PC1 MAG_CS CS
|
|
|
|
PC2 MPU_CS CS
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# This defines more ADC inputs.
|
2018-01-13 00:48:43 -04:00
|
|
|
PC3 AUX_POWER ADC1 SCALE(1)
|
|
|
|
PC4 AUX_ADC2 ADC1 SCALE(1)
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# And the analog input for airspeed (rarely used these days).
|
2018-01-13 00:48:43 -04:00
|
|
|
PC5 PRESSURE_SENS ADC1 SCALE(2)
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# This sets up the UART for talking to the IOMCU. Note that it is
|
2018-02-11 05:48:07 -04:00
|
|
|
# vital that this UART has DMA available. See the DMA settings below
|
2018-08-01 11:59:31 -03:00
|
|
|
# for more information.
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-01-05 02:19:51 -04:00
|
|
|
# USART6 to IO
|
|
|
|
PC6 USART6_TX USART6
|
|
|
|
PC7 USART6_RX USART6
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Now setup the pins for the microSD card, if available.
|
2018-01-05 02:19:51 -04:00
|
|
|
PC8 SDIO_D0 SDIO
|
|
|
|
PC9 SDIO_D1 SDIO
|
|
|
|
PC10 SDIO_D2 SDIO
|
|
|
|
PC11 SDIO_D3 SDIO
|
|
|
|
PC12 SDIO_CK SDIO
|
2018-02-11 05:48:07 -04:00
|
|
|
PD2 SDIO_CMD SDIO
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# More CS pins for more sensors. The labels for all CS pins need to
|
|
|
|
# match the SPI device table later in this file.
|
2018-01-05 02:19:51 -04:00
|
|
|
PC13 GYRO_EXT_CS CS
|
|
|
|
PC14 BARO_EXT_CS CS
|
|
|
|
PC15 ACCEL_EXT_CS CS
|
2018-02-11 05:48:07 -04:00
|
|
|
PD7 BARO_CS CS
|
|
|
|
PE4 MPU_EXT_CS CS
|
2018-01-05 02:19:51 -04:00
|
|
|
|
2018-02-11 05:48:07 -04:00
|
|
|
# the first CAN bus
|
2018-02-01 15:34:06 -04:00
|
|
|
PD0 CAN1_RX CAN1
|
|
|
|
PD1 CAN1_TX CAN1
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Another USART, this one for telem1. This one has RTS and CTS lines.
|
2018-01-05 02:19:51 -04:00
|
|
|
# USART2 serial2 telem1
|
|
|
|
PD3 USART2_CTS USART2
|
|
|
|
PD4 USART2_RTS USART2
|
|
|
|
PD5 USART2_TX USART2
|
|
|
|
PD6 USART2_RX USART2
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# The telem2 USART, also with RTS/CTS available.
|
2018-01-05 02:19:51 -04:00
|
|
|
# USART3 serial3 telem2
|
|
|
|
PD8 USART3_TX USART3
|
|
|
|
PD9 USART3_RX USART3
|
|
|
|
PD11 USART3_CTS USART3
|
|
|
|
PD12 USART3_RTS USART3
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# The CS pin for FRAM (ramtron). This one is marked as using
|
|
|
|
# SPEED_VERYLOW, which matches the HAL_PX4 setup.
|
2018-02-11 05:48:07 -04:00
|
|
|
PD10 FRAM_CS CS SPEED_VERYLOW
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Now we start defining some PWM pins. We also map these pins to GPIO
|
2018-02-11 05:48:07 -04:00
|
|
|
# values, so users can set BRD_PWM_COUNT to choose how many of the PWM
|
|
|
|
# outputs on the primary MCU are setup as PWM and how many as
|
|
|
|
# GPIOs. To match HAL_PX4 we number the GPIOs for the PWM outputs
|
2018-08-01 11:59:31 -03:00
|
|
|
# starting at 50.
|
2018-02-11 05:48:07 -04:00
|
|
|
PE14 TIM1_CH4 TIM1 PWM(1) GPIO(50)
|
|
|
|
PE13 TIM1_CH3 TIM1 PWM(2) GPIO(51)
|
|
|
|
PE11 TIM1_CH2 TIM1 PWM(3) GPIO(52)
|
|
|
|
PE9 TIM1_CH1 TIM1 PWM(4) GPIO(53)
|
2018-01-13 01:34:48 -04:00
|
|
|
PD13 TIM4_CH2 TIM4 PWM(5) GPIO(54)
|
|
|
|
PD14 TIM4_CH3 TIM4 PWM(6) GPIO(55)
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-07-09 07:07:28 -03:00
|
|
|
define BOARD_PWM_COUNT_DEFAULT 4
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Relays default to use GPIO pins 54 and 55.
|
2018-07-09 07:07:28 -03:00
|
|
|
define RELAY1_PIN_DEFAULT 54
|
|
|
|
define RELAY2_PIN_DEFAULT 55
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# This is the invensense data-ready pin. We don't use it in the
|
|
|
|
# default driver.
|
2018-01-05 02:19:51 -04:00
|
|
|
PD15 MPU_DRDY INPUT
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# the 2nd GPS UART
|
2018-01-05 02:19:51 -04:00
|
|
|
# UART8 serial4 GPS2
|
|
|
|
PE0 UART8_RX UART8
|
|
|
|
PE1 UART8_TX UART8
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Now setup SPI bus4.
|
2018-02-11 05:48:07 -04:00
|
|
|
PE2 SPI4_SCK SPI4
|
2018-01-05 02:19:51 -04:00
|
|
|
PE5 SPI4_MISO SPI4
|
|
|
|
PE6 SPI4_MOSI SPI4
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# This is the pin to enable the sensors rail. It can be used to power
|
2018-02-11 05:48:07 -04:00
|
|
|
# cycle sensors to recover them in case there are problems with power on
|
2019-06-08 19:42:18 -03:00
|
|
|
# timing affecting sensor stability. We pull it high by default.
|
|
|
|
PE3 VDD_3V3_SENSORS_EN OUTPUT HIGH
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# UART7 maps to uartF in the HAL (serial5 in SERIALn_ parameters).
|
2018-01-05 02:19:51 -04:00
|
|
|
PE7 UART7_RX UART7
|
|
|
|
PE8 UART7_TX UART7
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2019-01-10 19:44:39 -04:00
|
|
|
# Define a LED, mapping it to GPIO(0). LOW will illuminate the LED
|
|
|
|
PE12 FMU_LED_AMBER OUTPUT HIGH OPENDRAIN GPIO(0)
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Power flag pins: these tell the MCU the status of the various power
|
2018-04-08 06:30:32 -03:00
|
|
|
# supplies that are available. The pin names need to exactly match the
|
|
|
|
# names used in AnalogIn.cpp.
|
|
|
|
PB5 VDD_BRICK_VALID INPUT PULLUP
|
|
|
|
PB7 VDD_SERVO_VALID INPUT PULLUP
|
|
|
|
PE10 VDD_5V_HIPOWER_OC INPUT PULLUP
|
|
|
|
PE15 VDD_5V_PERIPH_OC INPUT PULLUP
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Now the SPI device table. This table creates all accessible SPI
|
2018-02-11 05:48:07 -04:00
|
|
|
# devices, giving the name of the device (which is used by device
|
|
|
|
# drivers to open the device), plus which SPI bus it it on, what
|
|
|
|
# device ID will be used (which controls the IDs used in parameters
|
|
|
|
# such as COMPASS_DEV_ID, so we can detect when the list of devices
|
|
|
|
# changes between reboots for calibration purposes), the SPI mode to
|
2018-08-01 11:59:31 -03:00
|
|
|
# use, and the low and high speed settings for the device.
|
2018-02-11 05:48:07 -04:00
|
|
|
|
|
|
|
# You can define more SPI devices than you actually have, to allow for
|
|
|
|
# flexibility in board setup, and the driver code can probe to see
|
2018-08-01 11:59:31 -03:00
|
|
|
# which are responding.
|
2018-02-11 05:48:07 -04:00
|
|
|
|
|
|
|
# The DEVID values and device names are chosen to match the PX4 port
|
|
|
|
# of ArduPilot so users don't need to re-do their accel and compass
|
2018-08-01 11:59:31 -03:00
|
|
|
# calibrations when moving to ChibiOS.
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-01-11 21:01:06 -04:00
|
|
|
SPIDEV ms5611 SPI1 DEVID3 BARO_CS MODE3 20*MHZ 20*MHZ
|
|
|
|
SPIDEV ms5611_ext SPI4 DEVID2 BARO_EXT_CS MODE3 20*MHZ 20*MHZ
|
2018-04-02 08:34:18 -03:00
|
|
|
SPIDEV mpu6000 SPI1 DEVID4 MPU_CS MODE3 2*MHZ 8*MHZ
|
2018-07-11 22:26:44 -03:00
|
|
|
SPIDEV icm20608-am SPI1 DEVID2 ACCEL_EXT_CS MODE3 4*MHZ 8*MHZ
|
2018-04-02 08:34:18 -03:00
|
|
|
SPIDEV mpu9250 SPI1 DEVID4 MPU_CS MODE3 4*MHZ 8*MHZ
|
|
|
|
SPIDEV mpu9250_ext SPI4 DEVID1 MPU_EXT_CS MODE3 4*MHZ 8*MHZ
|
2019-03-10 21:17:38 -03:00
|
|
|
SPIDEV icm20948 SPI1 DEVID4 MPU_CS MODE3 4*MHZ 8*MHZ
|
|
|
|
SPIDEV icm20948_ext SPI4 DEVID1 MPU_EXT_CS MODE3 4*MHZ 8*MHZ
|
2018-01-11 21:01:06 -04:00
|
|
|
SPIDEV hmc5843 SPI1 DEVID5 MAG_CS MODE3 11*MHZ 11*MHZ
|
2018-02-19 00:49:32 -04:00
|
|
|
SPIDEV lsm9ds0_g SPI1 DEVID1 GYRO_EXT_CS MODE3 11*MHZ 11*MHZ
|
|
|
|
SPIDEV lsm9ds0_am SPI1 DEVID2 ACCEL_EXT_CS MODE3 11*MHZ 11*MHZ
|
2018-01-11 21:01:06 -04:00
|
|
|
SPIDEV lsm9ds0_ext_g SPI4 DEVID4 GYRO_EXT_CS MODE3 11*MHZ 11*MHZ
|
|
|
|
SPIDEV lsm9ds0_ext_am SPI4 DEVID3 ACCEL_EXT_CS MODE3 11*MHZ 11*MHZ
|
2019-03-10 21:17:38 -03:00
|
|
|
SPIDEV icm20602_ext SPI4 DEVID4 GYRO_EXT_CS MODE3 4*MHZ 8*MHZ
|
|
|
|
SPIDEV ramtron SPI2 DEVID10 FRAM_CS MODE3 8*MHZ 8*MHZ
|
2018-01-11 21:01:06 -04:00
|
|
|
SPIDEV external0m0 SPI4 DEVID5 MPU_EXT_CS MODE0 2*MHZ 2*MHZ
|
|
|
|
SPIDEV external0m1 SPI4 DEVID5 MPU_EXT_CS MODE1 2*MHZ 2*MHZ
|
|
|
|
SPIDEV external0m2 SPI4 DEVID5 MPU_EXT_CS MODE2 2*MHZ 2*MHZ
|
|
|
|
SPIDEV external0m3 SPI4 DEVID5 MPU_EXT_CS MODE3 2*MHZ 2*MHZ
|
2018-02-14 01:41:16 -04:00
|
|
|
SPIDEV pixartPC15 SPI4 DEVID13 ACCEL_EXT_CS MODE3 2*MHZ 2*MHZ
|
2018-01-11 21:01:06 -04:00
|
|
|
|
2018-02-11 05:48:07 -04:00
|
|
|
# Now some commented out SPI device names which can be used by
|
|
|
|
# developers to test that the clock calculations are right for a
|
2018-08-01 11:59:31 -03:00
|
|
|
# bus. This is used in conjunction with the mavproxy devop module.
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-01-16 22:55:52 -04:00
|
|
|
# for SPI clock testing
|
|
|
|
#SPIDEV clock500 SPI4 DEVID5 MPU_EXT_CS MODE0 500*KHZ 500*KHZ # gives 329KHz
|
|
|
|
#SPIDEV clock1 SPI4 DEVID5 MPU_EXT_CS MODE0 1*MHZ 1*MHZ # gives 657kHz
|
|
|
|
#SPIDEV clock2 SPI4 DEVID5 MPU_EXT_CS MODE0 2*MHZ 2*MHZ # gives 1.3MHz
|
|
|
|
#SPIDEV clock4 SPI4 DEVID5 MPU_EXT_CS MODE0 4*MHZ 4*MHZ # gives 2.6MHz
|
|
|
|
#SPIDEV clock8 SPI4 DEVID5 MPU_EXT_CS MODE0 8*MHZ 8*MHZ # gives 5.5MHz
|
|
|
|
#SPIDEV clock16 SPI4 DEVID5 MPU_EXT_CS MODE0 16*MHZ 16*MHZ # gives 10.6MHz
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# This adds a C define which sets up the ArduPilot architecture
|
2018-02-11 05:48:07 -04:00
|
|
|
# define. Any line starting with 'define' is copied literally as
|
2018-08-01 11:59:31 -03:00
|
|
|
# a #define in the hwdef.h header.
|
2018-01-14 04:00:47 -04:00
|
|
|
define HAL_CHIBIOS_ARCH_FMUV3 1
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Nnow some defines for logging and terrain data files.
|
2018-01-14 04:00:47 -04:00
|
|
|
define HAL_BOARD_LOG_DIRECTORY "/APM/LOGS"
|
|
|
|
define HAL_BOARD_TERRAIN_DIRECTORY "/APM/TERRAIN"
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# We need to tell HAL_ChibiOS/Storage.cpp how much storage is
|
|
|
|
# available (in bytes).
|
2018-01-14 04:00:47 -04:00
|
|
|
define HAL_STORAGE_SIZE 16384
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Now define fallback storage location is flash if no FRAM
|
2018-02-11 05:48:07 -04:00
|
|
|
# fitted. This needs to be carefully chosen to align with your
|
|
|
|
# bootloader. The flash storage system needs two sectors, and the
|
2018-08-01 11:59:31 -03:00
|
|
|
# sectors must be at least 20% larger than HAL_STORAGE_SIZE.
|
2018-01-14 04:00:47 -04:00
|
|
|
define STORAGE_FLASH_PAGE 22
|
|
|
|
|
2018-06-29 14:13:35 -03:00
|
|
|
# allow to have have a dedicated safety switch pin
|
|
|
|
define HAL_HAVE_SAFETY_SWITCH 1
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# This enables the use of a ramtron device for storage, if one is
|
|
|
|
# found on SPI. You must have a ramtron entry in the SPI device table.
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Enable RAMTROM parameter storage.
|
2018-01-14 04:00:47 -04:00
|
|
|
define HAL_WITH_RAMTRON 1
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Setup for the possibility of an IMU heater since the pixhawk2 cube has
|
|
|
|
# an IMU heater.
|
2018-01-14 04:00:47 -04:00
|
|
|
define HAL_HAVE_IMU_HEATER 1
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Enable FAT filesystem support (needs a microSD defined via SDIO).
|
2018-01-14 04:00:47 -04:00
|
|
|
define HAL_OS_FATFS_IO 1
|
2018-01-19 18:43:01 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Enable RTSCTS support. You should define this if you have any UARTs
|
|
|
|
with RTS/CTS pins.
|
2018-01-19 18:43:01 -04:00
|
|
|
define AP_FEATURE_RTSCTS 1
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Enable SBUS_OUT on IOMCU (if you have an IOMCU).
|
2018-01-19 18:43:01 -04:00
|
|
|
define AP_FEATURE_SBUS_OUT 1
|
2018-02-01 15:34:06 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Now setup the default battery pins driver analog pins and default
|
|
|
|
# scaling for the power brick.
|
2018-02-04 00:09:19 -04:00
|
|
|
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-11 05:48:07 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# This defines the default maximum clock on I2C devices.
|
2018-02-11 05:48:07 -04:00
|
|
|
define HAL_I2C_MAX_CLOCK 100000
|
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# Uncomment the lines below to enable strict API
|
|
|
|
# checking in ChibiOS.
|
2018-03-02 06:39:14 -04:00
|
|
|
# define CH_DBG_ENABLE_ASSERTS TRUE
|
|
|
|
# define CH_DBG_ENABLE_CHECKS TRUE
|
|
|
|
# define CH_DBG_SYSTEM_STATE_CHECK TRUE
|
|
|
|
# define CH_DBG_ENABLE_STACK_CHECK TRUE
|
2018-02-11 05:48:07 -04:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# We can't share the IO UART (USART6).
|
2018-06-04 18:00:37 -03:00
|
|
|
DMA_NOSHARE USART6_TX USART6_RX ADC1
|
|
|
|
DMA_PRIORITY USART6*
|
2018-04-14 05:29:46 -03:00
|
|
|
|
2018-08-01 11:59:31 -03:00
|
|
|
# List of files to put in ROMFS. For fmuv3 we need an IO firmware so
|
2018-04-14 05:29:46 -03:00
|
|
|
# we can automatically update the IOMCU firmware on boot. The format
|
|
|
|
# is "ROMFS ROMFS-filename source-filename". Paths are relative to the
|
2018-08-01 11:59:31 -03:00
|
|
|
# ardupilot root.
|
2019-07-21 23:51:13 -03:00
|
|
|
ROMFS io_firmware.bin Tools/IO_Firmware/iofirmware_lowpolh.bin
|