I have a lot of issues with respect to the BMX160.
I'll start with the data sheet. From what I see there is no reference to the BMM150 although it appears to integrated into the package but there is no references as to how. The forums when people have asked about the BMX160 the response is related to the BMI160 and I suspect with the BMM150 attached to it auxiliary I2C port. Looking at the Page 25 and 26 there are steps to communicate with the magnetometer (BMM150) using the Indirect Read and Write protocol except the documentation is misleading. What I eventually discovered was that:
- MAG_IF is a read/write data register
- MAG_IF selects the magnetometer Address to Write to
- MAG_IFselects the magnetometer Address to Read from
I have issues with the static reading from the magnetometer. I compared it with the NXPFXOS8700 and FXAS21002 sensor I'm currently using and there is a significant variation. trying to calibrate using the PJRC (of Teensy fame) tool and a version that I adapted from NXP c
I have attached 2 files:
- BMX160 Indirect Read-Write Code V01 -the Arduino cpp code snip that is used to read and write to the BMX160 over I2C. In my code I test the BMX160 status register to make sure the transaction is complete but it doesn't always work. Sometimes the data returned from the current read is the data from the last read. See the BMX160 Advanced Test Configuration the sequence.
- BMX160 Advanced Test Configuration V01 - the prinout of the steps to perform an Advanced Self Test and the results look odd. I have assumed that each bit in the count is 0.3uT although it is difficult to work out what is going on in the BMM150 code as it includes compensation using Trim data.
From my observations reading the documents the TFM should trigger a sample (sequence) and the return to sleep.
Thanks for your inquiry.
It is true that inside BMX160 the BMM150 magnetometer is connected to BMI160 IMU auxiliary interface. It works the same way as BMI160 shuttle board that is avaialble to purchase at https://www.digikey.com/product-detail/en/bosch-sensortec/BMI160-SHUTL/828-1052-ND/6136295.
We have API source code for BMX160 = BMI160 + BMM150 avaialble online at https://github.com/BoschSensortec/BMI160_driver. You don't need to do everything from scratch. There are also examples on the Github. You only need to define three functions on your platform such as I2C read, I2C write and delay. Then you can use the API calls right away.