From 8923183911526d51ec0eec8148f2d009ac15c724 Mon Sep 17 00:00:00 2001 From: Jacob Dahl <37091262+dakejahl@users.noreply.github.com> Date: Fri, 28 Aug 2026 19:10:19 -0600 Subject: [PATCH] fix(ark): pin the primary IMU on fmu-v6x and pi6x (#28444) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(ark/fmu-v6x): pin the bus-1 IMU as the primary The three IMUs run at equal voter priority, so the sensor voter selects the primary by whichever validates first at boot and keeps it — a non-deterministic race. Seed the intended IMU's calibration slot (per hwtype: IIM-42652 on ARKV6X000, IIM-42653 on ARKV6X001, both on SPI1, already the heater's regulated sensor) with a higher priority so selection is deterministic; the voter still fails over to the other IMUs if it degrades. param set-default is shadowed by a stored calibration, so this takes effect on a fresh flash calibrated afterwards; an already-calibrated board keeps its stored priority until the params are reset. Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Jacob Dahl * fix(ark/pi6x): pin the SPI1 IMU as the primary Same equal-priority voter race as fmu-v6x: two ICM-42688-P run at equal priority, so the primary is decided by a boot race. Seed the SPI1 IMU's calibration slot (already the heater's regulated sensor) with a higher priority so selection is deterministic, with fallback to the SPI2 IMU on degradation. Replaces the placeholder TODO on HEATER1_SENS_ID, whose id is the running SPI1 device. Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Jacob Dahl --------- Signed-off-by: Jacob Dahl (cherry picked from commit 3826a2a7063333f18aef3830d915d6dfc9f0011c) --- boards/ark/fmu-v6x/init/rc.board_defaults | 13 +++++++++++++ boards/ark/pi6x/init/rc.board_defaults | 9 ++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/boards/ark/fmu-v6x/init/rc.board_defaults b/boards/ark/fmu-v6x/init/rc.board_defaults index 2c45677a6fc..ec370afa97b 100644 --- a/boards/ark/fmu-v6x/init/rc.board_defaults +++ b/boards/ark/fmu-v6x/init/rc.board_defaults @@ -26,11 +26,24 @@ param set-default UAVCAN_ESC_IFACE 2 if ver hwtypecmp ARKV6X000 then + # IIM-42652 on SPI1 is the primary IMU: seed its calibration slot with a + # higher voter priority so selection is deterministic rather than a boot + # race between the three equal-priority IMUs, falling back to the others + # only if it degrades. The heater regulates on it too. + param set-default CAL_ACC0_ID 2818058 + param set-default CAL_GYRO0_ID 2818058 + param set-default CAL_ACC0_PRIO 100 + param set-default CAL_GYRO0_PRIO 100 param set-default HEATER1_SENS_ID 2818058 fi if ver hwtypecmp ARKV6X001 then + # IIM-42653 on SPI1 is the primary IMU (see ARKV6X000 above). + param set-default CAL_ACC0_ID 3014666 + param set-default CAL_GYRO0_ID 3014666 + param set-default CAL_ACC0_PRIO 100 + param set-default CAL_GYRO0_PRIO 100 param set-default HEATER1_SENS_ID 3014666 fi diff --git a/boards/ark/pi6x/init/rc.board_defaults b/boards/ark/pi6x/init/rc.board_defaults index 30109972124..7b264629237 100644 --- a/boards/ark/pi6x/init/rc.board_defaults +++ b/boards/ark/pi6x/init/rc.board_defaults @@ -30,7 +30,14 @@ param set-default UAVCAN_ESC_IFACE 1 if ver hwtypecmp ARKPI6X000 then - # TODO: Add the correct sensor ID + # ICM-42688-P on SPI1 is the primary IMU: seed its calibration slot with a + # higher voter priority so selection is deterministic rather than a boot + # race between the two equal-priority IMUs, falling back to the SPI2 + # ICM-42688-P only if it degrades. The heater regulates on it too. + param set-default CAL_ACC0_ID 2490378 + param set-default CAL_GYRO0_ID 2490378 + param set-default CAL_ACC0_PRIO 100 + param set-default CAL_GYRO0_PRIO 100 param set-default HEATER1_SENS_ID 2490378 fi