Gyroscope crashes Arduino

Hi folks,

I'm using an Arduino Pro Mini board with an Atmega 328, 5V.
To measure the layer of a quadrocopter I wanna use the ITG-3200 Gyroscope.

Problem is:
After a bunch of values given (approximately 10) the Arduino freezes.

The code in the loop() function causes this problem, the setup() routine works fine.

void loop()
{
    Wire.beginTransmission(gyroAddress);
    Wire.send(0x1F);
    Wire.endTransmission();
    Wire.requestFrom(gyroAddress, 2);
    rawData = (Wire.receive() << 8) | Wire.receive();

    delay(100);
    
    Serial.println(rawData);
}

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).

Any kind of help is appreciated..

    Wire.requestFrom(gyroAddress, 2);
    rawData = (Wire.receive() << 8) | Wire.receive();

What does this code do if there are not two bytes to receive? Just because you ask for 2 does not mean you will get 2.

Thanks for your response!

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.

Is there anyway you can post a schematic?

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.

I'll try this, thank you.
I also found another helpful idea, but haven't tested it till now:
http://aeroquad.com/showthread.php?991-AeroQuad-Flight-Software-v2.0&p=11262&viewfull=1#post11262
Here it says:

Writing
TWBR = 12; after Wire.begin();
You can increase de I2C speed (frecuency), see Atmel documentation.
Probably you can read sensors faster.

And another Quadrocopter Project using the ITG-3200 chip uses this command.

Do you know what it exactly does?

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.