-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Multiply Wire.begin(int sda, int scl) call from different libraries #2607
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
Comments
Modify the other library to not call Wire.begin(). |
i had the same scenario, and indeed - modified all the libs i needed, and maybe if you use the sensors too quickly one after the other, the Wire lib On Fri, Oct 14, 2016 at 10:21 PM, WereCatf [email protected] wrote:
|
I use an i2c display and an i2c ADC together without any issues. |
I have to modified all standard & custom libs and it's going create a mess and frustration for people in the future. I still believe that the modification should be done in ESP core.
This is interesting idea I'll check it. |
It duplicate of #2162 , Wire.begin call should be rewritten to take account of multiple calls. |
Looks like I found the solution. In each lib after Wire.begin(int sda, int scl) I added Wire.setClockStretchLimit(1500); and everything work fine. |
You make a workaround not a solution to this problem!! |
This was not fixed. It can't be handled through a custom core work around. |
I've rewrote the Wire library. Works good - https://github.com/enjoyneering/ESP8266-I2C-Driver |
Is is fully working and tested? If so, Why not do a pull request and see if they accept it. |
Hi, |
Hi, |
Also noticed problems with ESP8266 (NodeMCU) Started to examine the problem and found a page in Russian: The author fixed libraries:twi.h Wire.h https://github.com/enjoyneering/ESP8266-I2C-Driver Copy and replace "twi.h", "core_esp8266_si2c.cpp" in folder %USERPROFILE%\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\cores\esp8266 Copy and replace "Wire.h", "Wire.cpp" in folder %USERPROFILE%\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\libraries\Wire I think it can be useful to others. |
Hardware: NodeMCU1.0
Core Version: 2.3.0
Description
NodeMCU1.0 reboots or acting weird after second Wire.begin(int sda, int scl) call.
Settings in IDE
IDE: 1.6.11
Module: NodeMCU1.0
Good day everyone,
I have a couple of i2c sensors connected to the same pins (D1, D2) . The first sensor is HTU21D and the second is BH1750FVI. Also tried combination of i2c LCD screen and HTU21D. The same story every time - NodeMCU1.0 reboots or acting weird.
I'm using the libraries to interact with sensors and screen. Each library has its own Wire.begin(int sda, int scl) call during the initialization. Most of the time after the second Wire.begin(int sda, int scl) call NodeMCU1.0 reboots.
I've tested the code on Arduino Nano with hardware i2c bus and it works fine. I guess it happens because esp8266 uses software i2c and the second Wire.begin(int sda, int scl) call to the same pins breaks the logic.
Dose anybody know how to fix it?
Thank you.
The text was updated successfully, but these errors were encountered: