fix: IMU calibration (Issue #520) #530
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "sl-firmware/issue-520-imu-calibration"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
icm42688_init()used a single WHO_AM_I read — one SPI glitch returning0x00causedret=-128, skippingmpu6000_calibrate()entirely →s_calibratednever set totrue. Fix: retry up to 3× with 10ms gaps.rx[15]inicm42688_read()was uninitialized. IfHAL_SPI_TransmitReceive()timed out, garbage stack data was accumulated as gyro bias. Fix: zero-init.rawin calibration loop was uninitialized (UB ificm42688_read()no-ops). Fix: zero-init each iteration.SCB_InvalidateDCache_by_Addr()on SPI rx buffers inrreg()andicm42688_read(). Currently a no-op (DCache disabled), but required ifSCB_EnableDCache()is ever called — stack buffers in SRAM2 are in the cacheable region on STM32F7.Test plan
mpu6000_is_calibrated()returns true after bootAcommand or RC CH5 — should succeed within 3s holdicm42688_get_trace()) showstrace[0]=0x68(WHO_AM_I) and correct imu_typeBuild: Flash 59904B (+512B) / RAM 17100B — SUCCESS ✓
🤖 Generated with Claude Code