Spymon Posted March 1, 2014 Report Share Posted March 1, 2014 Hello everybody, First of all, thanks a lot for the Library, this saved me a lot of precious time! I'm here to ask for a little help : I'm using an Arduino Due (using arduino 1.5.5-r2 software) to read the data from my MPU6050, using the DMP. I read the angles using the same code as in the example code for the DMP and I tried a lot of different configurations, without any change. I noticed that reading the values takes my approximately 6ms. This is a little bit long for me, but the interesting thing is that the sketch spends 5ms of the 6 in the call of this function: // read a packet from FIFO mpu.getFIFOBytes(fifoBuffer, packetSize); I don't understand how this can be so long. This is just reading registers and the packetSize is only 42... So here are my questions. Is this normal with an MPU6050 or is there effectively something strange ? Does anybody have any idea why this is happening? When this function is called, the data should be ready, so why do I loose so much time ? I hope somebody will be able to help me with this, because otherwise I'll have to read the raw data and process them by myself. So thanks in advance for your answers! Quote Link to comment Share on other sites More sharing options...
luisrodenas Posted March 5, 2014 Report Share Posted March 5, 2014 What I2c speed are you using? MPU supports up to 500KHz and Arduino's default is only 100KHz Quote Link to comment Share on other sites More sharing options...
Spymon Posted March 6, 2014 Author Report Share Posted March 6, 2014 Hello, tanks for your answer. That was the problem. I tried several ways to change the speed, but in fact none of them was really working (as I'm using a Due it is different)... So I had to modify a define in the Wire library in the folder sam of hardware. So the problem is now solved,thanks! But is there a solution I could put in the code, instead of modifying the library? And this would be useful to update the examples in the library to work properly with an arduino Due. Quote Link to comment Share on other sites More sharing options...
luisrodenas Posted March 6, 2014 Report Share Posted March 6, 2014 Glad it worked. I don't know if it is possible to change it in the program, I always change it in the library. Quote Link to comment Share on other sites More sharing options...
Spymon Posted March 9, 2014 Author Report Share Posted March 9, 2014 Ok, thanks a lot for your reply ! Quote Link to comment Share on other sites More sharing options...
adik1323 Posted November 14, 2016 Report Share Posted November 14, 2016 Hello I've had the same problem today. Thanks for the idea to change the I2C speed. I've solved it through the code (without lib modify). Just one code line: Wire.setclock(500000L); This line sets the data transfer speed to 500kHz (example speed). 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.