From dcfd9f65869c6f614b44e42f7fa9668e71f836ec Mon Sep 17 00:00:00 2001 From: Michael du Breuil Date: Mon, 11 Sep 2023 14:50:49 -0700 Subject: [PATCH] AP_HAL_ChibiOS: Add sw-nav-f405 target Navlight board with a compass, requires #24945 for status light to work --- .../hwdef/sw-nav-f405/hwdef-bl.dat | 38 +++++++++ .../hwdef/sw-nav-f405/hwdef.dat | 83 +++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 libraries/AP_HAL_ChibiOS/hwdef/sw-nav-f405/hwdef-bl.dat create mode 100644 libraries/AP_HAL_ChibiOS/hwdef/sw-nav-f405/hwdef.dat diff --git a/libraries/AP_HAL_ChibiOS/hwdef/sw-nav-f405/hwdef-bl.dat b/libraries/AP_HAL_ChibiOS/hwdef/sw-nav-f405/hwdef-bl.dat new file mode 100644 index 0000000000..069792922b --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/sw-nav-f405/hwdef-bl.dat @@ -0,0 +1,38 @@ +# MCU class and specific type +MCU STM32F4xx STM32F405xx + +# crystal frequency +OSCILLATOR_HZ 8000000 + +APJ_BOARD_ID 6002 + +# setup build for a peripheral firmware +env AP_PERIPH 1 + +define CAN_APP_NODE_NAME "sw-nav-f405-bl" + +FLASH_RESERVE_START_KB 0 +FLASH_SIZE_KB 1024 +FLASH_BOOTLOADER_LOAD_KB 64 + +# jtag +PA13 JTMS-SWDIO SWD +PA14 JTCK-SWCLK SWD + +# status light +PC4 LED_BOOTLOADER OUTPUT LOW GPIO(0) +define HAL_LED_ON 1 + +# strap LED/nav lights off +PA3 LED_CTRL_VIS OUTPUT LOW GPIO(1) # vis light power +PA1 LED_COLOR OUTPUT LOW GPIO(2) # red/green +PA2 LED_WHITE OUTPUT LOW GPIO(3) # white +PB0 LED_IR OUTPUT LOW GPIO(4) # IR + +# can +PA11 CAN1_RX CAN1 +PA12 CAN1_TX CAN1 +PA15 GPIO_CAN1_SILENT OUTPUT PUSHPULL SPEED_LOW LOW + +# disable serial +define HAL_USE_SERIAL FALSE diff --git a/libraries/AP_HAL_ChibiOS/hwdef/sw-nav-f405/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/sw-nav-f405/hwdef.dat new file mode 100644 index 0000000000..d4dac2c204 --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/sw-nav-f405/hwdef.dat @@ -0,0 +1,83 @@ +# hw definition file for f405 Matek CAN GPS + +# MCU class and specific type +MCU STM32F4xx STM32F405xx + +# bootloader starts firmware at 64k +FLASH_RESERVE_START_KB 64 +FLASH_SIZE_KB 1024 + +# store parameters in pages 2 and 3 +STORAGE_FLASH_PAGE 2 +define HAL_STORAGE_SIZE 15360 + +# board ID for firmware load +APJ_BOARD_ID 6002 + +define CAN_APP_NODE_NAME "sw-nav-f405" + +env AP_PERIPH 1 + +define STM32_ST_USE_TIMER 5 +define CH_CFG_ST_RESOLUTION 32 + +# crystal frequency +OSCILLATOR_HZ 8000000 + +# status light, normally disabled so as to not confuse nav light functionality +#PC4 LED OUTPUT LOW GPIO(0) +#define HAL_LED_ON 1 + +## debug +#PA13 JTMS-SWDIO SWD +#PA14 JTCK-SWCLK SWD + +# we setup a small defaults.parm +define AP_PARAM_MAX_EMBEDDED_PARAM 256 + +# keep ROMFS uncompressed although we do have the runtime ram needed +env ROMFS_UNCOMPRESSED True + +# i2c +I2C_ORDER I2C1 + +PB7 I2C1_SDA I2C1 +PB6 I2C1_SCL I2C1 + +# can +PA11 CAN1_RX CAN1 +PA12 CAN1_TX CAN1 +PA15 GPIO_CAN1_SILENT OUTPUT PUSHPULL SPEED_LOW LOW + +# disable serial +define HAL_USE_SERIAL FALSE +define HAL_NO_UARTDRIVER TRUE + +define HAL_USE_ADC FALSE + +# compass +define HAL_PERIPH_ENABLE_MAG + +COMPASS MMC3416 I2C:0:0x30 false ROTATION_NONE + +define HAL_COMPASS_MAX_SENSORS 1 + +# notify led +define HAL_PERIPH_ENABLE_NOTIFY +define HAL_PERIPH_ENABLE_RC_OUT + +define DEFAULT_NTF_LED_TYPES 131072 # discrete rgb led (1 << 17) + +define AP_NOTIFY_DISCRETE_RGB_ENABLED 1 +PA3 LED_CTRL_VIS OUTPUT HIGH GPIO(1) # vis light power +PA1 LED_COLOR OUTPUT LOW GPIO(2) # red/green +PA2 LED_WHITE OUTPUT LOW GPIO(3) # white +PB0 LED_IR OUTPUT LOW GPIO(4) # IR + +define DISCRETE_RGB_RED_PIN 3 +define DISCRETE_RGB_GREEN_PIN 2 +define DISCRETE_RGB_BLUE_PIN 4 +define DISCRETE_RGB_POLARITY true + +# don't build on firmware.ardupilot.org +AUTOBUILD_TARGETS None