-
Notifications
You must be signed in to change notification settings - Fork 13.3k
i2c scanner not working correctly #254
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
I also have a problem with I2C communication when I build form current source. I have an I2C accelerometer which I can sucessfully read out with the precompiled linux release. But it does not work anymore in the current version built from source even when I call Wire.begin instead of the depricated Wire.begin. I will gladly assist in any debugging if that helps. |
Well, after a short digging within the source code I found the problem. |
@wizard23 can you capture the interaction using a logic analyzer or an oscilloscope? |
I measured with a oscilloscope and it seems that in the new version the data pin remains floating while the clock pin seems fine. In the old version and with the same oscilloscope both cloc and data seem fine. I'm not 100% sure if it's really floating or stays high all the time with a lot of noise. |
Can you please share the picture you see on the scope? Do you have a pull-up resistor on the SDA line? |
Have tried Wire.begin(sda,scl); using pins 4 and 5 and other combinations of begin functions including //Wire.setClock(40000); and many other speeds to no avail |
have to check your edits with my I2C things here, because some lines you removed deal with shitty slaves that do not want to release the data line on time. |
I'm currently running some I2C things on my ESP without any modifications to the Wire lib |
#303 |
I guess some devices need clock cycles to finish an operation. Had caught this in the read method, but never got it in write. |
So I wish to update so I can get this working . How do I do that now with the json setup? I have update at startup ticked . Will that do it automatically or do I have to do something else? |
I'm not positive... I think that @igrr needs to update the package as well so you get the latest code. Then you need an Arduino 1.6+ info on how to add the json is on the forum as well :) |
I just tested by building from current source and it works with Wire now :) I will make a scope picture in the next days. :) |
I'm so jealous that you have a 70 MHz digi scope... any picture is like porn to me... |
wow? this is which new code? looks like what you had changed. @igrr also sent me some images and this is what clock looked like with the commenting of the lines and moving the clock. With my source, they should be all about equal pulses? |
I'll run a test on my side again a bit later to make sure what went into On Tue, May 26, 2015 at 1:24 PM, ficeto [email protected] wrote:
|
@wizard23 I imagine that you have that scaled so two of the big squares are 3.3V? The fluctuations at clock change are really bothering me... quite the spikes... |
scaling is at 2V so yes the big squares are 3.3V. |
latest test was done with version built from: 49c25b9 |
strange. I must have messed up, sorry. I will check that again. |
nothing to be sorry about, you are actually helping :) are you using pull-up resistors on the I2C lines? |
any progress on this? |
ok, i got a bit too excited on @wizard23's DSO porn and got me one of those :) |
Here i'm using 1K resistors to pull the lines as they seem to get the best square looking signal |
I'm curious . I'm trying to get a sparkfun breakout board of the BMP180 running correctly . It has 4.7K pullup resistors built in . How about trying your new scope with 4.7 K and show us the pic ? |
I got I2C device (BMP180) working properly at this speed (80 Mhz) with this change in the BMP180 library |
I see on the datasheet from Bosh that 2.2K to 10K are fine . What does the scope look like with 10K ?
|
Little bit cliquey here are we , don't talk to anyone outside the circle? |
sorry for taking so long. It works now and the timing looks correct. I must have mixed up the arduino ide i was using since i have so many now :) |
@tytower I cant give you a scope pic of the difference between 2.2k and 10k pullups because I dont want to solder around on my board. but from what I know I think the one with the 10k pullups will have less steep rising edges because the 10k resistor takes longer to charge the parasitic capacitance in the i2c wires. So for high I2C speeds you need lower resistors but it also "wastes" more energy since current will flow through the resistors every time the wire gets driven low. This is probably only a concern in battery powered low power apllications like a I2C realtime clock that should run for several months. |
Thanks for the explanation I understand more nowOn Tue, 16 Jun 2015 04:37:21 -0700
Yahoo [email protected] |
Think I found a small bug in the implementation of the protocol. While using I2C scanner, it did find my I2C device only once. This device is actually an ATMega328P running a Slave receiver. It worked pretty well with other microcontrollers as a slave. After analyzing the signals with a protocol analyzer, I found out that the STOP condition never was sent after a NACK was received, even after using Wire.endTransmission(1); So I added the code for twi_writeTo in core_esp8266_si2c.c to:
This way, the STOP condition will be sent. Apparently, the ATMega hardware needs this to function. Now it works well. |
I am trying to run the i2c detect script from Arduino from http://playground.arduino.cc/Main/I2cScanner
I modified the setup and started with
Wire.pins(2, 0);
Wire.setClock(100000);
Unfortunately, the code returns error == 0 for all addresses.
Am I doing something wrong? Did I not understood something?
The text was updated successfully, but these errors were encountered: