Bosch Sensortec Community

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

    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

    embeddedavenger
    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 READme.md 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 READme.md 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

    Minhwan
    Community Moderator
    Community Moderator

    Hello, 

     

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

    https://github.com/BoschSensortec/BMI160_driver/wiki/How-to-use-an-auxiliary-sensor-or-magnetometer-...

    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. 

    Thanks, 

     

    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.

    Mathi123
    New Poster

    Can you share the code

    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