Hello!
I’m trying to read raw sensor data from MPU6050 (rev C) and raw data from slave sensor.
When I read only MPU’s data, it works fine.
But when I enable slave sensor then after some time (usually 30-50ms) primary interface of MPU dies (does not respond).
Here is what wires look like (overall):
Close-up of a good readout:
Close-up of the error:
Initialization code I use:
regWrite(MPU_ADDR, MPUREG_PWR_MGMT_1, 0x80);
delay(5);
regWrite(MPU_ADDR, MPUREG_SMPLRT_DIV, 0x00); //SMPLRT_DIV = 0 Sample Rate = Gyroscope Output Rate / (1 + SMPLRT_DIV)
regWrite(MPU_ADDR, MPUREG_CONFIG, 4); //EXT_SYNC_SET 0 (disable input pin for data sync)
regWrite(MPU_ADDR, MPUREG_PWR_MGMT_1, 0x03); //SLEEP 0; CYCLE 0; TEMP_DIS 0; CLKSEL 3 (PLL with Z Gyro reference)
regWrite(MPU_ADDR, MPUREG_GYRO_CONFIG, 0x18); //FS_SEL = 3: Full scale set to 2000 deg/sec
// enable I2C bypass for AUX I2C
regWrite(MPU_ADDR, MPUREG_USER_CTRL, 0x00); //DMP_EN=0 ; FIFO_EN=0 ; I2C_MST_EN=0 (I2C bypass mode) ; I2C_IF_DIS=0 ; FIFO_RESET=0 ; I2C_MST_RESET=0 ; SIG_COND_RESET=0
regWrite(MPU_ADDR, MPUREG_INT_PIN_CFG, 0x02);
...
// configure slave sensor
...
regWrite(MPU_ADDR, MPUREG_USER_CTRL, 0x20); //DMP_EN=0 ; FIFO_EN=0 ; I2C_MST_EN=1 (I2C master mode) ; I2C_IF_DIS=0 ; FIFO_RESET=0 ; I2C_MST_RESET=0 ; SIG_COND_RESET=0
regWrite(MPU_ADDR, MPUREG_INT_PIN_CFG, 0x00); //INT_LEVEL=0 ; INT_OPEN=0 ; LATCH_INT_EN=0 ; INT_RD_CLEAR=0 ; FSYNC_INT_LEVEL=0 ; FSYNC_INT_EN=0 ; I2C_BYPASS_EN=0 ; CLKOUT_EN=0
regWrite(MPU_ADDR, MPUREG_I2C_MST_CTRL, 0x0D); //MULT_MST_EN=0 ; WAIT_FOR_ES=0 ; SLV_3_FIFO_EN=0 ; I2C_MST_P_NSR=0 ; I2C_MST_CLK=13 (I2C slave speed bus = 400kHz)
regWrite(MPU_ADDR, MPUREG_I2C_SLV0_ADDR, 0x80 | SLAVE_SENS_ADDR); //I2C_SLV4_RW=1 (read operation) ;
regWrite(MPU_ADDR, MPUREG_I2C_SLV0_REG, SLAVE_REG_ADDR);
regWrite(MPU_ADDR, MPUREG_I2C_SLV0_CTRL, 0x86); //I2C_SLV0_EN=1 ; I2C_SLV0_BYTE_SW=0 ; I2C_SLV0_REG_DIS=0 ; I2C_SLV0_GRP=0 ; I2C_SLV0_LEN=6 (3x2 bytes)
What can I do to fix this?
Thank you.