ICM-20948 DMP B2S Matrix Has No Effect on Quaternion Output

Hi everyone,

I’m using the SparkFun ICM-20948 library to read quaternions from the DMP and convert them into Euler angles. Since I want to support flexible sensor mounting orientations, I’m trying to modify the rotation matrix by writing to the B2S_MTX_00 ~ B2S_MTX_22 registers.

I’m following the example from Example10_DMP_FastMultipleSensors, using code like this:
const unsigned char b2sMountMultiplierZero[4] = {0x00, 0x00, 0x00, 0x00};
const unsigned char b2sMountMultiplierPlus[4] = {0x40, 0x00, 0x00, 0x00}; // Taken from InvenSense Nucleo example

result = writeDMPmems(B2S_MTX_00, 4, &b2sMountMultiplierPlus[0]);
result = writeDMPmems(B2S_MTX_01, 4, &b2sMountMultiplierZero[0]);
// …
result = writeDMPmems(B2S_MTX_22, 4, &b2sMountMultiplierPlus[0]);

I also tried adding values for -1.0 (i.e., 0xC0000000) to the matrix to rotate the coordinate axes.

However, even after changing the B2S matrix (including purposely writing clearly incorrect matrices), the DMP quaternion output remains unchanged. The resulting Euler angles do not reflect any change in axis orientation or sensor mounting.

Is there something I might be missing?
Does the B2S matrix actually affect DMP quaternion output?
Or does it only apply in specific modes or require additional configuration?

Any insights would be appreciated!

Thanks in advance.

Hi @Henry ,

Welcome to the weird and wonderful world of the 20948 DMP!

There are still many things we don’t understand about the DMP… Please see the notes here and the issues on this and other subjects.

If you find the answer, please let us know…

Best wishes,
Paul