
Description
This happens only with an Arduino as I2C Slave (connected to an Arduino as I2C Master).
If the Master requests a few byte with Wire.requestFrom(), and the Slave writes a few bytes in the onRequest handler, the Master sometimes gets 0 bytes.
Arduino version 1.0.5
This issue came in view with a slave at 8Mhz.
With two 16MHz Arduino boards, this problem still occurs at an average of 1 in 100 times.
With other boards it could happen only 1 in 1000 times, but also all the time.
A workaround seems to be a "delay(1)" between the "Wire.endTransmission()" and the "Wire.requestFrom()" in the Master. The Wire.endTransmission is part of writing the (virtual) registers address to the Slave, since I programmed the Slave to act like a sensor or memory chip.
After some testing I found that 6 micro seconds delay was enough.
I have made a test sketch and more explanation here, http://forum.arduino.cc/index.php?topic=172296.0