datrus Posted May 2, 2015 Report Share Posted May 2, 2015 Hello, I found a bug in the MPU6050 library. When using I2CDEV_IMPLEMENTATION=I2CDEV_BUILTIN_FASTWIRE, the dmpInialize functions hangs here: ... DEBUG_PRINTLN(F("Waiting for FIFO count > 2...")); while ((fifoCount = getFIFOCount()) < 3); ... (in file MPU6050_6Axis_MotionApps20.h) Could someone guide me how to solve this bug? Johnnydofs 1 Quote Link to comment Share on other sites More sharing options...
899NTH Posted October 14, 2015 Report Share Posted October 14, 2015 Hi, Did you find a solution to this problem? I've been having the same problem and it's driving me crazy! I've tried a Arduino Uno and a Mega 2560. And I've tried 2 different GY-521 breakout boards, so it doesn't appear to be a hardware issue. I can initialise and get data from the MPU6050 if I use Arduino Wire library for I2C. I've tried doing a comparison of the debug output when using Wire and Fastwire, and they look the same right up until the point where the Fastwire version stops being able to read. Debug output using Fastwire: Setting motion detection duration to 80... I2C (0x69) writing 1 bytes to 0x20...50. Done. Setting zero-motion detection duration to 0... I2C (0x69) writing 1 bytes to 0x22...0. Done. Resetting FIFO... I2C (0x69) reading 1 bytes from 0x6A.... Done (-1 read). I2C (0x69) writing 1 bytes to 0x6A...4. Done. Enabling FIFO... I2C (0x69) reading 1 bytes from 0x6A.... Done (-1 read). I2C (0x69) writing 1 bytes to 0x6A...40. Done. Enabling DMP... I2C (0x69) reading 1 bytes from 0x6A.... Done (-1 read). I2C (0x69) writing 1 bytes to 0x6A...80. Done. Debug output using Wire Setting motion detection duration to 80... I2C (0x69) writing 1 bytes to 0x20...50. Done. Setting zero-motion detection duration to 0... I2C (0x69) writing 1 bytes to 0x22...0. Done. Resetting FIFO... I2C (0x69) reading 1 bytes from 0x6A...0. Done (1 read). I2C (0x69) writing 1 bytes to 0x6A...4. Done. Enabling FIFO... I2C (0x69) reading 1 bytes from 0x6A...0. Done (1 read). I2C (0x69) writing 1 bytes to 0x6A...40. Done. Enabling DMP... I2C (0x69) reading 1 bytes from 0x6A...40. Done (1 read). I2C (0x69) writing 1 bytes to 0x6A...C0. Done. The reason I want to use Fastwire is because I'm seeing lock-ups when using Wire. I'm trying to log the data from the MPU-6050, along with a time stamp, to a SD card. Thanks, Nick Quote Link to comment Share on other sites More sharing options...
mike.wilsher Posted October 21, 2015 Report Share Posted October 21, 2015 Hi Sounds like I am seeing exactly the same thing with the MPU6050 when using the FASTWIRE switch in i2cdev lib. I went over to FASTWIRE as I am seeing the I2C bus hang occasionally, strangely more when I am just doing a simple register read for mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);. Switching to FASTWIRE where the library has a timeout seems to work round this fine and it does not hang. I only need a snapshot of the readings not tracking them so the time stamp is not critical. However !! If I run the MPU6050_DMP6 code and do an mpu.dmpInitialize(); it hangs, with DEBUG on it just waits at DEBUG_PRINTLN(F("Waiting for FIFO count > 2...")); while ((fifoCount = getFIFOCount()) < 3); With the wire lib it works fine. (but occasionally hangs on the I2C bus) I went back to the original calibration and DMP examples in Jeffs current github releaserelease to make sure I had not added anything in my code but get the same results. The config is a standard Arduino 16MHz 5v Uno hooked up to a GY-521 MPU 6050. I have tried oneof the basic read scripts with the wire libray and it seems to read the accel and gyro registers without hanging, so I think the issue is in the libs. The anoying thing is that using a calibrate to let things settle out and then the DMP in Jeffs libs I get a super stable output which always comes back to the original point, great nice if it did not hang !! I would be very grateful for any thoughts. As a work round I am going to try FASTWIRE without the DMP and do the ypr in the processor, but a load of hassle. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.