From 3e2fdc7a0dc0343fc1adeada15a4ccff55d1658d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 7 Mar 2023 17:31:12 +1100 Subject: [PATCH] hwdef: added rGNSS GPS peripheral --- .../AP_HAL_ChibiOS/hwdef/rGNSS/hwdef-bl.dat | 81 ++++++++++ .../AP_HAL_ChibiOS/hwdef/rGNSS/hwdef.dat | 143 ++++++++++++++++++ 2 files changed, 224 insertions(+) create mode 100644 libraries/AP_HAL_ChibiOS/hwdef/rGNSS/hwdef-bl.dat create mode 100644 libraries/AP_HAL_ChibiOS/hwdef/rGNSS/hwdef.dat diff --git a/libraries/AP_HAL_ChibiOS/hwdef/rGNSS/hwdef-bl.dat b/libraries/AP_HAL_ChibiOS/hwdef/rGNSS/hwdef-bl.dat new file mode 100644 index 0000000000..ca478c4b61 --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/rGNSS/hwdef-bl.dat @@ -0,0 +1,81 @@ +# hw definition file for processing by chibios_pins.py + +# MCU class and specific type +MCU STM32G4xx STM32G491xx + +FLASH_RESERVE_START_KB 0 +FLASH_BOOTLOADER_LOAD_KB 32 + +# reserve some space for params +APP_START_OFFSET_KB 4 + +# 128k flash part +FLASH_SIZE_KB 256 + +# board ID for firmware load +APJ_BOARD_ID 1103 + +# setup build for a peripheral firmware +env AP_PERIPH 1 + +# debug on USART1 +STDOUT_SERIAL SD1 +STDOUT_BAUDRATE 57600 + +# crystal frequency +OSCILLATOR_HZ 16000000 + +define CH_CFG_ST_FREQUENCY 1000000 + +# order of UARTs +SERIAL_ORDER USART1 + +# blue LED +PA1 LED_BOOTLOADER OUTPUT HIGH +define HAL_LED_ON 1 + +PA0 LED_RED OUTPUT LOW +PA2 LED_GREEN OUTPUT LOW +PA3 LED_SAFETY OUTPUT LOW +PA4 VDD_3V3_SENSORS_EN OUTPUT LOW + +# USART1 +PB6 USART1_TX USART1 +PB7 USART1_RX USART1 + +# SWD debugging +PA13 JTMS-SWDIO SWD +PA14 JTCK-SWCLK SWD + +define HAL_USE_SERIAL TRUE + +define STM32_SERIAL_USE_USART1 TRUE +define STM32_SERIAL_USE_USART2 FALSE +define STM32_SERIAL_USE_USART3 FALSE + +define HAL_NO_GPIO_IRQ +define HAL_USE_EMPTY_IO TRUE + +# avoid timer and RCIN threads to save memory +define HAL_NO_TIMER_THREAD +define HAL_NO_RCIN_THREAD + +define DMA_RESERVE_SIZE 0 + +define HAL_DISABLE_LOOP_DELAY + +# enable CAN support +PA11 CAN1_RX CAN1 +PA12 CAN1_TX CAN1 +PA15 GPIO_CAN1_SILENT OUTPUT PUSHPULL SPEED_LOW LOW + +define CAN_APP_NODE_NAME "org.ardupilot.rGNSS" + +# make bl baudrate match debug baudrate for easier debugging +define BOOTLOADER_BAUDRATE 57600 + +# use a smaller bootloader timeout +define HAL_BOOTLOADER_TIMEOUT 2500 + +# Add CS pins to ensure they are high in bootloader +PB0 MAG_CS CS diff --git a/libraries/AP_HAL_ChibiOS/hwdef/rGNSS/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/rGNSS/hwdef.dat new file mode 100644 index 0000000000..17c58b673e --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/rGNSS/hwdef.dat @@ -0,0 +1,143 @@ +# hw definition file for processing by chibios_pins.py +# MCU class and specific type + +AUTOBUILD_TARGETS None + +# MCU class and specific type +MCU STM32G4xx STM32G491xx + +FLASH_RESERVE_START_KB 36 + +STORAGE_FLASH_PAGE 16 +define HAL_STORAGE_SIZE 800 + +# board ID for firmware load +APJ_BOARD_ID 1103 + +# setup build for a peripheral firmware +env AP_PERIPH 1 + +# crystal frequency +OSCILLATOR_HZ 16000000 + +define CH_CFG_ST_FREQUENCY 1000000 + +FLASH_SIZE_KB 512 + +# order of UARTs +SERIAL_ORDER USART2 + +# sensor power control +PA4 VDD_3V3_SENSORS_EN OUTPUT HIGH + +# LEDs +PA0 LED_RED OUTPUT LOW GPIO(0) +PA2 LED_GREEN OUTPUT LOW GPIO(1) +PA1 LED_BLUE OUTPUT LOW GPIO(2) +PA3 LED_SAFETY OUTPUT LOW + +define HAL_GPIO_A_LED_PIN 0 +define HAL_GPIO_B_LED_PIN 1 +define HAL_GPIO_C_LED_PIN 2 + +define HAL_GPIO_LED_ON 1 +define HAL_GPIO_LED_OFF 0 + +define HAL_HAVE_PIXRACER_LED + +# USART2, GPS +PB3 USART2_TX USART2 +PB4 USART2_RX USART2 + +# USART1, debug, disabled to save flash +#PB6 USART1_TX USART1 +#PB7 USART1_RX USART1 + +# SWD debugging +PA13 JTMS-SWDIO SWD +PA14 JTCK-SWCLK SWD + +# I2C2 bus +PA8 I2C2_SDA I2C2 +PA9 I2C2_SCL I2C2 + +define HAL_I2C_INTERNAL_MASK 1 + +# I2C buses +I2C_ORDER I2C2 + +# one SPI bus +PA5 SPI1_SCK SPI1 +PA6 SPI1_MISO SPI1 +PA7 SPI1_MOSI SPI1 + +# SPI CS +PB0 MAG_CS CS + +# GPS PPS +PA10 GPS_PPS_IN INPUT + +# SPI devices +SPIDEV rm3100 SPI1 DEVID1 MAG_CS MODE3 2*MHZ 8*MHZ + +# compass +COMPASS RM3100 SPI:rm3100 false ROTATION_NONE + +# baro +BARO BMP388 I2C:0:0x77 + +define HAL_USE_ADC FALSE +define STM32_ADC_USE_ADC1 FALSE +define HAL_DISABLE_ADC_DRIVER TRUE + +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 HAL_DISABLE_LOOP_DELAY + +# enable CAN support +PA11 CAN1_RX CAN1 +PA12 CAN1_TX CAN1 +PA15 GPIO_CAN1_SILENT OUTPUT PUSHPULL SPEED_LOW LOW + +define CAN_APP_NODE_NAME "org.ardupilot.rGNSS" + +define HAL_NO_LOGGING +define HAL_NO_MONITOR_THREAD + +define HAL_DEVICE_THREAD_STACK 768 + +# we setup a small defaults.parm +define AP_PARAM_MAX_EMBEDDED_PARAM 256 + +# 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 + +# add support for moving baseline yaw +define GPS_MOVING_BASELINE 1 + +# GPS+MAG+BARO+LEDs +define HAL_PERIPH_ENABLE_GPS +define HAL_PERIPH_ENABLE_MAG +define HAL_PERIPH_ENABLE_BARO +define HAL_PERIPH_ENABLE_NOTIFY +define HAL_PERIPH_ENABLE_RC_OUT + +# single baro +define BARO_MAX_INSTANCES 1 + +# GPS on 1st port +define HAL_PERIPH_GPS_PORT_DEFAULT 0 + +# keep ROMFS uncompressed as we don't have enough RAM +# to uncompress the bootloader at runtime +env ROMFS_UNCOMPRESSED True