MPU-9150 DMP and raw values hangs, freezes randomly


I have a problem with my MPU 9150 and that it hangs randomly while reading the registers of the device while using the DMP. Looking at this issue on the web I have not managed to find any working solutions even though many people have the issue.

Parts list:

I have setup the device from the


  • The interrupts works perfectly fine and while i'm running the FIFO and DMP @ 100Hz. No hang. No overflows. OK.
  • If i'm running the raw values example without DMP. No hang. OK.
  • If I combine them, reading raw values in between the FIFO fills up with DMP values. It hangs. NOK. (See code below)
  • I have tried two different MPU9150s with the same result. Isolated, raw values and DMP works well but not if using them together it hangs.

I have narrowed down the problem to the following lines in the MPU6050.cpp. mpu.getFIFOCount() (reading FIFOCount register) or mpu.getRotation() (reading raw value gyro). I tracked it further down to the Wire library used in the I2CDev.cpp. The lockup occurs here => Wire.requestFrom(devAddr, (uint8_t)min(length - k, BUFFER_LENGTH));

    if(mpuInterrupt)  {
      // reset interrupt flag and get INT_STATUS byte
      mpuInterrupt = false;
      mpuIntStatus = mpu.getIntStatus();
      // get current FIFO count
      fifoCount = mpu.getFIFOCount();
      // check for overflow (this should never happen unless our code is too inefficient)
      if ((mpuIntStatus & 0x10) || fifoCount >= 1024) {
          // reset so we can continue cleanly
          Serial.println(F("FIFO overflow!"));
      // otherwise, check for DMP data ready interrupt (this should happen frequently)
      } else if (mpuIntStatus & 0x01) {
          // wait for correct available data length, should be a VERY short wait
          while (fifoCount < packetSize){
            fifoCount = mpu.getFIFOCount();
          // read a packet from FIFO
          mpu.getFIFOBytes(fifoBuffer, packetSize);
          // track FIFO count here in case there is > 1 packet available
          // (this lets us immediately read more without waiting for an interrupt)
          fifoCount -= packetSize;
              // display Euler angles in degrees
              mpu.dmpGetQuaternion(&q, fifoBuffer);
              mpu.dmpGetGravity(&gravity, &q);
              mpu.dmpGetYawPitchRoll(ypr, &q, &gravity);
              Serial.print(ypr[0] * 180/M_PI);
              Serial.print(ypr[1] * 180/M_PI);
              Serial.println(ypr[2] * 180/M_PI);
    } else  {
      Serial.println("No interrupt");
      mpu.getRotation(&gx, &gy, &gz);

Is it not possible to use both DMP and raw values at the same time?
What is causing the device to lock while requesting to read any of the registers?