From ef67b7505704b9bc26e26e046b71ee36512cce27 Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Fri, 7 Jul 2017 13:33:07 -1000 Subject: [PATCH] mpu9250:Added comment on BYPASSING the internal i2c master bridge --- src/drivers/mpu9250/mpu9250.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/drivers/mpu9250/mpu9250.cpp b/src/drivers/mpu9250/mpu9250.cpp index 26fa339ea8..69527a743b 100644 --- a/src/drivers/mpu9250/mpu9250.cpp +++ b/src/drivers/mpu9250/mpu9250.cpp @@ -417,7 +417,16 @@ int MPU9250::reset() #else bool bypass = false; #endif - // INT: Clear on any read, also use i2c bypass is master mode isn't needed + + /* INT: Clear on any read. + * If this instance is for a device is on I2C bus the Mag will have an i2c interface + * that it will use to access the either: a) the internal mag device on the internal I2C bus + * or b) it could be used to access a downstream I2C devices connected to the chip on + * it's AUX_{ASD|SCL} pins. In either case we need to disconnect (bypass) the internal master + * controller that chip provides as a SPI to I2C bridge. + * so bypass is true if the mag has an i2c non null interfaces. + */ + write_checked_reg(MPUREG_INT_PIN_CFG, BIT_INT_ANYRD_2CLEAR | (bypass ? BIT_INT_BYPASS_EN : 0)); write_checked_reg(MPUREG_ACCEL_CONFIG2, BITS_ACCEL_CONFIG2_41HZ);