# MPU9250 magnetometer values freeze after some time

Setup:

I am working on a system where multiple MPU9250 IMUs (6, to be specific) are connected to an ESP32 MCU via SPI. Using SPI as the communication bus is crucial because the I2C pins are occupied. If it's relevant, 3 sensors are connected to VSPI and other 3 sensors to HSPI.

I am using Arduino core on ESP32 with this library to communicate with MPU9250 through SPI.

Problem:

The Mag values (almost always) freeze for multiple sensors after a while. The sketch follows the initialization sequence given in the example Basic_SPI from the examples directory in the repo.

To add to the confusion, freezing of the mag values is not deterministic (sometimes, some mags freeze after a few seconds, some after a minute and so on - and it all varies between different runs), proving it very hard to detect what is going on. I have tried keeping every sensor steady (i.e. without any motion, so that the physical connections between MCU and IMUs remain stable), but the problem persists. Also - Accel and Gyro continue to give the data as expected (their values don't freeze even if corresponding mag values freeze), so the SPI connection between the MCU and IMUs might not be an issue.

Can you please provide some pointers as to how should I try debugging this behavior of the sensors?

• use only one MPU9250 IMU .... see what happens – jsotola Jun 9 at 6:29