Jump to content
I2Cdevlib Forums


  • Posts

  • Joined

  • Last visited

  • Days Won


Reputation Activity

  1. Like
    gilperon got a reaction from lapedNok in MPU6050 pausing it   

    I am pretty sure Jeff's MPU6050 library is the best in the internet to retrieve ypr angles from MPU6050 using the DMP on arduino. It's a really good library but it's not easy to beginners cause the way the basic Arduino code to retrieve ypr from the DMP is a little complicated.

    Anyway, after spending almost 3 months I am confident I understand very well the code and it works really fine. But I found a problem: sometimes I really need to execute some routine that can take up to 3 to 10 seconds and Jeff's code simply crashes. Sometimes Arduino freezes and no FIFO OVERFLOW error message is displayed, other times the error message is displayed. I know that using DMP relies on interrupt and my code must be really really really optimize in order to not hang arduino for too long.

    So I decided that before doing my routine I should do mpu.setDMPEnabled(false) and after I finish my routine I should do mpu.setDMPEnabled(true);. But there is a problem: after I execute mpu.setDMPEnabled(true); the MPU6050 restarts its internal "calibration" algorithm and takes at least 5 to 8 seconds to get solid readings to ypr.

    Doing the method above I can at least prevent fifo overflow or my arduino to freeze, but it creates another problem cause now my new readings (after mpu.setDMPEnabled(true) are not precise anymore for at least 5-8 seconds.

    Is there someway to ignore DMP readings without overflowing the buffer and at the same time doing something else so in the future I can start to pay "attention" again to DMP and keep reading its angles without any recalibration?

  2. Like
    gilperon got a reaction from lapedNok in Serious bug with jeff rowber library to use with MPU6050   
    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.
  3. Like
    gilperon got a reaction from Ekbergdub in Jeff Rowberg library: how to obtain angles without buffer   
    Hi everyone,
    I am using in the last months the really nice library provided by Jeff which is A M A Z I N G. Thank you man
    I am using it in my quadcopter and works really nice (thank you again). But there is a problem: I dont like the idea of using sensor fusion cause it is too complicated to setup with arduino and also uses too much proccessing power from my arduino. That's why I am using the DMP angle values from the MPU6050.
    The problem is this, after days trying to find a solution: I would like someway to obtain angles from MPU6050 DMP calling a function "get_angles()" not using interrupt pin or the buffer.
    The reason is that I make many other computation in arduino and frequently the buffer of MPU6050 overflows and my quad get out of control and fall. I already reduced the frequency that the buffer gets populated to the minimum but I still sometimes get overflows.
    That's why I would like to know if there is some way I could retrieve angles from MPU6050 using a function exactly like "mpu.getMotion6" but with angles, not with giro and accel data.
    Thank you so much, you helped me a lot with this great and very well documented library.
  • Create New...