I am interfacing to the Invensense ICM-20948 9-DOF IMU chip using an ESP8266, and a 1.8V level shifter & regulator, which works fine.
I am trying to get quaternions from the internal DMP using full 9-axis sensor fusion, as according to the datasheet the ICM has an
AK09916 magnetometer on board, which should allow for drift-free rotations.
The "library" for that chip I am using is an ESP8266-adjusted version of this one from GitHub, however the relevant code in there is actually from Invensense's official code.
The problem that I am facing is, that I cannot get the ICM to work with its own internal magnetometer.
I tried every magnetometer option that the library has to offer, as well as all official I²C addresses of the magnetometer, but every time the Invensense library returns an error when trying to init the compass and the mag data is always 32767 on all axis, so no valid data. Reading the gyro and accelerometer, as well as quaternions using the DMP and 6-axis fusion works.
Has anyone worked with the ICM before, and knows why this happens, and what I could try to troubleshoot this further?
I have also ran an I²C scanner, and I found two devices, one on 0x68 (the IMU chip) and one on 0xE8 (Don't know what that is). I tried 0xE8 as the magnetometer address for the ICM, but still get that same error.
Any help is much appreciated.
Update 1: I've changed from 0x68 to 0x69 by pulling AD0 HIGH, and now it detects the mag but it's stuck at "[4915.049805,-4915.049805,-4915.049805]"