gilperon Posted June 24, 2016 Report Share Posted June 24, 2016 Sometimes my Arduino freezes or crashes when using JEFF ROWBERG library to read DMP data from MPU6050. It took me almost a full year to discover the problem and today I had some spare time and I tried to find where exactly arduino hangs/freezes. I discovered it is usually when executin getFIFOCount() or getIntStatus(). I discovered that inserting many Serial.print with tags along my entire code so I could know exactly which line hanged. So I discovered everytime my arduino hanged/freezes it was at a line with getFIFOCount() or getIntStatus(). So I decided to take a close look at it. Inside the file MPU6050.cpp there is a code like this: uint16_t MPU6050::getFIFOCount() {I2Cdev::readBytes(devAddr, MPU6050_RA_FIFO_COUNTH, 2, buffer);return (((uint16_t)buffer[0]) << 8) | buffer[1];} I checked the function "readBytes()" inside I2Cdev.cpp and I found this: I2Cdev::readBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_t *data, uint16_t timeout) You see the problem? The function readBytes accepts one last parameter which is "timeout" but the function getFIFOCount uses readBytes without the timeout parameter! That's probably a bug cause sometimes I think the readBytes takes too long to execute and a TIMEOUT SHOULD BE set to avoid the function hanging out forever. I am pretty sure maaaany MAAAANY other people alterady experienced this problem and spent a lot of time trying to understand what went wrong. Some people mistakenly believe it's related to bufffer overflow in the FIFO or because of some non optimized code. It could be the problem but MY PROBLEM FOR ALMOST A FULL YEAR has been this bug reported here. I really hope someone fix this and add a timeout so nobody would spent entire months anymore seeking a problem that's is really hard to track an intermitent. lapedNok 1 Quote Link to comment Share on other sites More sharing options...
gilperon Posted June 30, 2016 Author Report Share Posted June 30, 2016 Is this forum up? Nobody looks to answer anything here... Quote Link to comment Share on other sites More sharing options...
yangkai Posted July 1, 2016 Report Share Posted July 1, 2016 Hi ,gilperon Do you know why is the variable DMPpacketbuffer never initialized? because nobody here knows ,and I cant find any information about this variable. mike Quote Link to comment Share on other sites More sharing options...
jiangyan Posted July 25, 2016 Report Share Posted July 25, 2016 so it is 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.