Where is the example that works for getting the magnetometer data?

I am working on BMX160 using I2C, I can get the data of Accel  but can't get any valid Magnetometer data. I found that almost all the examples using bmm150 to get this data. https://github.com/BoschSensortec/BMI160_driver/wiki/How-to-use-an-auxiliary-sensor-or-magnetometer-with-the-BMI160. and /mems-sensors-forum-jrmujtaw/post/bmx160-magnetometer-problem-BNstnEWxUtHtAq0 , but I found some defines in bmm150_def.h are not the same as the datasheet of BMX160. For example : 

#define BMM150_REG_CHIP_ID                        UINT8_C(0x40)
it should be 0x00

#define BMM150_CHIP_ID                            UINT8_C(0x32)
it should be 0xD8

I am worrying about it doesn't work. 
Best reply by Minhwan

Hi, 

 

Please check my zip file. 

You can check the bmx160_read_sensor_data example and modified bmi160 code. 

Thanks, 

bmi160.zip
76.49KB
View original
6 replies
Resolved