From 216b59329fd74c0192b7527a461be5d25dececa0 Mon Sep 17 00:00:00 2001 From: Jacob Dahl <37091262+dakejahl@users.noreply.github.com> Date: Thu, 20 Aug 2026 20:23:38 -0600 Subject: [PATCH] fix(drivers/icm45686): retry WHO_AM_I on probe instead of requiring three matches (#28319) The loop advertised three attempts but returned on the first mismatch, so a single garbage SPI read after power-up failed the probe. Match the ICM42688P retry: succeed on the first good ID, fail after three. Assisted-by: Grok:grok-4.6 Signed-off-by: Jacob Dahl (cherry picked from commit a0071377f12bac1e671457087233d5e648e4c1ba) --- src/drivers/imu/invensense/icm45686/ICM45686.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/drivers/imu/invensense/icm45686/ICM45686.cpp b/src/drivers/imu/invensense/icm45686/ICM45686.cpp index 1bd2a128345..99d08b0729e 100644 --- a/src/drivers/imu/invensense/icm45686/ICM45686.cpp +++ b/src/drivers/imu/invensense/icm45686/ICM45686.cpp @@ -135,13 +135,14 @@ int ICM45686::probe() for (int i = 0; i < 3; i++) { const uint8_t whoami = RegisterRead(Register::BANK_0::WHO_AM_I); - if (whoami != WHOAMI) { - DEVICE_DEBUG("unexpected WHO_AM_I 0x%02x", whoami); - return PX4_ERROR; + if (whoami == WHOAMI) { + return PX4_OK; } + + DEVICE_DEBUG("unexpected WHO_AM_I 0x%02x", whoami); } - return PX4_OK; + return PX4_ERROR; } void ICM45686::RunImpl()