jrowberg / i2cdevlib

I2C device library collection for AVR/Arduino or other C++-based MCUs
http://www.i2cdevlib.com
3.94k stars 7.51k forks source link

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

Open candardo opened 3 years ago

candardo commented 3 years ago

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:

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?

sylvanoMTL commented 3 years ago

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

candardo commented 3 years ago

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.

msaine commented 3 years ago

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 notifications@github.com Sent: Sunday, January 10, 2021 1:20 PM To: jrowberg/i2cdevlib i2cdevlib@noreply.github.com Cc: Subscribed subscribed@noreply.github.com 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.

orhanyor commented 3 years ago

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

trademark18 commented 3 years ago

@orhanyor That worked for me.