Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    I can't make a single I2C read or write between the BMI160 and BMM150

    I can't make a single I2C read or write between the BMI160 and BMM150

    New Poster

    I have been given a board designed in-house with a BMI160 and BMM150. I started working on the BMI160, and can read ACC and GYR data from it. So I moved on to add MAG data to that.

    Following the example code in the file of the BMI160 driver package, bmi_aux_init() calls config_aux_settg(). config_aux_settg() calls config_sec_if(), which sends the normal mode command and sets IF_CONF to specifiy the secondary interface as a magetometer. I can see the PMU status change to show the MAG in normal mode, and can read 0x20 out of the IF_CONF register. So I am pretty sure that went well.

    Next, config_aux_settg() will call bmi160_config_aux_mode(). This reads MAG_IF[1] (reg addr 0x4c), then sets bit 7 to enable manual mode, loads bits 1:0 with dev->aux_cfg.aux_rd_burst_len, and writes it back out. The example code in the file sets dev->aux_cfg.aux_rd_burst_len to 2, which is a burst length of 6. I don't get that, particularly in manual mode. But I don't think it is the cause of my problem. And again, I can read back the register and get 0x82.

    For me, that is the high point. At this point the example code starts to read and write BMM150 registers via the BMI160. For me, all those transfers fail, and all in the same manner.

    Am I2C transfer has a start phase and an 8-bit data phase that includes a 7-bit slave address and a R/W bit, followed by the slave device acknowldging that address by pulling the data line down during a final clock transition. That acknowledgement bit is where things fail for me. Every transfer the BMI160 attempts to the BMM150 stops when the acknowledge bit is high.

    The other odd part of this is that the attached picture of the scope (data on top, clock on bottom) is what every transfer attempt looks like. Which is to say, the R/W bit is always low. Even when I am doing a manual mode read attempt. Even when the BMI160 is in auto mode, reading the MAG 25 times a second.

    Does anyone have any clues for why I can't seem to complete a single I2C transaction between the BMI160 and the BMM150? Any help will be greatly appreciated. Thanks.

    William Carroll

    3 REPLIES 3

    Community Moderator
    Community Moderator



    Regarding using BMM150 as BMI160 AUX data, you can find it below url.

    However, github code doesn't update for latest BMI160 BMM150 api, so please check the attached file. 

    Then, you can compare it with your configuration. 

    If you need to debug, I'd like to suggest checking rslt value which has return value for bmi160 or bmm150. 

    If the rslt value has some negative value, it means there is some issue function inside. 



    Minhwan Oh


    I know all the software/firmware folks out there will find this hard to believe, but ...

    After letting me stare at this problem for almost a week, my hardware engineer decided to look at the problem as well, with a second board. And, of course, it all works on that board. The likely culprit is not software, but a solder connection on the board I am using.

    So I apologize for bothering the world with a problem that was never going to be solved by a software change.

    New Poster

    Can you share the code