Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I2C/Wire library: Timing issue between Master-receiver and Slave-transmitter #1477

Closed
ghost opened this issue Jun 20, 2013 · 2 comments
Closed
Assignees
Labels
Component: Core Related to the code for the standard Arduino API Library: Wire The Wire Arduino library Type: Bug
Milestone

Comments

@ghost
Copy link

ghost commented Jun 20, 2013

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

@sandeepmistry
Copy link
Contributor

This is reproducible with @PaulStoffregen's example sketches from http://forum.arduino.cc/index.php?topic=172296.msg1289288#msg1289288 and two Uno boards

sandeepmistry added a commit to sandeepmistry/Arduino that referenced this issue Aug 27, 2015
sandeepmistry added a commit that referenced this issue Oct 22, 2015
@sandeepmistry
Copy link
Contributor

Fixed by #3735

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Core Related to the code for the standard Arduino API Library: Wire The Wire Arduino library Type: Bug
Projects
None yet
Development

No branches or pull requests

3 participants