1) For reading MAG data or even BMM150 Chip_id also, Finally we get data from SPI only because it is the bmi160 primary interface. right?
- Right 🙂
2) Eventhough if you call " bmm_init();" API, still it will use spi_read/spi_write of bmi160 driver via aux_interface of bmi160 like below
bmm150_init(&bmm); ---> bmm150_get_regs ----->dev->intf_rslt = dev->read(reg_addr, reg_data, len, dev->intf_ptr); ---->bmm150_aux_read() ---- -------->bmi160_aux_read. right?
- The SPI communcation between host MCU and BMX160 is running via primary interface, not AUX interface. AUX interface is for BMM150 and BMI160 internally.
3) How do we know bmi160 aux_interface working fine or not?
- when you call bmm150_init function, and get -2 error, it means communcation failure.
4) Can i change bmi160 aux_interface to SPI from I2C?
5) Can i read MAG data directly form bmm150(without using bmm150 driver), if yes can you please suggest me how to implement it.
- You can only read mag data thru primary interface.
In source code which API can i use SPI or I2C for rading ACC/GYRO and MAG because for bmi160 i initialize in spi API and for bmm150 i2c API?
If i use bmm150 API for MAG, finally it should use bmi160 SPI API, but how it will work internally(bmi160 to bmm150) because aux interface of bmx160 I2C only.
How spi will pass write or reg data into bmm150? and also in bmx160 datasheet no where given for this bmm150 interface for MAG, why?
Thanks in advance
Yes, you can use I2C/ SPI interface between host MCU and BMI160, and I2C interface between BMI160 and BMM150 ( this is BMX160 internal)
You can also check BMX160 block diagram in datasheet page 14 how BMX160 works.
Because BMX160 concept is kind of combination with BMI160 and BMM150, we short commented it in BMX160 datasheet page 26.