Hi,
Thanks for your inquiry.
BMX160 is a 9-axis sensor that includes BMI160 IMU (accel + gyro) and BMM150 (mag) inside, where BMM150 is connected to BMI160's secondary I2C interface internally as a slave. BMI160 API source code at https://github.com/BoschSensortec/BMI160_driver has all necessary functions to configure BMM150 mag and get mag raw data and convert raw data to final meaningful magnetic field values in the unit of uT.
Please see the answers to your questions.
1) Can you please help me to find MAG Raw data correct or not?
>>> There are two ways to check MAG data. The first way is to check the sign of each axis. If you are located in Northern Hemisphere such as USA or Canada, then the earth magnetic field vector will point downwards. So when you place your device with MAG any axis pointing down, then that axis output value should be positive in the unit of uT. If pointing upwards, then the output will be negative. The second way is that you can place your device on a flat table and then rotate it slowly with a full circle. It doesn't matter if you rotate the device clockwise or counterclockwise. If you rotate along Z axis, then you can plot X and Y axis data in 2D plane. You should be able to see a shifted circle or ellipse from the origin.
2) I am just reading raw data from six registers of MAG(0x04 -0x09)?is it correct?
>>> Yes, that is correct. MAG raw data from registers 0x04 to 0x09 don't give you anything. You need to use BMI160 API code to do temperature compensation on the raw data and then convert them to final meaningful values in the unit of uT.
3) In BMX160 Datasheet for reading MAG data procedure given like below attached image
4) What is bmi160 API for doing above image task? i did not find any API in bmi160.c file like above image suggested ?
>>> BMI160 API configures MAG, sets up MAG to work under forced mode, retrieves MAG raw data and places raw data into its data registers from 0x04 to 0x09 and converts raw data to final magnetic field values in the unit of uT.
5) What king of fusion algorithm/filters can i use to find pitch,roll and yaw from above readings?
>>> Please refer BSXLite SW at https://www.bosch-sensortec.com/software-tools/software/sensor-fusion-software/#bsxlite for more information. You should be able to get pitch/roll/heading Euler angles, quaternions, linear acceleration and gravity vector from BSXLite.
Thanks.
... View more