Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    BMX160 driver

    BMX160 driver

    Established Member

    Hi all

    I'm starting a new design and want to use the BMX160, but can't find the driver.
    I've looked on the Bosch Sensortec GitHub page, but there is no driver there.

    The BMI160 driver is available on GitHub, but doesn't seem to be compatible with the BMX160.

    Does anyone know where to download/clone the BMX160 driver?


    18 REPLIES 18

    Thanks for this note. I have 2 questions:


    1) If I am using SPI comms with the BMX, should the BMM (tunneling through the auxillary interface of the BMI) also be SPI? Or does that remain I2C? 

    2) For the device ID for both the BMI and BMM, what should be used for SPI? For I2C, this is the default address, but it is unclear if this field needs to be set for SPI.


    1) The secondary master interface is always i2c, no matter if the primary interface is SPI or i2c.
    2) When using SPI, this parameter has no impact. You could however use it to pass the GPIO pin for the Chip Select. For the "BMM150" please select the address 0x10.

    Hi  ,

    Thank you for your answer, that was very helpful.  I am wondering if you could take a look at how I am setting up the aux interface on the BMX160.  I referred to the Bosch application notes on the BMX160 wiki, but I am getting an error when I attempt to init the BMM, and there is very little information about this error.



    // CS rising edge on power up to initiate SPI (pg 93)
    BMX_CS = CS_DISABLED; = 0; = (bmi160_com_fptr_t)bmx_ReadByte;
    bmi.write = (bmi160_com_fptr_t)bmx_WriteByte;
    bmi.delay_ms = (bmi160_delay_fptr_t)bmx_Delay;
    bmi.interface = BMI160_SPI_INTF;

    //The BMM150 API tunnels through the auxiliary interface of the BMI160
    bmm.dev_id = BMM150_DEFAULT_I2C_ADDRESS;
    bmm.intf = BMM150_I2C_INTF; = bmm150_aux_read;
    bmm.write = bmm150_aux_write;
    bmm.delay_ms = bmx_Delay;

    int8_t rslt;// = BMI160_OK;

    /* Configure the BMI160's auxiliary interface for the BMM150 */
    bmi.aux_cfg.aux_sensor_enable = BMI160_ENABLE;
    bmi.aux_cfg.aux_i2c_addr = bmm.dev_id;
    bmi.aux_cfg.manual_enable = BMI160_ENABLE; /* Manual mode */
    bmi.aux_cfg.aux_rd_burst_len = BMI160_AUX_READ_LEN_3; /* 8 bytes */


    rslt = bmm150_init(&bmm);

    // here rslt is BMM150_E_DEV_NOT_FOUND

    It's a bit hard to know where the error code is generated, if it comes from the BMM150API, BMM150_E_DEV_NOT_FOUND means there is a chip ID mismatch.
    If it comes from the BMI160 API, -2 would be BMI160_E_COM_FAIL.

    Both error codes indicate communication failure. I see in your driver, you are never checking the error code for the BMI160 API, can you read the Chip_ID successfully at least?

    Hi and thanks for getting back,


    I was error checking each result, but just pulled those out in the example code. The BMI portion works perfectly - I can read the correct chip id, extract data, etc.  Only the BMM part on the aux interface is acting funky. That error was generated from the BMM init. The chip id mismatch is confusing, because quite a few other things are successfully read up to that point (within the BMM init function). 

    I saw in another thread that the BMI chip id needs to be updated in the drivers (to 0xD8) - does the BMM chip id need to be updated as well?