Hi Sir: Recommend you to read the offecial BMM150 api code to know how to get the magetometer data. I don't see you to use trim values after you read the mag data registers. Please see the following link: https://www.bosch-sensortec.com/products/motion-sensors/absolute-orientation-sensors/absolute-orientation-sensors-bmx055.html Hopefully, it can help you.
... View more