Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    SOLVED

    BMX160 driver

    BMX160 driver

    rdehart
    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. https://github.com/BoschSensortec

    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?

    Thanks

    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.

    Thanks.

    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;

    bmi.id = 0;
    bmi.read = (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;
    bmm.read = bmm150_aux_read;
    bmm.write = bmm150_aux_write;
    bmm.delay_ms = bmx_Delay;

    int8_t rslt;// = BMI160_OK;
     bmi160_init(&bmi);


    /* 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 */

    bmi160_aux_init(&bmi);

    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?

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist