Skip to content

Failure to read magnetometer from DMP FIFO #56

@bernhardHartleb

Description

@bernhardHartleb

Hello,

we really appreciate the simplification in this library over the original drivers from Invensense.
The hope was to use the DMP for 9-axis sensor fusion with Orientation output referenced to magnetic north.

Using example 6 (Quat9_Orientation) and 9 (MultipleSensors) as a basis, we get stable quaternion output. However, the heading always starts out at zero, and changes in the magnetic field do not seem to matter at all. Digging into this, it is quick to see that there are issues reading the magnetic sensor. If true, this might also explain some other issues posted here.

Steps to reproduce:

  • Get the Multi Sensor example 9 to work
  • Verify now other hardware or communication issues are present
  • Avoid strong magnetic fields nearby which would saturate the magnetometer
  • Make the following changes to example 9:
  1. Change enableDMPSensor from GAME_ROTATION_VECTOR to ORIENTATION (optional)
  2. Enable setDMPODRrate(DMP_ODR_Reg_Cpass, 0)
  3. Comment out all other setDMPODRrate calls (optional)

What we would expect is to receive valid magnetometer readings at 55Hz.
The magnetometer was configured to 100Hz continuous mode previously.
I do not know how the sample rate for the external I2C slave (magnetometer) is configured in the DMP.

The actual output is the following:

Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x -677.00  y -256.00  z -103.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x -661.00  y -256.00  z -107.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x -665.00  y -256.00  z -111.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00
Compass:  x 32767.00  y 32767.00  z 32767.00

There are occasional valid readings in the output, but most values are invalid.
Readings that are not 32767 change with the sensor orientation and seem to be the actual magnetic field.

No matter what other options I changed, the DMP keeps posting mostly invalid magnetometer data into the FIFO.
If this is the same data the DMP uses for 9-axis fusion, it is clear why magnetometer is not used in the Quat9 result.
So far, I did not manage to find a different library to cross-reference a possible configuration error.

Please advise if you can reproduce this behaviour.
Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions