Raw data out of STMicro's LISM2MDL so bad that it breaks STMicro's CUBE-MEMS Compass Library? [SOLVED]
I have a compass program using an LSM9DS1 chip and the STMicro's CUBE-MEMS compass library. This is working.
I switched from the LSM9DS1 to the LISM2MDL. I am using the same program. This does not work. It appears the STMicro CUBE-MEMS library breaks (never creates good compensation values) because the LISM2MDL magnetometer values are so far out of alignment.
I captured the raw maximum & minimum magnetometer values from the LSM9DS1:
Max X: 62
Min X: -38
Max Y: 42
Min Y: -57
Max Z: 37
Min Z: -60
These are not very far from having zero average value. The offsets to make the maximums equal distant from zero:
X: -12
Y: 8
Z: 12
I adapted the program to use the LISM2MDL (I removed the STMicro HAL for the LSM9DS1 and replaced it with the STMicro HAL for the LISM2MDL. Now my raw minimum and maximum magnetometer values look like this:
Max X: -5
Min X: -44
Max Y: 21
Min Y: -16
Max Z: 30
Min Z: -9
The X values are terrible and very far from having zero average value. The others are not too bad. The offsets to make the maximums equal distant from zero:
X: 25
Y: 3
Z: -11
But when I pass these values to the STMicro CUBE-MEMS Library "MotionMC_Update()" I do not get good correction values back like I did when using the LSM8DS1.
