Jump to content
I2Cdevlib Forums

Leaderboard

Popular Content

Showing content with the highest reputation on 05/26/2015 in all areas

  1. I am writing a small abstraction class for the MPU6050 to be used with a scheduler. I call the update function at 100hr and it seems to work for a while (fro 20sec to 4min) but eventually crashes. I think I have located the point of failure but I cannot understand what is the problem. this is the update function: (it is based on the DMP example but i got rid of the interrupts) void update() { // if programming failed, don't try to do anything if (!dmpReady) return; Serial.print(F("a")); // + // get current FIFO count fifoCount = mpu.getFIFOCount(); Serial.print(F("b")); // check for overflow (this should never happen unless our code is too inefficient) if (fifoCount == 1024) { // reset so we can continue cleanly mpu.resetFIFO(); overflowCount += 1; } else if (fifoCount == 0) { pullEmptyMissCount += 1; } else if (fifoCount < packetSize) { pullMissCount += 1; } else { // in this case the fifo has one or more packets Serial.print(F("c")); // if there are more than on packet, will read all of them and keep the newest lastBuferReadCount = 0; while (fifoCount >= packetSize) { // read a packet from FIFO Serial.print(F("d")); // ++ mpu.getFIFOBytes(fifoBuffer, packetSize); lastBuferReadCount += 1; // track FIFO count here in case there is > 1 packet available // (this lets us immediately read more without waiting for an interrupt) fifoCount -= packetSize; //fifoCount -= mpu.getFIFOCount(); // It is slower than subtracting the packet size, but in case new data comes in it will allow to read it. } Serial.print(F("e")); // Update Quaternion, Euler angles and Yay Pich Roll angles mpu.dmpGetQuaternion(&q, fifoBuffer); mpu.dmpGetGravity(&gravity, &q); mpu.dmpGetYawPitchRoll(ypr, &q, &gravity); } float* ypr = get_ypr(); int ofc = overflowCount; int pm = pullMissCount; int pem = pullEmptyMissCount; int rc = lastBuferReadCount; cout <<"- "<<ypr[0]<<" - "<<ypr[1]<<" - "<<ypr[2]<<" - "<<" - overflow: "<<ofc<<" - empty miss: "<<pem<<" - miss: "<<pm<<" - readCount: "<<rc<< endl; Serial.println(F("")); }
    1 point
  2. I was testing my MPU6050 with Raspberry PI and got accelerometer(X,Y,Z) and gyroscope(X,Y,Z) data forming on registers at decentely high sample rate. Looks like I've accidently fed +5v from RPI to SDA or SCL the other day and weird things started to happen with MPU6050. Looks like gyroscope got fried. Accelerometer still respond, but at very slow rate. It changes it's value about once a second no matter what clock source I set. Gyroscope stopped responding at all and writes 0 to each axis all the time. Did my MPU6050 got fried? Looks like RPI's current is fatal for i2c?
    1 point
  3. Why are we dividing by 8 and 4 before setting the offsets? Where is that documented? Or is just a step to prevent wide changes in the offset and help the optimization converge?
    1 point
×
×
  • Create New...