From 00879e9b0b6f922eaaec912621a9cf488bc81cf8 Mon Sep 17 00:00:00 2001 From: MallikarjunSE Date: Fri, 18 Aug 2023 14:31:59 +0530 Subject: [PATCH] AP_HAL_ChibiOS/hwdef: Add hwdef for Sierra True series periphs --- .../hwdef/Sierra-TrueNavPro/defaults.parm | 4 + .../hwdef/Sierra-TrueNavPro/hwdef-bl.dat | 60 +++++++++ .../hwdef/Sierra-TrueNavPro/hwdef.dat | 118 ++++++++++++++++++ .../hwdef/Sierra-TrueNorth/hwdef-bl.dat | 57 +++++++++ .../hwdef/Sierra-TrueNorth/hwdef.dat | 97 ++++++++++++++ .../hwdef/Sierra-TrueSpeed/hwdef-bl.dat | 56 +++++++++ .../hwdef/Sierra-TrueSpeed/hwdef.dat | 109 ++++++++++++++++ 7 files changed, 501 insertions(+) create mode 100644 libraries/AP_HAL_ChibiOS/hwdef/Sierra-TrueNavPro/defaults.parm create mode 100644 libraries/AP_HAL_ChibiOS/hwdef/Sierra-TrueNavPro/hwdef-bl.dat create mode 100644 libraries/AP_HAL_ChibiOS/hwdef/Sierra-TrueNavPro/hwdef.dat create mode 100644 libraries/AP_HAL_ChibiOS/hwdef/Sierra-TrueNorth/hwdef-bl.dat create mode 100644 libraries/AP_HAL_ChibiOS/hwdef/Sierra-TrueNorth/hwdef.dat create mode 100644 libraries/AP_HAL_ChibiOS/hwdef/Sierra-TrueSpeed/hwdef-bl.dat create mode 100644 libraries/AP_HAL_ChibiOS/hwdef/Sierra-TrueSpeed/hwdef.dat diff --git a/libraries/AP_HAL_ChibiOS/hwdef/Sierra-TrueNavPro/defaults.parm b/libraries/AP_HAL_ChibiOS/hwdef/Sierra-TrueNavPro/defaults.parm new file mode 100644 index 0000000000000..9b64ede5950c0 --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/Sierra-TrueNavPro/defaults.parm @@ -0,0 +1,4 @@ +# setup for Neopixel +OUT1_FUNCTION 120 +NTF_LED_TYPES 455 +NTF_LED_LEN 2 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/Sierra-TrueNavPro/hwdef-bl.dat b/libraries/AP_HAL_ChibiOS/hwdef/Sierra-TrueNavPro/hwdef-bl.dat new file mode 100644 index 0000000000000..a0243c78e166e --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/Sierra-TrueNavPro/hwdef-bl.dat @@ -0,0 +1,60 @@ +# HW definition file for Sierra-TrueNav Pro + +# MCU class and specific type +MCU STM32L431 STM32L431xx + +# crystal frequency +OSCILLATOR_HZ 16000000 + +# board ID for firmware load +APJ_BOARD_ID 1091 + +# setup build for a peripheral firmware +env AP_PERIPH 1 + +# Flash info +FLASH_RESERVE_START_KB 0 +FLASH_BOOTLOADER_LOAD_KB 36 +FLASH_SIZE_KB 256 + +# reserve some space for params +APP_START_OFFSET_KB 4 + +# a fault LED +PA1 LED_BOOTLOADER OUTPUT LOW # amber +define HAL_LED_ON 1 + +# enable CAN support +PA11 CAN1_RX CAN1 +PA12 CAN1_TX CAN1 +PB1 GPIO_CAN1_SILENT OUTPUT PUSHPULL SPEED_LOW LOW +PB6 GPIO_CAN1_TERM OUTPUT PUSHPULL SPEED_LOW HIGH + +CAN_ORDER 1 + +# make bl baudrate match debug baudrate for easier debugging +define BOOTLOADER_BAUDRATE 57600 + +# use a small bootloader timeout +define HAL_BOOTLOADER_TIMEOUT 1000 + +define HAL_USE_SERIAL FALSE +define HAL_NO_GPIO_IRQ +define HAL_USE_EMPTY_IO TRUE +define PORT_INT_REQUIRED_STACK 64 +define DMA_RESERVE_SIZE 0 + +MAIN_STACK 0x800 +PROCESS_STACK 0x800 + +define HAL_DISABLE_LOOP_DELAY + +# Add CS pins to ensure they are high in bootloader +PB12 RM3100_CS CS +PA8 BARO_CS CS + +# debugger support +PA13 JTMS-SWDIO SWD +PA14 JTCK-SWCLK SWD + +define CAN_APP_NODE_NAME "in.sierraaerospace.TrueNavPro" diff --git a/libraries/AP_HAL_ChibiOS/hwdef/Sierra-TrueNavPro/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/Sierra-TrueNavPro/hwdef.dat new file mode 100644 index 0000000000000..621c68b9539f3 --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/Sierra-TrueNavPro/hwdef.dat @@ -0,0 +1,118 @@ +# HW definition file for Sierra-TrueNav Pro + +# MCU class and specific type +MCU STM32L431 STM32L431xx + +# bootloader starts firmware at 36k + 4k (STORAGE_FLASH) +FLASH_RESERVE_START_KB 40 +FLASH_SIZE_KB 256 + +# store parameters in pages 18 and 19 +STORAGE_FLASH_PAGE 18 +define HAL_STORAGE_SIZE 800 + +# ChibiOS system timer +STM32_ST_USE_TIMER 15 +define CH_CFG_ST_RESOLUTION 16 + +# board ID for firmware load +APJ_BOARD_ID 1091 + +# crystal frequency +OSCILLATOR_HZ 16000000 + +env AP_PERIPH 1 + +define HAL_NO_GPIO_IRQ +define SERIAL_BUFFERS_SIZE 512 +define PORT_INT_REQUIRED_STACK 64 + +define DMA_RESERVE_SIZE 0 + +# MAIN_STACK is stack for ISR handlers +MAIN_STACK 0x300 + +# PROCESS_STACK controls stack for main thread +PROCESS_STACK 0xA00 + +# save memory +define HAL_DISABLE_LOOP_DELAY +define HAL_GCS_ENABLED 0 +define HAL_NO_MONITOR_THREAD +define HAL_NO_LOGGING +define HAL_USE_ADC FALSE +define HAL_NO_RCIN_THREAD + +# we setup a small defaults.parm +define AP_PARAM_MAX_EMBEDDED_PARAM 256 + +# debugger support +PA13 JTMS-SWDIO SWD +PA14 JTCK-SWCLK SWD + +# --------------------- SPI1 RM3100+DPS310 ----------------------- +PA5 SPI1_SCK SPI1 +PA6 SPI1_MISO SPI1 +PA7 SPI1_MOSI SPI1 +PB12 RM3100_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 RM3100_CS MODE0 1*MHZ 1*MHZ +COMPASS RM3100 SPI:rm3100 false ROTATION_YAW_180 +define AP_RM3100_REVERSAL_MASK 7 + +# ---------------------- CAN bus ------------------------- +CAN_ORDER 1 + +PA11 CAN1_RX CAN1 +PA12 CAN1_TX CAN1 +PB1 GPIO_CAN1_SILENT OUTPUT PUSHPULL SPEED_LOW LOW +PB6 GPIO_CAN1_TERM OUTPUT PUSHPULL SPEED_LOW LOW + +define HAL_CAN_POOL_SIZE 12000 + +# ---------------------- UARTs --------------------------- +SERIAL_ORDER USART1 + +# USART1 for GPS +PA9 USART1_TX USART1 SPEED_HIGH +PA10 USART1_RX USART1 SPEED_HIGH + +# allow for reboot command for faster development +define HAL_PERIPH_LISTEN_FOR_SERIAL_UART_REBOOT_CMD_PORT 0 + +# keep ROMFS uncompressed as we don't have enough RAM +# to uncompress the bootloader at runtime +env ROMFS_UNCOMPRESSED True + +# enable GPS and compass +define HAL_PERIPH_ENABLE_GPS +define HAL_PERIPH_ENABLE_MAG +define HAL_PERIPH_ENABLE_BARO +define HAL_PERIPH_ENABLE_RC_OUT +define HAL_PERIPH_ENABLE_NOTIFY + +# 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 +define HAL_PERIPH_GPS_PORT_DEFAULT 0 + +# minimal GPS drivers to reduce flash usage +include ../include/minimal_GPS.inc + +# GPS PPS +PA15 GPS_PPS_IN INPUT + +# PWM, WS2812 LED +PB10 TIM2_CH3 TIM2 PWM(1) GPIO(50) + +define CAN_APP_NODE_NAME "in.sierraaerospace.TrueNavPro" + +# Enable GPS LDO +PC13 VDD_3V3_SENSORS_EN OUTPUT HIGH diff --git a/libraries/AP_HAL_ChibiOS/hwdef/Sierra-TrueNorth/hwdef-bl.dat b/libraries/AP_HAL_ChibiOS/hwdef/Sierra-TrueNorth/hwdef-bl.dat new file mode 100644 index 0000000000000..18f62d71c17e5 --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/Sierra-TrueNorth/hwdef-bl.dat @@ -0,0 +1,57 @@ +# HW definition file for Sierra-TrueNorth + +# MCU class and specific type +MCU STM32L431 STM32L431xx + +# crystal frequency +OSCILLATOR_HZ 16000000 + +# board ID for firmware load +APJ_BOARD_ID 1093 + +# setup build for a peripheral firmware +env AP_PERIPH 1 + +# Flash info +FLASH_RESERVE_START_KB 0 +FLASH_BOOTLOADER_LOAD_KB 36 +FLASH_SIZE_KB 256 + +# reserve some space for params +APP_START_OFFSET_KB 4 + +# a fault LED +PB14 LED_BOOTLOADER OUTPUT LOW # amber +define HAL_LED_ON 1 + +# enable CAN support +PA11 CAN1_RX CAN1 +PA12 CAN1_TX CAN1 +PA10 GPIO_CAN1_SILENT OUTPUT PUSHPULL SPEED_LOW LOW +PB12 GPIO_CAN1_TERM OUTPUT PUSHPULL SPEED_LOW HIGH + +CAN_ORDER 1 + +# make bl baudrate match debug baudrate for easier debugging +define BOOTLOADER_BAUDRATE 57600 + +# use a small bootloader timeout +define HAL_BOOTLOADER_TIMEOUT 1000 + +define HAL_USE_SERIAL FALSE +define HAL_NO_GPIO_IRQ +define HAL_USE_EMPTY_IO TRUE +define PORT_INT_REQUIRED_STACK 64 +define DMA_RESERVE_SIZE 0 + +MAIN_STACK 0x800 +PROCESS_STACK 0x800 + +define HAL_DISABLE_LOOP_DELAY + +# debugger support +PA13 JTMS-SWDIO SWD +PA14 JTCK-SWCLK SWD + +define CAN_APP_NODE_NAME "in.sierraaerospace.TrueNorth" +PA4 RM3100_CS CS diff --git a/libraries/AP_HAL_ChibiOS/hwdef/Sierra-TrueNorth/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/Sierra-TrueNorth/hwdef.dat new file mode 100644 index 0000000000000..eaee7e1247665 --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/Sierra-TrueNorth/hwdef.dat @@ -0,0 +1,97 @@ +# HW definition file for Sierra-TrueNorth + +# MCU class and specific type +MCU STM32L431 STM32L431xx + +# bootloader starts firmware at 36k + 4k (STORAGE_FLASH) +FLASH_RESERVE_START_KB 40 +FLASH_SIZE_KB 256 + +# store parameters in pages 18 and 19 +STORAGE_FLASH_PAGE 18 +define HAL_STORAGE_SIZE 800 + +# ChibiOS system timer +STM32_ST_USE_TIMER 15 +define CH_CFG_ST_RESOLUTION 16 + +# board ID for firmware load +APJ_BOARD_ID 1093 + +# crystal frequency +OSCILLATOR_HZ 16000000 + +env AP_PERIPH 1 + +define HAL_NO_GPIO_IRQ +define SERIAL_BUFFERS_SIZE 512 +define PORT_INT_REQUIRED_STACK 64 + +define DMA_RESERVE_SIZE 0 + +# MAIN_STACK is stack for ISR handlers +MAIN_STACK 0x300 + +# PROCESS_STACK controls stack for main thread +PROCESS_STACK 0xA00 + +# save memory +define HAL_DISABLE_LOOP_DELAY +define HAL_GCS_ENABLED 0 +define HAL_NO_MONITOR_THREAD +define HAL_NO_LOGGING +define HAL_USE_ADC FALSE +define HAL_NO_RCIN_THREAD + +# we setup a small defaults.parm +define AP_PARAM_MAX_EMBEDDED_PARAM 256 + +# debugger support +PA13 JTMS-SWDIO SWD +PA14 JTCK-SWCLK SWD + +# ---------------------- CAN bus ------------------------- +CAN_ORDER 1 + +PA11 CAN1_RX CAN1 +PA12 CAN1_TX CAN1 +PA10 GPIO_CAN1_SILENT OUTPUT PUSHPULL SPEED_LOW LOW +PB12 GPIO_CAN1_TERM OUTPUT PUSHPULL SPEED_LOW HIGH + +define HAL_CAN_POOL_SIZE 6000 + +# allow for reboot command for faster development +define HAL_PERIPH_LISTEN_FOR_SERIAL_UART_REBOOT_CMD_PORT 0 + +# keep ROMFS uncompressed as we don't have enough RAM +# to uncompress the bootloader at runtime +env ROMFS_UNCOMPRESSED True + +# enable compass and airspeed +define HAL_PERIPH_ENABLE_MAG +define HAL_COMPASS_MAX_SENSORS 1 + +# PWM, WS2812 LED +PA2 TIM2_CH3 TIM2 PWM(1) GPIO(50) +PA3 TIM2_CH4 TIM2 PWM(2) GPIO(51) + +define CAN_APP_NODE_NAME "in.sierraaerospace.TrueNorth" + +# SPI1 bus for RM3100 +PA5 SPI1_SCK SPI1 +PA6 SPI1_MISO SPI1 +PA7 SPI1_MOSI SPI1 +PA4 RM3100_CS CS + +SPIDEV rm3100 SPI1 DEVID1 RM3100_CS MODE0 1*MHZ 1*MHZ +COMPASS RM3100 SPI:rm3100 false ROTATION_YAW_180 + +# LEDs +PB14 LED OUTPUT LOW GPIO(1) + +# ---------------------- UARTs --------------------------- +SERIAL_ORDER USART1 + +# USART1 +PA9 USART1_TX USART1 SPEED_HIGH +PB7 USART1_RX USART1 SPEED_HIGH diff --git a/libraries/AP_HAL_ChibiOS/hwdef/Sierra-TrueSpeed/hwdef-bl.dat b/libraries/AP_HAL_ChibiOS/hwdef/Sierra-TrueSpeed/hwdef-bl.dat new file mode 100644 index 0000000000000..2b08e87d4c2d6 --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/Sierra-TrueSpeed/hwdef-bl.dat @@ -0,0 +1,56 @@ +# HW definition file for Sierra-TrueSpeed + +# MCU class and specific type +MCU STM32L431 STM32L431xx + +# crystal frequency +OSCILLATOR_HZ 16000000 + +# board ID for firmware load +APJ_BOARD_ID 1094 + +# setup build for a peripheral firmware +env AP_PERIPH 1 + +# Flash info +FLASH_RESERVE_START_KB 0 +FLASH_BOOTLOADER_LOAD_KB 36 +FLASH_SIZE_KB 256 + +# reserve some space for params +APP_START_OFFSET_KB 4 + +# a fault LED +PA1 LED_BOOTLOADER OUTPUT LOW # amber +define HAL_LED_ON 1 + +# enable CAN support +PA11 CAN1_RX CAN1 +PA12 CAN1_TX CAN1 +PB1 GPIO_CAN1_SILENT OUTPUT PUSHPULL SPEED_LOW LOW +PB6 GPIO_CAN1_TERM OUTPUT PUSHPULL SPEED_LOW HIGH + +CAN_ORDER 1 + +# make bl baudrate match debug baudrate for easier debugging +define BOOTLOADER_BAUDRATE 57600 + +# use a small bootloader timeout +define HAL_BOOTLOADER_TIMEOUT 1000 + +define HAL_USE_SERIAL FALSE +define HAL_NO_GPIO_IRQ +define HAL_USE_EMPTY_IO TRUE +define PORT_INT_REQUIRED_STACK 64 +define DMA_RESERVE_SIZE 0 + +MAIN_STACK 0x800 +PROCESS_STACK 0x800 + +define HAL_DISABLE_LOOP_DELAY + +# debugger support +PA13 JTMS-SWDIO SWD +PA14 JTCK-SWCLK SWD + +define CAN_APP_NODE_NAME "in.sierraaerospace.TrueSpeed" diff --git a/libraries/AP_HAL_ChibiOS/hwdef/Sierra-TrueSpeed/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/Sierra-TrueSpeed/hwdef.dat new file mode 100644 index 0000000000000..9f132ff08ad4c --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/Sierra-TrueSpeed/hwdef.dat @@ -0,0 +1,109 @@ +# HW definition file for Sierra-TrueSpeed + +# MCU class and specific type +MCU STM32L431 STM32L431xx + +# bootloader starts firmware at 36k + 4k (STORAGE_FLASH) +FLASH_RESERVE_START_KB 40 +FLASH_SIZE_KB 256 + +# store parameters in pages 18 and 19 +STORAGE_FLASH_PAGE 18 +define HAL_STORAGE_SIZE 800 + +# ChibiOS system timer +STM32_ST_USE_TIMER 15 +define CH_CFG_ST_RESOLUTION 16 + +# board ID for firmware load +APJ_BOARD_ID 1094 + +# crystal frequency +OSCILLATOR_HZ 16000000 + +env AP_PERIPH 1 + +define HAL_NO_GPIO_IRQ +define SERIAL_BUFFERS_SIZE 512 +define PORT_INT_REQUIRED_STACK 64 + +define DMA_RESERVE_SIZE 0 + +# MAIN_STACK is stack for ISR handlers +MAIN_STACK 0x300 + +# PROCESS_STACK controls stack for main thread +PROCESS_STACK 0xA00 + +# save memory +define HAL_DISABLE_LOOP_DELAY +define HAL_GCS_ENABLED 0 +define HAL_NO_MONITOR_THREAD +define HAL_NO_LOGGING +define HAL_USE_ADC FALSE +define HAL_NO_RCIN_THREAD + +# we setup a small defaults.parm +define AP_PARAM_MAX_EMBEDDED_PARAM 256 + +# debugger support +PA13 JTMS-SWDIO SWD +PA14 JTCK-SWCLK SWD + +# order of I2C buses +I2C_ORDER I2C1 I2C2 + +# I2C bus for magnetometer +PB13 I2C2_SCL I2C2 +PB11 I2C2_SDA I2C2 + +# I2C bus for DLVR +PB8 I2C1_SCL I2C1 +PB9 I2C1_SDA I2C1 + +# Mag probe +COMPASS BMM150 I2C:0:0x10 false ROTATION_NONE + +# default to DLVR 10in +AIRSPEED DLVR I2C:0:0x28 10 +define HAL_AIRSPEED_BUS_DEFAULT 0 +define HAL_AIRSPEED_TYPE_DEFAULT 9 + +# ---------------------- CAN bus ------------------------- +CAN_ORDER 1 + +PA11 CAN1_RX CAN1 +PA12 CAN1_TX CAN1 +PB1 GPIO_CAN1_SILENT OUTPUT PUSHPULL SPEED_LOW LOW +PB6 GPIO_CAN1_TERM OUTPUT PUSHPULL SPEED_LOW HIGH + +define HAL_CAN_POOL_SIZE 6000 + +# allow for reboot command for faster development +define HAL_PERIPH_LISTEN_FOR_SERIAL_UART_REBOOT_CMD_PORT 0 + +# keep ROMFS uncompressed as we don't have enough RAM +# to uncompress the bootloader at runtime +env ROMFS_UNCOMPRESSED True + +# enable compass and airspeed +define HAL_PERIPH_ENABLE_MAG +define HAL_PERIPH_ENABLE_AIRSPEED +define HAL_COMPASS_MAX_SENSORS 1 +define AIRSPEED_MAX_SENSORS 1 + +# PWM, WS2812 LED +PA2 TIM2_CH3 TIM2 PWM(1) GPIO(50) +PA3 TIM2_CH4 TIM2 PWM(2) GPIO(51) + +define CAN_APP_NODE_NAME "in.sierraaerospace.TrueSpeed" + +# LEDs +PA1 LED OUTPUT LOW GPIO(1) + +# ---------------------- UARTs --------------------------- +SERIAL_ORDER USART1 + +# USART1 +PA9 USART1_TX USART1 SPEED_HIGH +PA10 USART1_RX USART1 SPEED_HIGH