limon Posted February 8, 2014 Report Share Posted February 8, 2014 Hello! I am kindly asking for help with my small question: I am writing some algorithm, which must work one time in one loop iteration. It takes him ~ 5-7 msec to proceed every loop(). I noticed, that my program hangs sometimes. Very rarely: ~ after 10 - 30 minutes of working. Than I went to DMP example, added delay(6) at the end of a loop.... And the same result: sometimes it hangs (after 10 - 30 minutes of working). I added Serial.println in the loop, where the program waits for interrupt, because it is the only one loop. Like this: while (!mpuInterrupt && fifoCount < packetSize) { Serial.println("Waiting..."); } And there is no "Waiting..." messages, when it hangs. Here is a full code of "my" MPU DMP example. It is the same as standart exampe, except two of three lines. I also added the loop period counting and printed it with YPR data. Also I tried it with two different MPU-6050... Sory for my English :-) Quote Link to comment Share on other sites More sharing options...
limon Posted February 8, 2014 Author Report Share Posted February 8, 2014 Hi to all again! It semms I fixed this "bug". But there is no understanding of the reason: I'v made this changings: old: // 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; new: while (fifoCount >= packetSize){ // 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; } now, I never see fifo overflows at all. Program never hangs. But... why it hanged??? I'v spend 5 hours of "debugging" and testing... Quote Link to comment Share on other sites More sharing options...
luisrodenas Posted February 8, 2014 Report Share Posted February 8, 2014 Is your DMP working at 100Hz or 200Hz? limon 1 Quote Link to comment Share on other sites More sharing options...
limon Posted February 8, 2014 Author Report Share Posted February 8, 2014 Is your DMP working at 100Hz or 200Hz? I did not touched anything in the libs, so I think it works at 100Hz. Every loop (if I delete my delay(6)) takes about 10 msecs. Quote Link to comment Share on other sites More sharing options...
ilane Posted September 6, 2014 Report Share Posted September 6, 2014 @luisrodenas Hi! I was reading serially all the topics, in search for an answer to something I still don't know how to ask. I believe you can help. I seems to me, from what I read here and elsewhere, that the 6050 with Jeff's library, can be told at what time intervals to issue interrupts for data available. If that is wrong, than perhaps it can be told at what "frequency" to push newly processed data into the fifo, which evntually generates an interrupt. I am rambling, I know, but it seems to me that people coding control systems somehow KNOW the "frequency" with which new data becomes available to plug into their PID equations. From your response above (DMP working at 100Hz...) I believe you could set me straight on the path to better understanding. Cheers 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.