From f6fd9f9ae1bb3ae081d0d8035ea0a908d8d00f63 Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Wed, 15 Nov 2023 09:57:29 -0800 Subject: [PATCH] px4_fmuv6xrt::Support base version selection --- boards/px4/fmu-v6xrt/src/board_config.h | 6 ++- boards/px4/fmu-v6xrt/src/manifest.c | 34 +++++++++++-- boards/px4/fmu-v6xrt/src/spi.cpp | 67 ++++++++++++------------- platforms/nuttx/NuttX/nuttx | 2 +- 4 files changed, 70 insertions(+), 39 deletions(-) diff --git a/boards/px4/fmu-v6xrt/src/board_config.h b/boards/px4/fmu-v6xrt/src/board_config.h index 82b7e4b2e0..f195ba01fc 100644 --- a/boards/px4/fmu-v6xrt/src/board_config.h +++ b/boards/px4/fmu-v6xrt/src/board_config.h @@ -296,7 +296,11 @@ #define GPIO_HW_REV_SENSE /* GPIO_AD_22 GPIO9 Pin 21 */ ADC_GPIO(4, 21) #define GPIO_HW_VER_SENSE /* GPIO_AD_23 GPIO9 Pin 22 */ ADC_GPIO(5, 22) #define HW_INFO_INIT_PREFIX "V6XRT" -#define V6XRT_00 HW_VER_REV(0x0,0x0) // First Release + +#define BOARD_NUM_SPI_CFG_HW_VERSIONS 2 // Rev 0 on HB Base and T1 Pase +// Base/FMUM +#define V6XRT00 HW_VER_REV(0x0,0x0) // First Release +#define V6XRT30 HW_VER_REV(0x3,0x0) // T1 Base w/o PX4IO #define BOARD_I2C_LATEINIT 1 /* See Note about SE550 Eanable */ diff --git a/boards/px4/fmu-v6xrt/src/manifest.c b/boards/px4/fmu-v6xrt/src/manifest.c index 6b1a2a1695..da5726feee 100644 --- a/boards/px4/fmu-v6xrt/src/manifest.c +++ b/boards/px4/fmu-v6xrt/src/manifest.c @@ -98,8 +98,36 @@ static const px4_hw_mft_item_t hw_mft_list_V00[] = { }, }; +static const px4_hw_mft_item_t hw_mft_list_V30[] = { + { + // PX4_MFT_PX4IO + .present = 0, + .mandatory = 0, + .connection = px4_hw_con_unknown, + }, + { + // PX4_MFT_USB + .present = 1, + .mandatory = 1, + .connection = px4_hw_con_onboard, + }, + { + // PX4_MFT_CAN2 + .present = 1, + .mandatory = 1, + .connection = px4_hw_con_onboard, + }, + { + // PX4_MFT_CAN3 + .present = 1, + .mandatory = 1, + .connection = px4_hw_con_onboard, + }, +}; + static px4_hw_mft_list_entry_t mft_lists[] = { - {V6XRT_00, hw_mft_list_V00, arraySize(hw_mft_list_V00)}, + {V6XRT00, hw_mft_list_V00, arraySize(hw_mft_list_V00)}, + {V6XRT30, hw_mft_list_V30, arraySize(hw_mft_list_V30)}, }; /************************************************************************************ @@ -122,7 +150,7 @@ __EXPORT px4_hw_mft_item board_query_manifest(px4_hw_mft_item_id_t id) static px4_hw_mft_list_entry boards_manifest = px4_hw_mft_list_uninitialized; if (boards_manifest == px4_hw_mft_list_uninitialized) { - uint32_t ver_rev = board_get_hw_version() << 8; + uint32_t ver_rev = board_get_hw_version() << 16; ver_rev |= board_get_hw_revision(); for (unsigned i = 0; i < arraySize(mft_lists); i++) { @@ -133,7 +161,7 @@ __EXPORT px4_hw_mft_item board_query_manifest(px4_hw_mft_item_id_t id) } if (boards_manifest == px4_hw_mft_list_uninitialized) { - PX4_ERR("Board %4" PRIx32 " is not supported!", ver_rev); + syslog(LOG_ERR, "[boot] Board %08" PRIx32 " is not supported!\n", ver_rev); } } diff --git a/boards/px4/fmu-v6xrt/src/spi.cpp b/boards/px4/fmu-v6xrt/src/spi.cpp index 16c3e2822d..5dfd14ec7e 100644 --- a/boards/px4/fmu-v6xrt/src/spi.cpp +++ b/boards/px4/fmu-v6xrt/src/spi.cpp @@ -41,47 +41,46 @@ #include #include -#include -#include +constexpr px4_spi_bus_all_hw_t px4_spi_buses_all_hw[BOARD_NUM_SPI_CFG_HW_VERSIONS] = { + initSPIHWVersion(V6XRT00, { + initSPIBus(SPI::Bus::LPSPI1, { + initSPIDevice(DRV_IMU_DEVTYPE_ICM42688P, SPI::CS{GPIO::Port2, GPIO::Pin11}, SPI::DRDY{GPIO::Port3, GPIO::Pin19}), /* GPIO_EMC_B2_01 GPIO2_IO11, GPIO_AD_20, GPIO3_IO19 */ + }, {GPIO::Port2, GPIO::Pin1}), // Power GPIO_EMC_B1_33 GPIO2_IO01 -#include -#include -#include + initSPIBus(SPI::Bus::LPSPI2, { + initSPIDevice(DRV_IMU_DEVTYPE_ICM42688P, SPI::CS{GPIO::Port3, GPIO::Pin24}, SPI::DRDY{GPIO::Port2, GPIO::Pin7}), /* GPIO_AD_25 GPIO3_IO24, GPIO_EMC_B1_39 GPIO2_IO07 */ + }, {GPIO::Port1, GPIO::Pin22}), // Power GPIO_EMC_B1_22 GPIO1_IO22 -#include -#include -#include -#include + initSPIBus(SPI::Bus::LPSPI3, { + initSPIDevice(DRV_GYR_DEVTYPE_BMI088, SPI::CS{GPIO::Port2, GPIO::Pin18}, SPI::DRDY{GPIO::Port2, GPIO::Pin28}), /* GPIO_EMC_B2_08 GPIO2_IO18, GPIO_EMC_B2_18 GPIO2_IO28 */ + initSPIDevice(DRV_ACC_DEVTYPE_BMI088, SPI::CS{GPIO::Port2, GPIO::Pin15}), /* GPIO_EMC_B2_05 GPIO2_IO15 */ + }, {GPIO::Port1, GPIO::Pin14}), // Power GPIO_EMC_B1_14 GPIO1_IO14 -#include -#include -#include "imxrt_lpspi.h" -#include "imxrt_gpio.h" -#include "board_config.h" -#include + initSPIBusExternal(SPI::Bus::LPSPI6, { + initSPIConfigExternal(SPI::CS{GPIO::Port6, GPIO::Pin9}, SPI::DRDY{GPIO::Port1, GPIO::Pin5}), /* GPIO_LPSR_09 GPIO6_IO09 GPIO_EMC_B1_05 GPIO1_IO05*/ + initSPIConfigExternal(SPI::CS{GPIO::Port6, GPIO::Pin8}, SPI::DRDY{GPIO::Port1, GPIO::Pin7}), /* GPIO_LPSR_08 GPIO6_IO08 GPIO_EMC_B1_07 GPIO1_IO07*/ + }), + }), -#ifdef CONFIG_IMXRT_LPSPI + initSPIHWVersion(V6XRT30, { + initSPIBus(SPI::Bus::LPSPI1, { + initSPIDevice(DRV_IMU_DEVTYPE_ICM42688P, SPI::CS{GPIO::Port2, GPIO::Pin11}, SPI::DRDY{GPIO::Port3, GPIO::Pin19}), /* GPIO_EMC_B2_01 GPIO2_IO11, GPIO_AD_20, GPIO3_IO19 */ + }, {GPIO::Port2, GPIO::Pin1}), // Power GPIO_EMC_B1_33 GPIO2_IO01 + initSPIBus(SPI::Bus::LPSPI2, { + initSPIDevice(DRV_IMU_DEVTYPE_ICM42688P, SPI::CS{GPIO::Port3, GPIO::Pin24}, SPI::DRDY{GPIO::Port2, GPIO::Pin7}), /* GPIO_AD_25 GPIO3_IO24, GPIO_EMC_B1_39 GPIO2_IO07 */ + }, {GPIO::Port1, GPIO::Pin22}), // Power GPIO_EMC_B1_22 GPIO1_IO22 -constexpr px4_spi_bus_t px4_spi_buses[SPI_BUS_MAX_BUS_ITEMS] = { - initSPIBus(SPI::Bus::LPSPI1, { - initSPIDevice(DRV_IMU_DEVTYPE_ICM42686P, SPI::CS{GPIO::Port2, GPIO::Pin11}, SPI::DRDY{GPIO::Port3, GPIO::Pin19}), /* GPIO_EMC_B2_01 GPIO2_IO11, GPIO_AD_20, GPIO3_IO19 */ - }, {GPIO::Port2, GPIO::Pin1}), // Power GPIO_EMC_B1_33 GPIO2_IO01 + initSPIBus(SPI::Bus::LPSPI3, { + initSPIDevice(DRV_GYR_DEVTYPE_BMI088, SPI::CS{GPIO::Port2, GPIO::Pin18}, SPI::DRDY{GPIO::Port2, GPIO::Pin28}), /* GPIO_EMC_B2_08 GPIO2_IO18, GPIO_EMC_B2_18 GPIO2_IO28 */ + initSPIDevice(DRV_ACC_DEVTYPE_BMI088, SPI::CS{GPIO::Port2, GPIO::Pin15}), /* GPIO_EMC_B2_05 GPIO2_IO15 */ + }, {GPIO::Port1, GPIO::Pin14}), // Power GPIO_EMC_B1_14 GPIO1_IO14 - initSPIBus(SPI::Bus::LPSPI2, { - initSPIDevice(DRV_IMU_DEVTYPE_ICM42688P, SPI::CS{GPIO::Port3, GPIO::Pin24}, SPI::DRDY{GPIO::Port2, GPIO::Pin7}), /* GPIO_AD_25 GPIO3_IO24, GPIO_EMC_B1_39 GPIO2_IO07 */ - }, {GPIO::Port1, GPIO::Pin22}), // Power GPIO_EMC_B1_22 GPIO1_IO22 - - initSPIBus(SPI::Bus::LPSPI3, { - initSPIDevice(DRV_GYR_DEVTYPE_BMI088, SPI::CS{GPIO::Port2, GPIO::Pin18}, SPI::DRDY{GPIO::Port2, GPIO::Pin28}), /* GPIO_EMC_B2_08 GPIO2_IO18, GPIO_EMC_B2_18 GPIO2_IO28 */ - initSPIDevice(DRV_ACC_DEVTYPE_BMI088, SPI::CS{GPIO::Port2, GPIO::Pin15}), /* GPIO_EMC_B2_05 GPIO2_IO15 */ - }, {GPIO::Port1, GPIO::Pin14}), // Power GPIO_EMC_B1_14 GPIO1_IO14 - - initSPIBusExternal(SPI::Bus::LPSPI6, { - initSPIConfigExternal(SPI::CS{GPIO::Port6, GPIO::Pin9}, SPI::DRDY{GPIO::Port1, GPIO::Pin5}), /* GPIO_LPSR_09 GPIO6_IO09 GPIO_EMC_B1_05 GPIO1_IO05*/ - initSPIConfigExternal(SPI::CS{GPIO::Port6, GPIO::Pin8}, SPI::DRDY{GPIO::Port1, GPIO::Pin7}), /* GPIO_LPSR_08 GPIO6_IO08 GPIO_EMC_B1_07 GPIO1_IO07*/ + initSPIBusExternal(SPI::Bus::LPSPI6, { + initSPIConfigExternal(SPI::CS{GPIO::Port6, GPIO::Pin9}, SPI::DRDY{GPIO::Port1, GPIO::Pin5}), /* GPIO_LPSR_09 GPIO6_IO09 GPIO_EMC_B1_05 GPIO1_IO05*/ + initSPIConfigExternal(SPI::CS{GPIO::Port6, GPIO::Pin8}, SPI::DRDY{GPIO::Port1, GPIO::Pin7}), /* GPIO_LPSR_08 GPIO6_IO08 GPIO_EMC_B1_07 GPIO1_IO07*/ + }), }), }; -#endif -static constexpr bool unused = validateSPIConfig(px4_spi_buses); +static constexpr bool unused = validateSPIConfig(px4_spi_buses_all_hw); diff --git a/platforms/nuttx/NuttX/nuttx b/platforms/nuttx/NuttX/nuttx index 1e3aaefc60..d334460ad0 160000 --- a/platforms/nuttx/NuttX/nuttx +++ b/platforms/nuttx/NuttX/nuttx @@ -1 +1 @@ -Subproject commit 1e3aaefc60a18838dc696e8f0f335d8c989f35cc +Subproject commit d334460ad0d1fe77b4237f0ea3d8a9c8c497eb0b