Grove - 3-axis Accelerometer freezes

Grove is a modulated, ready-to-use tool set.
Much like Lego, it takes a building block approach to assembling electronics.

Moderators: lily.li, violet, jeremy882, crail.lyu969

Post Reply
anticyclope
Pre-kindergarten
Pre-kindergarten
Posts: 3
Joined: Wed Jan 25, 2012 11:09 am
Are you a staff member of seeedstudio?: no
Which products/projects are your favorite?: Grove - 3-axis Accelerometer

Grove - 3-axis Accelerometer freezes

Post by anticyclope » Wed Jan 25, 2012 11:36 am

Hello,

I've recently bought a Grove - 3-axis Accelerometer, based on MMA7660 chip. I've connected it to my Arduino, 10 centimeters wires to breadboard, then another 10 from breadboard to Arduino. I'm using the code provided on wiki page for the product, and I can successfully read the data from all 3 axis. However, at some unspecified time serial output freezes, and it seems like the whole Arduino freezes completely, and the only way to unfreeze it is to reset it.

What could be the problem? Wire length? Default Wire library? I2C clock speed is too high?

Thank you.

spanner888
Pre-kindergarten
Pre-kindergarten
Posts: 12
Joined: Sat Dec 04, 2010 8:30 am
Contact:

Re: Grove - 3-axis Accelerometer freezes

Post by spanner888 » Thu Jan 26, 2012 9:21 am

I am having the same issues. I my case I read samples OK in a very short test, but it was only when I tried a fast loop to see haw many times a second I could read the sensor (thinking about trying real time motion tracking - 120 samples per second) that I experienced the freezes. My tight loops have completed 20,000 reads before lockup, but have also locked up at 9,000 reads. This is using Arduino GUI 1.0 release and the updated wire libraries that it comes with.

Looking around the web produces a LOT of issues that seem to be related to the Arduino wire library. Seems like it has bugs, and also "blocks" ie waits forever in some situations for a response. This is a big issue for the people with helicoptors as this causes expensive crash!

I have only just run into this issue and started looking, so don't have any solution yet. Things I can see are:
  • a lot of issues with the Arduino Wire lib
  • apparently the additon of I2C (and maybe other functions) to the Wire lib has made it large and unwieldy and buggy
  • many requests & suggestions to modify the wire lib
  • 3rd party I2C libs
  • I2C libs that are assembly - ie you have to do all your code in assembly....
This is as far as I have got and was checking back here for more ideas when I found your post. I'll post any updates as I (hoepfully) progress.

anticyclope
Pre-kindergarten
Pre-kindergarten
Posts: 3
Joined: Wed Jan 25, 2012 11:09 am
Are you a staff member of seeedstudio?: no
Which products/projects are your favorite?: Grove - 3-axis Accelerometer

Re: Grove - 3-axis Accelerometer freezes

Post by anticyclope » Thu Jan 26, 2012 10:46 am

I decided to start from the simplest part: replacing Wire library to something else. The first third-party library I've tried was found here: http://dsscircuits.com/articles/arduino ... brary.html

Code changes were insignificant, example sketch was enough to understand, how's library working.

And that was enough! I can now run measurements with any sampling rate, and I didn't notice any freezing or something like that. All you need is to put default Wire library into trash can and find something more acceptable.

spanner888
Pre-kindergarten
Pre-kindergarten
Posts: 12
Joined: Sat Dec 04, 2010 8:30 am
Contact:

Re: Grove - 3-axis Accelerometer freezes

Post by spanner888 » Thu Jan 26, 2012 11:40 am

that is good news.

... except I cannot access it from my location :(

Is that library also hosted on an SVN or somehwere else?

anticyclope
Pre-kindergarten
Pre-kindergarten
Posts: 3
Joined: Wed Jan 25, 2012 11:09 am
Are you a staff member of seeedstudio?: no
Which products/projects are your favorite?: Grove - 3-axis Accelerometer

Re: Grove - 3-axis Accelerometer freezes

Post by anticyclope » Thu Jan 26, 2012 9:55 pm

I put the library to Dropbox, you can find it at http://dl.dropbox.com/u/614850/I2C.zip
The guy who wrote it is Wayne Truchsess

Post Reply