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
... View more