I2C problems!!!! Please help!!

I have been using the arduino mega 2560 with a simple sensor shield that contains a gyro, bma180 accelerometer, and magnetometer that all operate on i2c.

I was working on it tonight and after I uploaded code like 50 times the uploads started freezing mid way giving weird errors like saying its not the correct board ect... Now the only way I could fix this was to remove the wire.h library from the program and upload it. That library is critical to it working....I found out that if I disconnected the sensor shield before uploading the wire.h library could be used. Then I put the shield back on and reset the board...nothing, the program completely freezes. I then tried to burn the hex directly with my mkii and the program didn't freeze instead it had a tremendous delay....then told me none of the sensors could be found on i2c. The i2c line has pull up resistors and a level shifter. It seems as if placing the shield on the arduino totally freezes it.

Strange thing though is that it was working all night before then suddenly a new sketch just froze the entire thing permanently. I've tried talking to individual sensors and nothing its like the entire i2c hardware line on the arduino has been fried or its damaged. I can't see how 4 sensors all suddenly died.

I'm going to desolder all of the sensors tomorrow and manually test them all before I start to entirely blame the arduino I just need to make sure that its not a bug or something within the arduino or ide.

Any ideas???

might try this sketch - I2CScanner: Arduino as I2C bus scanner – todbot blog - to see if devices are recognized.

Do you have pull ups on the I2C? maybe they just draw too much current.

More about I2C see - http://www.gammon.com.au/forum/?id=10896 -

Same happened to me... i removed & reinserted Atmega from socket, after that all ok, for now... now it seems to work...

if you try I2C scanner, probably it won't work until you disconnect sensors...

The last time someone had a very similar problem with the sensor shield it turned out one of the contacts on the shield was shorting out to somewhere. A small bend of a pin sorted it if I recall correctly.

Sure enough it was the aeroquad shield that was causing the problem. I systematically removed every single part off the shield with my hot air rework station thinking I would find a "dud" that was messing up the i2c line and nothing happened. Then I took each sensor and bench tested them in a bread board....sure enough each sensor worked perfectly.

I looked over the circuit board many many times and have yet to find the problem it looks perfect but doesn't work. So I'm back to developing my code and soon to be a homemade breakout board for this stuff which is better anyway.

Thanks anyway!