From 9f53ae1ea45f232d62ff100683d605bbfd64419b Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 19 Jan 2018 16:07:01 +1100 Subject: [PATCH] HAL_ChibiOS: added F412-rev1 hwdef.dat --- .../hwdef/skyviper-f412-rev1/hwdef.dat | 142 ++++++++++++++++++ .../hwdef/skyviper-f412/hwdef.dat | 8 + 2 files changed, 150 insertions(+) create mode 100644 libraries/AP_HAL_ChibiOS/hwdef/skyviper-f412-rev1/hwdef.dat diff --git a/libraries/AP_HAL_ChibiOS/hwdef/skyviper-f412-rev1/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/skyviper-f412-rev1/hwdef.dat new file mode 100644 index 0000000000..aa67575e2a --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/skyviper-f412-rev1/hwdef.dat @@ -0,0 +1,142 @@ +# hw definition file for processing by chibios_pins.py +# old F412 layout + +MCU STM32F4xx STM32F412Rx + +# board ID for firmware load +APJ_BOARD_ID 9 + +# crystal frequency +OSCILLATOR_HZ 24000000 + +STM32_HSE_ENABLED FALSE +STM32_PLLM_VALUE 16 +STM32_PLLN_VALUE 384 +STM32_PLLP_VALUE 4 +STM32_PLLQ_VALUE 8 +STM32_PLLSRC STM32_PLLSRC_HSI +STM32_PREE1 STM32_PREE1_DIV2 +STM32_PREE2 STM32_PREE2_DIV1 + +STM32_PWM_USE_TIM3 TRUE + +# board voltage +STM32_VDD 330U + +RAM_SIZE_KB 256 + +# flash size +FLASH_SIZE_KB 1024 + +# serial port for stdout +STDOUT_SERIAL SD2 +STDOUT_BAUDRATE 115200 + +# order of I2C buses +I2C_ORDER I2C2 I2C1 + +# order of UARTs +UART_ORDER USART2 USART6 USART3 + +PC0 MGND ADC1 +PC1 PWM4_SENSE ADC1 +PC2 PWM2_SENSE ADC1 +PC3 PWM1_SENSE ADC1 +PA0 PWM3_SENSE ADC1 + +# USART2 is for debug +PA2 USART2_TX USART2 +PA3 USART2_RX USART2 + +PA4 BATT_MON ADC1 + +# SPI1 is radio +PA5 SPI1_SCK SPI1 +PB4 SPI1_MISO SPI1 +PA7 SPI1_MOSI SPI1 +PA15 RADIO_CS CS +PC4 RADIO_CE OUTPUT +PC5 RADIO_PA_CTL OUTPUT + +# SPI5 is flow +PB0 SPI5_SCK SPI5 +PA12 SPI5_MISO SPI5 +PA10 SPI5_MOSI SPI5 +PB1 FLOW_CS CS + +PB2 BOOT1 INPUT + +# I2C2 is GPS/mag +PB10 I2C2_SCL I2C2 +PB3 I2C2_SDA I2C2 + +PA13 JTMS-SWDIO SWD +PA14 JTCK-SWCLK SWD + +# I2C1 is 20789 +PB9 I2C1_SDA I2C1 +PB8 I2C1_SCL I2C1 + +PB7 LEDF OUTPUT HIGH GPIO(0) +PB6 LEDR OUTPUT HIGH GPIO(1) + +PB5 TIM3_CH2 TIM3 PWM(2) # marked CN15 front-right + +PD2 RADIO_IRQ INPUT + +# USART3 is sonix +PC11 USART3_RX USART3 +PC10 USART3_TX USART3 + +# USART6 is for GPS +PA11 USART6_TX USART6 +PC7 USART6_RX USART6 + +PA8 OF_MOTION INPUT +PC9 TIM3_CH4 TIM3 PWM(4) # marked CN17, rear-right +PC8 TIM3_CH3 TIM3 PWM(3) # marked CN13, rear-left +PC6 TIM3_CH1 TIM3 PWM(1) # marked CN3, front-left + +# SPI2 is MPU +PB13 SPI2_SCK SPI2 +PB14 SPI2_MISO SPI2 +PB15 SPI2_MOSI SPI2 +PB12 MPU_CS CS + +# SPI Device table +SPIDEV cypress SPI1 DEVID1 RADIO_CS MODE0 2*MHZ 2*MHZ +SPIDEV cc2500 SPI1 DEVID1 RADIO_CS MODE0 4*MHZ 4*MHZ +SPIDEV pixartflow SPI5 DEVID2 FLOW_CS MODE3 2*MHZ 2*MHZ +SPIDEV icm20789 SPI2 DEVID4 MPU_CS MODE3 1*MHZ 8*MHZ + +# reserve 16k for bootloader and 32k for storage +FLASH_RESERVE_START_KB 48 + +define HAL_CHIBIOS_ARCH_F412 1 + +define HAL_INS_DEFAULT HAL_INS_ICM20789_SPI +define HAL_INS_DEFAULT_ROTATION ROTATION_NONE + +# radio IRQ is on PD2 +define HAL_GPIO_RADIO_IRQ 2 +define HAL_GPIO_INTERRUPT_PORT EXT_MODE_GPIOD + +define HAL_RCINPUT_WITH_AP_RADIO 1 +define STORAGE_FLASH_PAGE 1 +define HAL_STORAGE_SIZE 16384 + +# setup defines for ArduCopter config +define TOY_MODE_ENABLED ENABLED +define ARMING_DELAY_SEC 0 +define LAND_START_ALT 700 +define LAND_DETECTOR_ACCEL_MAX 2.0f + +define CHIBIOS_ADC_MAVLINK_DEBUG 1 + +define HAL_COMPASS_DEFAULT HAL_COMPASS_BMM150_I2C +define HAL_COMPASS_BMM150_I2C_BUS 0 +define HAL_COMPASS_BMM150_I2C_ADDR 0x10 + +define HAL_BARO_DEFAULT HAL_BARO_20789_I2C_SPI +define HAL_BARO_20789_I2C_BUS 1 +define HAL_BARO_20789_I2C_ADDR_PRESS 0x63 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/skyviper-f412/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/skyviper-f412/hwdef.dat index 8cba68eefc..f946057939 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/skyviper-f412/hwdef.dat +++ b/libraries/AP_HAL_ChibiOS/hwdef/skyviper-f412/hwdef.dat @@ -119,3 +119,11 @@ define LAND_DETECTOR_ACCEL_MAX 2.0f define CHIBIOS_ADC_MAVLINK_DEBUG 1 +define HAL_COMPASS_DEFAULT HAL_COMPASS_BMM150_I2C +define HAL_COMPASS_BMM150_I2C_BUS 0 +define HAL_COMPASS_BMM150_I2C_ADDR 0x10 + +define HAL_BARO_DEFAULT HAL_BARO_20789_I2C_I2C +define HAL_BARO_20789_I2C_BUS 1 +define HAL_BARO_20789_I2C_ADDR_PRESS 0x63 +define HAL_BARO_20789_I2C_ADDR_ICM 0x68