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.
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;
/* 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
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?