From a0bb0135c3d0e68ac08d1b10ba461ac309363680 Mon Sep 17 00:00:00 2001 From: Steveis Date: Mon, 4 May 2015 10:59:39 +0100 Subject: [PATCH] Added MPU6050 PLL Settling Time delay --- src/main/drivers/accgyro_mpu6050.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/drivers/accgyro_mpu6050.c b/src/main/drivers/accgyro_mpu6050.c index cddc23c99..dab6dad91 100644 --- a/src/main/drivers/accgyro_mpu6050.c +++ b/src/main/drivers/accgyro_mpu6050.c @@ -420,6 +420,7 @@ static void mpu6050GyroInit(void) delay(100); i2cWrite(MPU6050_ADDRESS, MPU_RA_SMPLRT_DIV, 0x00); //SMPLRT_DIV -- SMPLRT_DIV = 0 Sample Rate = Gyroscope Output Rate / (1 + SMPLRT_DIV) i2cWrite(MPU6050_ADDRESS, MPU_RA_PWR_MGMT_1, 0x03); //PWR_MGMT_1 -- SLEEP 0; CYCLE 0; TEMP_DIS 0; CLKSEL 3 (PLL with Z Gyro reference) + delay(15); //PLL Settling time when changing CLKSEL is max 10ms. Use 15ms to be sure i2cWrite(MPU6050_ADDRESS, MPU_RA_CONFIG, mpuLowPassFilter); //CONFIG -- EXT_SYNC_SET 0 (disable input pin for data sync) ; default DLPF_CFG = 0 => ACC bandwidth = 260Hz GYRO bandwidth = 256Hz) i2cWrite(MPU6050_ADDRESS, MPU_RA_GYRO_CONFIG, INV_FSR_2000DPS << 3); //GYRO_CONFIG -- FS_SEL = 3: Full scale set to 2000 deg/sec