![]() It could be the problem but MY PROBLEM FOR ALMOST A FULL YEAR has been this bug reported here. Some people mistakenly believe it's related to bufffer overflow in the FIFO or because of some non optimized code. I am pretty sure maaaany MAAAANY other people alterady experienced this problem and spent a lot of time trying to understand what went wrong. 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. I2Cdev::readBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_t *data, uint16_t timeout) I checked the function "readBytes()" inside I2Cdev.cpp and I found this: Return (((uint16_t)buffer) << 8) | buffer ![]() I2Cdev::readBytes(devAddr, MPU6050_RA_FIFO_COUNTH, 2, buffer) Inside the file MPU6050.cpp there is a code like this: So I discovered everytime my arduino hanged/freezes it was at a line with getFIFOCount() or getIntStatus(). I discovered that inserting many Serial.print with tags along my entire code so I could know exactly which line hanged. I discovered it is usually when executin getFIFOCount() or getIntStatus(). 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. Sometimes my Arduino freezes or crashes when using JEFF ROWBERG library to read DMP data from MPU6050.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |