magnetometerintel-edison

MPU-9250 how to configure pass through I2C


I have a MPU-9250 connected via I2C to an intel edison arduino board (pins A4/A5).

I can read and it works perfectly reading the acc and gyro

MPU9250_ADDRESS = 0x68

now i disable the I2C master module

i2c.writeReg(USER_CTRL, 0b00000000) # I2C_MST_EN

# 1 – Enable the I2C Master I/F module; pins ES_DA and ES_SCL are isolated from pins SDA/SDI and SCL/ SCLK.

# 0 – Disable I2C Master I/F module; pins ES_DA and ES_SCL are logically driven by pins SDA/SDI and SCL/ SCLK.

now i enable the I2C bypass mux

i2c.address(MPU9250_ADDRESS)

i2c.writeReg(INT_PIN_CFG, 0b00000010) # BYPASS_EN set to high # When asserted, the i2c_master interface pins(ES_CL and ES_DA) will go into ‘bypass mode’ when the i2c master interface is disabled. The pins will float high due to the internal pull-up if not enabled and the i2c master interface is disabled.

so according the the datasheet if i disable the i2c master module inside the chip and activate the bypass , i should be able to access directly the compass via I2C.

not no for some reason i believe that this still happens " ... will float high due to the internal pull-up ... ", i say this because i looked with an oscilloscope at the 2 signals and before activating the bypass the signal 1 and 0 logic were spot on, after activating it 1 logic level went few mV up (nothing to worry about yet) but the 0 logic is no where close to 0V and in fact is somewhere close to logic one voltage, i can still make the difference in between 0 and 1 visually on the oscilloscope screen but that is nothing that any sane electronic device will recognize as a 0. anyway long story short i believe somehow the internal pull ups are not deactivated.

once BYPASS_EN bit is set the whole I2C bus is experiencing the issue, I measured signals on the AUX_CL and AUX_DA pins and they are identical with the ones on SCL and SDA pins so the bypass does it's job perfectly but there is something pulling the line after the bypass switch to high. and i have no idea how to disable it.

how do you properly configure MPU-9250 in I2C bypass mode is any other setting that must be made besides the 2 bits i'm setting

USER_CTRL->I2C_MST_EN = 0

INT_PIN_CFG->BYPASS_EN = 1

all other registers are untouched


Solution

  • Probably, it's too late to answer, but if someone will search similar question it may be helpful. You need to read byte from INT_PIN_CFG (0x37) register of MPU-9250, bitwise OR it with 0b00000010 and then write it back. After that you can access magnetometer on 0x0C i2c address.