From 100d257c91f81f5d4e9bf55e4a507a04fb449b8d Mon Sep 17 00:00:00 2001 From: Holybro-Zebulon Date: Sun, 8 Nov 2026 18:54:21 -0800 Subject: [PATCH] feat(boards/px4_fmu-v6x): add LSM6DSV fallback support (#29697) Probe ICM45686 and IIM42653 first on V6X008 and start LSM6DSV only when neither is detected, preserving existing IMU priority. Assisted-by: Codex Signed-off-by: Brown Co-authored-by: Farhang <46557204+farhangnaderi@users.noreply.github.com> --- boards/px4/fmu-v6x/default.px4board | 1 + boards/px4/fmu-v6x/init/rc.board_sensors | 23 ++++++++++++++++------- boards/px4/fmu-v6x/src/spi.cpp | 3 +++ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/boards/px4/fmu-v6x/default.px4board b/boards/px4/fmu-v6x/default.px4board index d73d2631731..873ec506194 100644 --- a/boards/px4/fmu-v6x/default.px4board +++ b/boards/px4/fmu-v6x/default.px4board @@ -30,6 +30,7 @@ CONFIG_DRIVERS_IMU_INVENSENSE_ICM42688P=y CONFIG_DRIVERS_IMU_INVENSENSE_ICM45686=y CONFIG_DRIVERS_IMU_INVENSENSE_IIM42652=y CONFIG_DRIVERS_IMU_INVENSENSE_IIM42653=y +CONFIG_DRIVERS_IMU_ST_LSM6DSV=y CONFIG_COMMON_LIGHT=y CONFIG_COMMON_MAGNETOMETER=y CONFIG_DRIVERS_OSD_MSP_OSD=y diff --git a/boards/px4/fmu-v6x/init/rc.board_sensors b/boards/px4/fmu-v6x/init/rc.board_sensors index 5a072786102..3045d5e5181 100644 --- a/boards/px4/fmu-v6x/init/rc.board_sensors +++ b/boards/px4/fmu-v6x/init/rc.board_sensors @@ -75,18 +75,27 @@ then iim42652 -s -R 6 start icm45686 -s -R 10 start else - # Internal SPI bus 3x ICM45686 or 3x IIM42653 - if ! icm45686 -b 3 -s -R 0 start + # Internal SPI bus 3x ICM45686, IIM42653, or LSM6DSV + if ! icm45686 -b 3 -s -R 0 -q start then - iim42653 -b 3 -s -R 0 start + if ! iim42653 -b 3 -s -R 0 -q start + then + lsm6dsv -b 3 -s -R 0 start + fi fi - if ! icm45686 -b 2 -s -R 0 start + if ! icm45686 -b 2 -s -R 0 -q start then - iim42653 -b 2 -s -R 0 start + if ! iim42653 -b 2 -s -R 0 -q start + then + lsm6dsv -b 2 -s -R 0 start + fi fi - if ! icm45686 -b 1 -s -R 10 start + if ! icm45686 -b 1 -s -R 10 -q start then - iim42653 -b 1 -s -R 10 start + if ! iim42653 -b 1 -s -R 10 -q start + then + lsm6dsv -b 1 -s -R 10 start + fi fi fi else diff --git a/boards/px4/fmu-v6x/src/spi.cpp b/boards/px4/fmu-v6x/src/spi.cpp index 1a1498d160b..19f3af22eeb 100644 --- a/boards/px4/fmu-v6x/src/spi.cpp +++ b/boards/px4/fmu-v6x/src/spi.cpp @@ -158,14 +158,17 @@ constexpr px4_spi_bus_all_hw_t px4_spi_buses_all_hw[BOARD_NUM_SPI_CFG_HW_VERSION initSPIBus(SPI::Bus::SPI1, { initSPIDevice(DRV_IMU_DEVTYPE_ICM45686, SPI::CS{GPIO::PortI, GPIO::Pin9}, SPI::DRDY{GPIO::PortF, GPIO::Pin2}), initSPIDevice(DRV_IMU_DEVTYPE_IIM42653, SPI::CS{GPIO::PortI, GPIO::Pin9}, SPI::DRDY{GPIO::PortF, GPIO::Pin2}), + initSPIDevice(DRV_IMU_DEVTYPE_ST_LSM6DSV, SPI::CS{GPIO::PortI, GPIO::Pin9}, SPI::DRDY{GPIO::PortF, GPIO::Pin2}), }, {GPIO::PortI, GPIO::Pin11}), initSPIBus(SPI::Bus::SPI2, { initSPIDevice(DRV_IMU_DEVTYPE_ICM45686, SPI::CS{GPIO::PortH, GPIO::Pin5}, SPI::DRDY{GPIO::PortA, GPIO::Pin10}), initSPIDevice(DRV_IMU_DEVTYPE_IIM42653, SPI::CS{GPIO::PortH, GPIO::Pin5}, SPI::DRDY{GPIO::PortA, GPIO::Pin10}), + initSPIDevice(DRV_IMU_DEVTYPE_ST_LSM6DSV, SPI::CS{GPIO::PortH, GPIO::Pin5}, SPI::DRDY{GPIO::PortA, GPIO::Pin10}), }, {GPIO::PortF, GPIO::Pin4}), initSPIBus(SPI::Bus::SPI3, { initSPIDevice(DRV_IMU_DEVTYPE_ICM45686, SPI::CS{GPIO::PortI, GPIO::Pin4}, SPI::DRDY{GPIO::PortI, GPIO::Pin7}), initSPIDevice(DRV_IMU_DEVTYPE_IIM42653, SPI::CS{GPIO::PortI, GPIO::Pin4}, SPI::DRDY{GPIO::PortI, GPIO::Pin7}), + initSPIDevice(DRV_IMU_DEVTYPE_ST_LSM6DSV, SPI::CS{GPIO::PortI, GPIO::Pin4}, SPI::DRDY{GPIO::PortI, GPIO::Pin7}), }, {GPIO::PortE, GPIO::Pin7}), // initSPIBus(SPI::Bus::SPI4, { // // no devices