Author Topic: I2C - Clock looks OK, Data line has DC Bias  (Read 1274 times)

0 Members and 1 Guest are viewing this topic.

Offline optoisolatedTopic starter

  • Supporter
  • ****
  • Posts: 71
  • Country: au
  • If in doubt, it's probably user error.
    • OpsBros
I2C - Clock looks OK, Data line has DC Bias
« on: July 11, 2019, 01:31:14 pm »
Hi All,

This ones confusing me... I have a simple I2C circuit trying to drive a 128x32 OLED Display. Worked fine when I prototyped it on an Arduino, moved it to a Wemos D1 Mini, no good. Checked the signal on an oscilloscope, realised I had forgotten to pull the lines high. Put 3K3 resistors on the data and clock lines. Clock line looks good now. The data line however doesn't look right.

Instead of having a full 0-5V it's ~3-5V, on the high side. Any idea what I'm missing here?  |O

Thanks :)

(I'm assuming a lot of the noise and overshoot is from the excessive loop area from the test leads.)
« Last Edit: July 11, 2019, 01:32:54 pm by optoisolated »
 

Offline AndyC_772

  • Super Contributor
  • ***
  • Posts: 4315
  • Country: gb
  • Professional design engineer
    • Cawte Engineering | Reliable Electronics
Re: I2C - Clock looks OK, Data line has DC Bias
« Reply #1 on: July 11, 2019, 01:47:11 pm »
Looks like the data line is shorted to a logic signal that's high, so the high level is OK but the low level is only halfway to where it should be.

As an experiment, try putting an additional 3k3 resistor between SDA and GND. This should, in theory, create a potential divider that puts it at ~2.5V. My guess is it'll remain high.

Offline optoisolatedTopic starter

  • Supporter
  • ****
  • Posts: 71
  • Country: au
  • If in doubt, it's probably user error.
    • OpsBros
Re: I2C - Clock looks OK, Data line has DC Bias
« Reply #2 on: July 11, 2019, 02:20:43 pm »
Had a dig around and couldn't see any shorts. I replaced the resistors, and tried a new Wemos D1. Didn't seem to help. I did try what you suggested with the divider, and it does bring down the high level.
 

Offline garethw

  • Regular Contributor
  • *
  • Posts: 88
  • Country: gb
Re: I2C - Clock looks OK, Data line has DC Bias
« Reply #3 on: July 11, 2019, 02:48:54 pm »
Next I would be disconnecting the wires from the Wemos and probing each side to determine where the 3.3v is coming from.


Sent from my iPhone using Tapatalk
Father
Husband
MENG Electronic Engineering student
 

Online ledtester

  • Super Contributor
  • ***
  • Posts: 3282
  • Country: us
Re: I2C - Clock looks OK, Data line has DC Bias
« Reply #4 on: July 11, 2019, 02:52:43 pm »
This guy got it working - blog post also shows his setup:

https://blog.hau.me/2018/12/26/i2c-oled-display-on-a-wemos-d1-mini/

Another idea... here is an i2c bit-banging Arduino library. You can try using some other IO pins to see if that makes a difference:

https://github.com/Testato/SoftwareWire

The library has a printStatus() method. #define ENABLE_I2C_SCANNER on line 60 and it will perform a device scan when called.
 

Offline garethw

  • Regular Contributor
  • *
  • Posts: 88
  • Country: gb
Re: I2C - Clock looks OK, Data line has DC Bias
« Reply #5 on: July 11, 2019, 02:59:37 pm »
Thinking about it a bit more I would think that the pin is configure for push/pull instead of open drain. A short on the line will simply be shorted to ground if that were the case.


Sent from my iPhone using Tapatalk
Father
Husband
MENG Electronic Engineering student
 

Offline optoisolatedTopic starter

  • Supporter
  • ****
  • Posts: 71
  • Country: au
  • If in doubt, it's probably user error.
    • OpsBros
Re: I2C - Clock looks OK, Data line has DC Bias
« Reply #6 on: July 11, 2019, 03:03:24 pm »
I think you're on the right track. It seems that the Adafruit library doesn't work properly on the Wemos D1. I switched to the generic SSD1306 library which allows me to use alternate pins for the I2C. using D3 and D5 works a treat. Thanks for your help :)
 

Offline optoisolatedTopic starter

  • Supporter
  • ****
  • Posts: 71
  • Country: au
  • If in doubt, it's probably user error.
    • OpsBros
Re: I2C - Clock looks OK, Data line has DC Bias
« Reply #7 on: July 12, 2019, 08:41:19 am »
Changed the I2C pins to D3 and D5. Bingo, I2C bus works now. Pretty sure that the issue is that the Wemos D1 mini module I am using is actually a ESP8266MOD and pin D1 is actually used as as an Active High boot inhibit for flashing with the USB Interface. I noticed during testing that I needed to pull that pin low to make it boot on power up, so a bit more digging led me to that that module actually uses D3 and D5 for SDA and SCL.

It all makes sense now.

Thanks so much for your help :)
« Last Edit: July 12, 2019, 08:42:53 am by optoisolated »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf