i2cdevlib icon indicating copy to clipboard operation
i2cdevlib copied to clipboard

MPU6050 and Arduino: always freezes after a while, ok with Electronic Cats fork

Open candardo opened this issue 5 years ago • 5 comments

I spent some time trying to get my MPU-6050 breakout board to work (GY-521). Raw data is fine but I need ypr angles and I want to take advantage of the DMP onboard so I tested i2cdevlib libraries and included examples. It works pretty well and data seem stable and correct but all the examples freeze after a while (some seconds to a few minutes). I read some FAQ, forums and issues but nothing fixed the problem:

  • https://www.i2cdevlib.com/forums/topic/27-fifo-overflow/ FIFO rate divider
  • https://www.i2cdevlib.com/forums/topic/414-freezing-problem/ AD0 to GND
  • https://github.com/jrowberg/i2cdevlib/issues/556 Fastwire (compile error here)

As a last resort a tried the library from Electronic Cats. I didn't expect much since it's still based on i2cdevlib (AFAIK) and I expected it to be less maintained. Anyway I installed it via the Arduino IDE library manager and flashed the example MPU6050_DMP6.ino. With that version no freezes occur, and I tested it for hours! Nonetheless MPU6050_DMP6_using_DMP_V6v12.ino from that library still fails.

Is there some sort of regression in the code? Are there solutions I couldn't find? Is it an hardware related problem?

candardo avatar Jan 06 '21 16:01 candardo

Are you using the interrupt pin? if so, do you have the pin interrupt linked to the correct GPIO of your board?

sylvanoMTL avatar Jan 10 '21 18:01 sylvanoMTL

I am using the interrupt on pin 2 of an Arduino Uno board. As I said the code does work but it freezes after a while.

candardo avatar Jan 10 '21 19:01 candardo

Has anyone done a serious check for a memory leak? This seems to me to be an ongoing problem, running for a while then freezing. A ISR that doesn’t clean up after itself or a Malloc not matched with an associated free?? This running for a while then quitting report has been running thru this thread for a couple of years it seems.

Just my 2cents worth

From: candardo [email protected] Sent: Sunday, January 10, 2021 1:20 PM To: jrowberg/i2cdevlib [email protected] Cc: Subscribed [email protected] Subject: Re: [jrowberg/i2cdevlib] MPU6050 and Arduino: always freezes after a while, ok with Electronic Cats fork (#564)

I am using the interrupt on pin 2 of an Arduino Uno board. As I said the code does work but it freezes after a while.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/jrowberg/i2cdevlib/issues/564#issuecomment-757528861, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAWY7E67XCQQMPIF3DYAHB3SZH4UTANCNFSM4VXYRZGQ.

msaine avatar Jan 10 '21 19:01 msaine

have you tried this https://github.com/jrowberg/i2cdevlib/issues/519#issuecomment-752023021

orhanyor avatar Jan 10 '21 22:01 orhanyor

@orhanyor That worked for me.

trademark18 avatar Jan 16 '21 18:01 trademark18