Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    BMX160 Magnetometer problem.

    BMX160 Magnetometer problem.


    I'm using a BMX160 with an ARM Microprocessor, using I2C, code developed in C, using the MCUXpresso IDE to program the micro. I've got the accelerometer, gyro and magnetometer working as expected. The ARM board outputs a data stream to a tool on my pc that graphs the sensor values for all 9 axes. 

    When I program the board (through a USB connection) and run the software from my pc all is working correctly.

    When I disconnect the board from the usb connection, hard reset my electronics (power off power on, including the BMX160), the magnetometer does not provide any output data, but the accelerometer and gyro work as previously.

    I assumed it was a power-on start up race condition with the BMX160 and added delays of up to a second in the start up code before attempting to access any sensor registers, but this made no difference. I tried a softreset of the BMX160 (CMD register 0x7e set to 0xB2), a soft reset of the magnetometer, and a POR reset of the magnetometer, all with no success.

    Also checked that I'm not exceeding the power capabilites of the supply on my board.

    I think I'm missing something but can't find it.

    Any insight from anyone please?


    7 REPLIES 7

    Community Moderator
    Community Moderator

    Hello parkescape, 


    Please correct me if there is something I have misunderstand. 

    1) After hardware reset, BMI160 part  (accel and gyro) is working properly, yet BMM150 part doesn't work at all. 

    2) Therefore, you tried to soft reset for BMM150, but didn't work. 

    If yes, could you check one more time with my code? 

    If there is something you miss please put for configuration part. 

    Or, could you please share your code with me? 




    1 and 2 are correct.

    But magnetometer (and accel and gyro) works after programming, before hardware reset.

    My code attached.

    I'll take a look at your code but it will take me a while to integrate it into mine.

    Regards, Andrew

    Community Moderator
    Community Moderator

    Hello parkescape, 


    Ok, so now you are developing not to use our API. 

    Why don't you use our API?

    You can check proper initialization process using our API. 

    Please let me know if you have any questions. 


    I already had the software developed for other (NXP) sensors. NXP have notified that they are going to stop manufacturing their sensors, so looking for a replacement. The BMX160 looks ideal, so prototyping to make sure I can work with it before redesigning hardware.

    All the I2C interface software is already developed and working, so don't want to have to replace it. And I don't (currently) use anything other than the basic 9 axes of data - don't need all the interrupts etc., or the FIFO. So easier to develop a dedicated driver than to understand and integrate the whole of your API which is more than 6000 lines of code. My driver is only about 250 lines of code, and 110 of that is register and data definitions. Of course - that's of no value if I can't get it to work!!

    Can you detail the start up commands and their order for the magnetometer in your api please?  Or point me to where they are in the code? I cant see them in the code you posted yesterday.