2020-02-06 09:25 PM
Using STMicro's MC and EC middle ware libraries for a tilt compensating compass.
Libraries working with a LSM9DS1 (acc, gyro & mag).
Libraries not working with an LSM6DSO (acc & gyro) & LIS2MDL (mag).
I have traced this back to the STMicro's middle ware returning ALL ZEROs compensation values for the LIS2MDL magnetometer. In other words, the library, for some reason never calibrates the LIS2MDL!
These 2 projects are running nearly the same code. The LIS2MDL produces what appears to be reasonable raw magnetometer values. So why is the STMicro's MC / EC Middle Ware Libraries returning all zeros calibration values?
-thanks
2020-02-07 05:40 AM
Perhaps a better question to ask:
Under what conditions do the STMicro's MC and EC Middle Ware Libraries produce no output / do not calibrate the magnetomenter?
There is no source code to look at. So I'm looking for more documentation or insight to how the STMicro EC Middle Ware Libraries work. Any help is appreciated.
-thanks
2020-02-08 08:08 AM
With help from STMicro support, it turns out that switching from the LSM9DS1 to the LIS2MDL while using the same software caused a reduction in the magnetometer values as presented to the STMicro Compass Middle Ware Libraries. As there is no source code available for these libraries it is difficult to see when they will and will not work.
I had expected the magnetometer values needed to be increased by a factor of 3. However that had no effect. The STMicro Compass Middle Ware Libraries continued to not work. Not until I reduced from 3 to 2 did the STMicro Libraries returned corrections values other than zero.
However, the correction values do not appear correct.
In the below scatter plot from STMicro's "Unicleo-GUI" PC based application, you can see the initial X-Y, X-Z & Y-Z rings. Then clearly see the correction factors kick in to move the rings to a new but unusable position. In either case, before and after the correction, the compass bearing was unusable.
If anyone else has had these problems and would like to share their ideas it would be much appreciated.
-thanks
2020-02-11 02:59 AM
Hello,
the MotionMC, EC libraries are sensor agnostic. Are you passing the magnetometer data to the library in correct unit which is micro tesla [uT]?
In X-CUBE-MEMS1 is application for LSM6DSO and LIS2MDL whihc are populated on X-NUCLEO-IKS01A3, you can use it for reference,
2020-02-11 08:05 AM
Hi Miroslav,
Thank you for your insight. I have posted twice in the forum with different questions. But I think both threads are heading in the same direction. So I will follow up your questions in this forum thread: https://community.st.com/s/feed/0D50X0000C6ctkT