two MPU9250 Mbed lcp1768

04 Jun 2015

Hi everyone,

I have a problem. I use two MPU9250 with two different i2c addresses by using the pin AD0. Here, it's okay. I can get data from this two IMUs but the problem is located on the magnetometer's address.

It seems there is a conflict when the two MPU9250 get data with their magnetometer. As we can't change the magnetometer's address, i think that the two MPU9250 have to use the same magnetometer and not their own magnetometers.

Is there a way to unlock the situation without using a multiplexer please ? Thanks.

04 Jun 2015

It is not clear from your question what hardware module and external magnetometer you are using. The mbed MPU9250 lib refers to an AK8963. This device could be connected to the MPU9250 aux I2C bus and should then have a different address when you have two MPU9250/AK8963 pairs on the same bus. However, the AK8963 does in fact support 4 I2C slave addresses which can be selected through CAD1 and CAD0:

CAD1 CAD0 address

VSS VSS 0 0 0 1 1 0 0 R/W

VSS VDD 0 0 0 1 1 0 1 R/W

VDD VSS 0 0 0 1 1 1 0 R/W

VDD VDD 0 0 0 1 1 1 1 R/W

As long as your hardware allows you to change the CAD bits you should be able to use them. The MPU-9250 lib also needs a modification to make sure you select the correct AK8963 address. Currently it is hardcoded to 0x18 (ie 0x0C <<1)

05 Jun 2015

Thanks for your answer.

With some research on google, i not find information for change the AK8963's address by using MPU9250's registers. I sent a request to the invensense's support center to get more information about this.

I hope that there is a way, if not, i get a multiplexer soon. I think it will help me.

05 Jun 2015

You wont be able to change the AK8963 slaveaddress by manipulating the registers of the MPU9250. The AK8963 is a completely independent device from the MPU9250. It has its own pins (CAD1, CAD0) to select its slaveaddress. Both devices typically share the same i2C bus, most likely by using the AUX I2C function of the MPU9250. This is sort of a ''pass through'' connection. You may hope that on your board either CAD1 or CAD0 are directly accessible to change the address or that the AD0 pin of the MPU9250 is also connected either to CAD1 or CAD0 to change the slaveaddress of both devices at the same time.

25 Jun 2015

Are you using the motion driver and MPL directly from Invensense?

26 Jun 2015

Thanks Wim, it's clear for me. Unfortunately, my board does not give access to CAD0 and CAD1. Now, i work with a PCA9547PW multiplexer and it works like a charm.

Andre : I use the MPU9250AHRS library of mbed's forum. I don't know how to use the motion driver with INT pin of a MPU9250.

02 Jul 2015

The AK8963C is embedded inside the MPU9250 with the MPU6500 accel/gyro. Its I2C address is hardwired and can't be changed. However, if you toggle the bypass bit in the INT_CFG register of the MPU9250 you can control which AK8963C your microcontroller addresses. Setting the bit to 0 disables the bypass making the magnetometer in that MPU9250 inaccessible to the I2C bus. So by toggling the MPU9250 ADO and the bypass bit, you can multiplex all three embedded sensors without an external multiplexer.