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 bus reset with status info to user, re issue 1025 #2058

Merged
merged 2 commits into from
Jun 1, 2016

Conversation

dave-prosee
Copy link
Contributor

@dave-prosee dave-prosee commented May 26, 2016

I2C slave might stil have something to send when ESP826 starts I2C, thus
keeping the bus stuck.
Happens e.g. when power failure/reset during transmission.
Thanks to work of drmpf there is a solution.
Implemented as separate method (Wire.status()) so as not to interfere with existing.
Method (status)returns one of the five statuses. 0 or I2C_OK is ok.
Other status codes are for hanging SCL or hanging SDA

Usage:

Wire.begin();                                 //like normal
if (Wire.status() != I2C_OK) 
   Serial.writeln(error_msg);                 //Something wrong with I2C bus 
                                              //that cannot be recovered. 
                                              //Perform power cycle 
                                              //or search for other masters on bus;

I2C slave might stil have something to send when ESP826 starts I2C, thus
keeping the bus stuck.
Happens e.g. when power failure/reset during transmission.
Thanks to work of drmpf there is a solution.
Implemented as separate method so as not to interfere with existing.
Usage:

Wire.begin();
if (Wire.status() != I2C_OK) Serial.writeln("Something wrong with I2C
bus that cannot be recovered. Perform power cycle or search for other
masters on bus.";
I2C bus reset with info to user
@igrr igrr merged commit 3cfad27 into esp8266:master Jun 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants