LSM303AGR Magnetometer Self-Test Fails on Z-Axis
I'm using the LSM303AGR magnetometer with an STM32L4 via I2C + HAL. The built-in self-test works fine for X and Y, but Z-axis always fails — the delta (self-test vs. normal) is out of range.
Set Up
STM32L4, I2C, HAL drivers
Magnetometer config: 50 Hz, continuous mode
Self-test enabled via CFG_REG_C_M (0x62) = 0x12
50 samples averaged before/after self-test
Delays: 200ms (pre), 500ms (post self-test)
Problem
X/Y deltas: within 100–1000 LSB range → pass
Z delta: often too low or too high → fail
Question
Are 100–1000 LSB valid self-test limits for Z?
Is 500ms delay enough after enabling self-test?
Do I need to read output registers in burst mode for sync?
Any known Z-axis issues in continuous mode?
Any advice or working examples appreciated!
