From b0b99de767e51481fb2563556f3b252b87a83f14 Mon Sep 17 00:00:00 2001 From: Eric Katzfey Date: Mon, 23 Feb 2026 16:57:22 -0700 Subject: [PATCH] voxl2: Add support for the new M0197 board variant. Uses bmi270 IMU and dps310 barometer and GPS on apps proc. --- boards/modalai/voxl2-slpi/default.px4board | 2 ++ boards/modalai/voxl2-slpi/src/spi.cpp | 2 +- .../modalai/voxl2/target/voxl-px4-hitl-start | 10 ++++++++-- boards/modalai/voxl2/target/voxl-px4-start | 20 ++++++++++++++++--- src/lib/drivers/device/qurt/SPI.cpp | 6 +++++- 5 files changed, 33 insertions(+), 7 deletions(-) diff --git a/boards/modalai/voxl2-slpi/default.px4board b/boards/modalai/voxl2-slpi/default.px4board index c548eaf90c..045de27b88 100644 --- a/boards/modalai/voxl2-slpi/default.px4board +++ b/boards/modalai/voxl2-slpi/default.px4board @@ -9,7 +9,9 @@ CONFIG_DRIVERS_DIFFERENTIAL_PRESSURE_MS4525DO=y CONFIG_DRIVERS_DISTANCE_SENSOR_VL53L0X=y CONFIG_DRIVERS_DISTANCE_SENSOR_VL53L1X=y CONFIG_DRIVERS_GPS=y +CONFIG_DRIVERS_IMU_BOSCH_BMI270=y CONFIG_DRIVERS_IMU_INVENSENSE_ICM42688P=y +CONFIG_DRIVERS_BAROMETER_DPS310=y CONFIG_DRIVERS_LIGHTS_RGBLED_NCP5623C=y CONFIG_DRIVERS_MAGNETOMETER_ISENTEK_IST8308=y CONFIG_DRIVERS_MAGNETOMETER_ISENTEK_IST8310=y diff --git a/boards/modalai/voxl2-slpi/src/spi.cpp b/boards/modalai/voxl2-slpi/src/spi.cpp index cd8eea2a72..6bff3f87a0 100644 --- a/boards/modalai/voxl2-slpi/src/spi.cpp +++ b/boards/modalai/voxl2-slpi/src/spi.cpp @@ -36,5 +36,5 @@ #include constexpr px4_spi_bus_t px4_spi_buses[SPI_BUS_MAX_BUS_ITEMS] = { - initSPIBus(1, {initSPIDevice(DRV_IMU_DEVTYPE_ICM42688P), }), + initSPIBus(1, {initSPIDevice(DRV_IMU_DEVTYPE_ICM42688P), initSPIDevice(DRV_IMU_DEVTYPE_BMI270), }), }; diff --git a/boards/modalai/voxl2/target/voxl-px4-hitl-start b/boards/modalai/voxl2/target/voxl-px4-hitl-start index 3f8bcdd503..08a73bd742 100755 --- a/boards/modalai/voxl2/target/voxl-px4-hitl-start +++ b/boards/modalai/voxl2/target/voxl-px4-hitl-start @@ -17,13 +17,15 @@ if [ $RETURNCODE -ne 0 ]; then fi fi -# We can only run on M0052, M0054, or M0104 so exit with error if that is not the case +# We can only run on M0052, M0054, M0104, or M0197 so exit with error if that is not the case if [ $PLATFORM = "M0052" ]; then /bin/echo "Running on M0052" elif [ $PLATFORM = "M0054" ]; then /bin/echo "Running on M0054" elif [ $PLATFORM = "M0104" ]; then /bin/echo "Running on M0104" +elif [ $PLATFORM = "M0197" ]; then + /bin/echo "Running on M0197" else /bin/echo "Error, cannot determine platform!" exit 0 @@ -76,7 +78,11 @@ microdds_client start -t udp -h 127.0.0.1 -p 8888 qshell pwm_out_sim start -m hil # g = gps, m = mag, o = odometry (vio), h = distance sensor, f = optic flow # qshell dsp_hitl start -g -m -o -h -f -qshell dsp_hitl start -g -m +if [ "$PLATFORM" == "M0197" ]; then + qshell dsp_hitl start -g -m -p 6 +else + qshell dsp_hitl start -g -m +fi # start the onboard fast link to connect to voxl-mavlink-server mavlink start -x -u 14556 -o 14557 -r 100000 -n lo -m onboard diff --git a/boards/modalai/voxl2/target/voxl-px4-start b/boards/modalai/voxl2/target/voxl-px4-start index aadb8ae1cc..9d31466b56 100755 --- a/boards/modalai/voxl2/target/voxl-px4-start +++ b/boards/modalai/voxl2/target/voxl-px4-start @@ -40,13 +40,15 @@ if [ $RETURNCODE -ne 0 ]; then fi fi -# We can only run on M0052, M0054, or M0104 so exit with error if that is not the case +# We can only run on M0052, M0054, M0104, or M0197 so exit with error if that is not the case if [ $PLATFORM = "M0052" ]; then /bin/echo "Running on M0052" elif [ $PLATFORM = "M0054" ]; then /bin/echo "Running on M0054" elif [ $PLATFORM = "M0104" ]; then /bin/echo "Running on M0104" +elif [ $PLATFORM = "M0197" ]; then + /bin/echo "Running on M0197" else /bin/echo "Error, cannot determine platform!" exit 0 @@ -77,13 +79,22 @@ param load if [ "$PLATFORM" == "M0104" ]; then /bin/echo "Starting IMU driver with rotation 12" qshell icm42688p start -s -R 12 -C 32768 +elif [ "$PLATFORM" == "M0197" ]; then + /bin/echo "Starting bmi270 IMU driver with rotation 26" + qshell bmi270 start -s -R 26 else /bin/echo "Starting IMU driver with no rotation" qshell icm42688p start -s -C 32768 fi -# Start Invensense ICP 101xx barometer built on to VOXL 2 -qshell icp101xx start -I -b 5 +# Start onboard barometer +if [ "$PLATFORM" == "M0197" ]; then + /bin/echo "Starting dps368 barometer on M0197" + qshell dps310 start -I -b 5 +else + # Start Invensense ICP 101xx barometer built on to VOXL 2 + qshell icp101xx start -I -b 5 +fi # Auto detect the magnetometer. If one or both of these devices # are not connected it will fail but not cause any harm. @@ -97,6 +108,9 @@ if [ "$GPS" != "NONE" ]; then # On M0052 the GPS driver runs on the apps processor if [ $PLATFORM = "M0052" ]; then gps start -d /dev/ttyHS2 + # On M0197 the GPS driver runs on the apps processor + elif [ $PLATFORM = "M0197" ]; then + gps start -d /dev/ttyHS7 # On M0054 and M0104 the GPS driver runs on SLPI DSP else qshell gps start -d 6 diff --git a/src/lib/drivers/device/qurt/SPI.cpp b/src/lib/drivers/device/qurt/SPI.cpp index 66ebb26dd6..8e040ec227 100644 --- a/src/lib/drivers/device/qurt/SPI.cpp +++ b/src/lib/drivers/device/qurt/SPI.cpp @@ -157,7 +157,11 @@ SPI::transfer(uint8_t *send, uint8_t *recv, unsigned len) if (_spi_transfer != NULL) { pthread_mutex_lock(&_mutex); - ret = _spi_transfer(_fd, send, recv, len); + + if (recv) { ret = _spi_transfer(_fd, send, recv, len); } + + else { ret = _spi_transfer(_fd, send, send, len); } + pthread_mutex_unlock(&_mutex); } else {