Search the Community
Showing results for tags 'FIFO Overflow NodeMCU Wifi'.
-
Hi, I am using NodeMCU and MPU6050 to record Accelerometer Data and send it to my PC. My Code is working fine but after about 30 seconds I get FIFO Overflow very often and then the programm crashes, I just can't figure out why. Here is my Code: // if programming failed, don't try to do anything if (!dmpReady) return; // wait for MPU interrupt or extra packet(s) available while (!mpuInterrupt && fifoCount < packetSize) { // other program behavior stuff here // . // . // . // if you are really paranoid you can frequently test in between other // stuff to see if mpuInterrupt is true, and if so, "break;" from the // while() loop to immediately process the MPU data // . // . // . } // 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 mpu.resetFIFO(); Serial.println(F("FIFO overflow!")); // otherwise, check for DMP data ready interrupt (this should happen frequently) } else if (mpuIntStatus & 0x02) { // 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; mpu.dmpGetAccel(&aa, fifoBuffer); tmp = String(aa.x) + " " + String(aa.y) + " " + String(aa.z) + " "; mpu.dmpGetAccel(&aa, fifoBuffer); gravityX = aa.x / 8192.0; gravityY = aa.y / 8192.0; gravityZ = aa.z / 8192.0; tmp = tmp + String(gravityX) + " " + String(gravityY) + " " + String(gravityZ) + " "; // display Euler angles in degrees mpu.dmpGetQuaternion(&q, fifoBuffer); mpu.dmpGetGravity(&gravity, &q); mpu.dmpGetYawPitchRoll(ypr, &q, &gravity); tmp = tmp + String(ypr[0] * 180/M_PI) + " " + String(ypr[1] * 180/M_PI) + " " + String(ypr[2] * 180/M_PI) + " "; mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity); tmp = tmp + String(aaReal.x) + " " + String(aaReal.y) + " " + String(aaReal.z) + "\r\n"; Serial.print(tmp); client.print(tmp); I know the Overflow has got something to do with the "client.print(tmp)" but I just can't figure out how to get this to work properly. Hope someone can help me, thanks, Niklas