From eb8cfea50789965bb081c6ae4be5add06f570b05 Mon Sep 17 00:00:00 2001 From: MallikarjunSE Date: Tue, 28 Dec 2021 15:30:23 +0530 Subject: [PATCH] AP_HAL_ChibiOS: Sierra-F412 support --- .../hwdef/Sierra-F412/defaults.parm | 7 + .../hwdef/Sierra-F412/hwdef-bl.dat | 82 +++++++++++ .../hwdef/Sierra-F412/hwdef.dat | 136 ++++++++++++++++++ 3 files changed, 225 insertions(+) create mode 100644 libraries/AP_HAL_ChibiOS/hwdef/Sierra-F412/defaults.parm create mode 100644 libraries/AP_HAL_ChibiOS/hwdef/Sierra-F412/hwdef-bl.dat create mode 100644 libraries/AP_HAL_ChibiOS/hwdef/Sierra-F412/hwdef.dat diff --git a/libraries/AP_HAL_ChibiOS/hwdef/Sierra-F412/defaults.parm b/libraries/AP_HAL_ChibiOS/hwdef/Sierra-F412/defaults.parm new file mode 100644 index 0000000000..51d683f56b --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/Sierra-F412/defaults.parm @@ -0,0 +1,7 @@ +# setup for Neopixel +OUT3_FUNCTION 120 +OUT4_FUNCTION 121 +NTF_LED_TYPES 455 +NTF_LED_BRIGHT 2 +NTF_LED_LEN 8 + diff --git a/libraries/AP_HAL_ChibiOS/hwdef/Sierra-F412/hwdef-bl.dat b/libraries/AP_HAL_ChibiOS/hwdef/Sierra-F412/hwdef-bl.dat new file mode 100644 index 0000000000..609fc8440c --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/Sierra-F412/hwdef-bl.dat @@ -0,0 +1,82 @@ +# hw definition file for processing by chibios_pins.py + +# Sierra-M9N Bootloader + +# MCU class and specific type +MCU STM32F4xx STM32F412Rx + +FLASH_RESERVE_START_KB 0 +# two sectors for bootloader, two for storage +FLASH_BOOTLOADER_LOAD_KB 64 + +# board ID for firmware load +APJ_BOARD_ID 1055 + +# setup build for a peripheral firmware +env AP_PERIPH 1 + +# crystal frequency +OSCILLATOR_HZ 16000000 + +define CH_CFG_ST_FREQUENCY 1000000 + +# Flash available +FLASH_SIZE_KB 1024 + +define HAL_STORAGE_SIZE 16384 +define STORAGE_FLASH_PAGE 1 + +# Enable the sensor voltage pin +PC13 VDD_3V3_SENSORS_EN OUTPUT HIGH + +# order of UARTs +SERIAL_ORDER + +# USART1 +PA9 USART1_TX USART1 +PA10 USART1_RX USART1 + +# USART2 +PA2 USART2_TX USART2 +PA3 USART2_RX USART2 + +# SWD debugging +PA13 JTMS-SWDIO SWD +PA14 JTCK-SWCLK SWD + +# enable CAN support +PA11 CAN1_RX CAN1 +PA12 CAN1_TX CAN1 + +define HAL_USE_CAN TRUE +define STM32_CAN_USE_CAN1 TRUE + +define CAN_APP_NODE_NAME "org.ardupilot.Sierra-F412" + +# use DNA +define HAL_CAN_DEFAULT_NODE_ID 0 + +# reserve 256 bytes for comms between app and bootloader +RAM_RESERVE_START 256 + +# Add CS pins to ensure they are high in bootloader +PB12 MAG_CS CS +PA8 BARO_CS CS + +STDOUT_SERIAL SD1 +STDOUT_BAUDRATE 57600 + +define HAL_USE_SERIAL TRUE +define STM32_SERIAL_USE_USART1 TRUE +define STM32_SERIAL_USE_USART2 TRUE +define STM32_SERIAL_USE_USART3 FALSE + +define HAL_NO_GPIO_IRQ +define HAL_USE_EMPTY_IO TRUE + +# make bl baudrate match debug baudrate for easier debugging +define BOOTLOADER_BAUDRATE 57600 + +# use a small bootloader timeout +define HAL_BOOTLOADER_TIMEOUT 1000 + diff --git a/libraries/AP_HAL_ChibiOS/hwdef/Sierra-F412/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/Sierra-F412/hwdef.dat new file mode 100644 index 0000000000..040ab4caac --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/Sierra-F412/hwdef.dat @@ -0,0 +1,136 @@ +# hw definition file for processing by chibios_pins.py + +# Sierra-M9N Firmware + +# MCU class and specific type +MCU STM32F4xx STM32F412Rx + +# bootloader starts firmware at 64k +FLASH_RESERVE_START_KB 64 + +# store parameters in pages 2 and 3 +define STORAGE_FLASH_PAGE 2 +define HAL_STORAGE_SIZE 8192 + +# board ID for firmware load +APJ_BOARD_ID 1055 + +# setup build for a peripheral firmware +env AP_PERIPH 1 + +STM32_ST_USE_TIMER 5 + +# enable watchdog +define HAL_WATCHDOG_ENABLED_DEFAULT true + +# crystal frequency +OSCILLATOR_HZ 16000000 + +define CH_CFG_ST_FREQUENCY 1000000 + +# Flash available +FLASH_SIZE_KB 1024 + +STDOUT_SERIAL SD1 +STDOUT_BAUDRATE 57600 + +# order of UARTs +SERIAL_ORDER USART1 EMPTY EMPTY USART2 + +# USART1 for debug +PA9 USART1_TX USART1 +PA10 USART1_RX USART1 +define HAL_SERIAL0_BAUD_DEFAULT 57600 + +# Enable the sensor voltage pin +PC13 VDD_3V3_SENSORS_EN OUTPUT HIGH + +# USART2 for GPS +PA2 USART2_TX USART2 SPEED_HIGH +PA3 USART2_RX USART2 SPEED_HIGH + +# SWD debugging +PA13 JTMS-SWDIO SWD +PA14 JTCK-SWCLK SWD + +# SPI sensors +PA5 SPI1_SCK SPI1 +PA6 SPI1_MISO SPI1 +PA7 SPI1_MOSI SPI1 + +# SPI CS +PB12 MAG_CS CS +PA8 BARO_CS CS + +# Baro probe +SPIDEV dps310 SPI1 DEVID3 BARO_CS MODE3 5*MHZ 5*MHZ +BARO DPS310 SPI:dps310 + +# Mag probe +SPIDEV rm3100 SPI1 DEVID1 MAG_CS MODE0 1*MHZ 1*MHZ +COMPASS RM3100 SPI:rm3100 false ROTATION_PITCH_180 + +# PWM, WS2812 LED +PB8 TIM4_CH3 TIM4 PWM(1) GPIO(50) +PB9 TIM4_CH4 TIM4 PWM(2) GPIO(51) +PA15 TIM2_CH1 TIM2 PWM(3) GPIO(52) +PB4 TIM3_CH1 TIM3 PWM(4) GPIO(53) + +define HAL_USE_ADC TRUE +define STM32_ADC_USE_ADC1 TRUE +#define HAL_DISABLE_ADC_DRIVER TRUE +PA0 VSENSE ADC1 SCALE(2) + +define HAL_NO_GPIO_IRQ + +# avoid RCIN thread to save memory +define HAL_NO_RCIN_THREAD +define HAL_USE_RTC FALSE +define DISABLE_SERIAL_ESC_COMM TRUE +define DMA_RESERVE_SIZE 0 +define PERIPH_FW TRUE +define HAL_DISABLE_LOOP_DELAY + +# enable CAN support +PA11 CAN1_RX CAN1 +PA12 CAN1_TX CAN1 + +# use DNA +define HAL_CAN_DEFAULT_NODE_ID 0 +define CAN_APP_NODE_NAME "org.ardupilot.Sierra-F412" + +define HAL_NO_MONITOR_THREAD +define HAL_MINIMIZE_FEATURES 0 +define HAL_BUILD_AP_PERIPH +define HAL_DEVICE_THREAD_STACK 768 + +# disable dual GPS and GPS blending to save flash space +define GPS_MAX_RECEIVERS 1 +define GPS_MAX_INSTANCES 1 +define HAL_COMPASS_MAX_SENSORS 1 + +# GPS+MAG+BARO+Buzzer+NeoPixels +define HAL_PERIPH_ENABLE_GPS +define HAL_PERIPH_GPS_PORT_DEFAULT 3 +define HAL_PERIPH_ENABLE_MAG +define HAL_PERIPH_ENABLE_BARO +define HAL_PERIPH_ENABLE_RC_OUT +define HAL_PERIPH_ENABLE_NOTIFY + +# use the app descriptor needed by MissionPlanner for CAN upload +env APP_DESCRIPTOR MissionPlanner + +# reserve 256 bytes for comms between app and bootloader +RAM_RESERVE_START 256 + +# allow for reboot command for faster development +define HAL_PERIPH_LISTEN_FOR_SERIAL_UART_REBOOT_CMD_PORT 0 + +# we setup a small defaults.parm +define AP_PARAM_MAX_EMBEDDED_PARAM 256 + +#GPS M9N +PC11 M9EXTINT INPUT +PC10 M9RST INPUT +PC8 GPS_PPS_IN INPUT +PC7 M9SB INPUT