I brought the issue down to the first three lines of the loop() routine.
I also tried working code from other Arduino/Quadrocopter projects using this gyroscope, but no success..
To connect the sensor to the Arduino board I'm using a self-made level shifter with 4,7kOhm pull-up resistors which is working with other 3,3V components (i.e. BMA180 accelerometer).
Yes, but that's not the problem.
I can comment out these lines without getting better results.
It has to be an issue with the Wire library or something else.
Sorry, would be too complicated.
News:
I added some additional 3,3 kOhm pullup-resistors and when using another power source it's way more stable than before. But occasionally it crashes in 1 out of 10 times I restart the chip..
Try dropping the pull-up resistors down to 2.2k ohms. If you look at Invensense's own breakout board they use 2.2k ohms pulled up to a 3.0 volt supply. Even if you're using a 3.3 volt supply you can safely drop the resistors down to about 1k without having any issues. You'll get better noise immunity but the trade off is you'll pull a little more current which means more heat generated.
That will change the clock frequency from 100kHz to 400kHz, however if you're having stability issues running at 100kHz (if due to noise or improper pull-up values) then it will probably be worse running it at 400kHz. Changing the speed while using the same pull-up values will affect the signal profile. Check out this article ( http://www.dsscircuits.com/articles/effects-of-varying-i2c-pull-up-resistors.html) that shows the effects of changing pull-ups and speed and what the resultant waveforms look like.