bolderflight / invensense-imu

Arduino and CMake library for communicating with the InvenSense MPU-6500, MPU-9250 and MPU-9255 nine-axis IMUs.
MIT License
497 stars 210 forks source link

MPU9250 Mag always zero with WakeupOnMotion enabled #81

Closed erberj closed 3 years ago

erberj commented 3 years ago

Hi, wenn enabling IMU.enableWakeOnMotion(40.0,MPU9250::LP_ACCEL_ODR_7_81HZ);

delay(1000); IMU.readSensor(); delay(1000); imx = IMU.getMagX_uT(); imy = IMU.getMagY_uT(); imz = IMU.getMagZ_uT();

returns zero for all values. Even before the MCU MCU Atmel 8-bit AVR: ATMega328P-AU (32Kb Flash/2Kb RAM) goes into sleep the first time. What coud go wrong? If I define an interrupt without the wake part, it works fine. The MPU is connected via I2C

The values for accel and gyro are returned normaly

A question in the same context: // AK8963 registers

const uint8_t AK8963_CNT_MEAS1 = 0x12;
const uint8_t AK8963_CNT_MEAS2 = 0x16;

are those values correct or should'nt they bei 0x02 and 0x06?

Best Regards

zcsrf commented 3 years ago

Hi,

When you set the enableWakeOnMotion, the Gyro and Magnetic sensor are disabled. You can check the function for better understanding of what is does.

Only do the enable of WoM before going to sleep.

flybrianfly commented 3 years ago

WoM is no longer supported.