5
\$\begingroup\$

As a forewarning, this is my first PCB. I am experiencing issues with the I2C bus. There are two I2C slaves on this bus (SSD1306 display and BQ27441 Fuel gauge, currently the program only sends commands to the display at 0x3C, so I'm not worry about the other device causing problems right now.)

My first concern was noise issues because I did not realize it was poor practice to route the I2C signals next to each other, so I cut the traces and re-routed using magnet wire. This resulted in the same exact issue. The issue is: the screen only displays for about a second, not even, and then cuts out. I changed out the pull-up resistors to pretty low values (1.1k, originally 4.7k but the rise time on the oscilloscope looked pretty bad). Important note: the screen did not work at all before this change. However, the screen is still very intermittent, which leads me to believe this was not the direct cause.

The SDA trace is 71.5mm and the SCL trace is 80.8mm, I didn't think length matching would be important at 400kHz, but thought I would include the information. Also, would cross-coupling be an issue here potentially? The clearance is about 5mil I believe. It probably wasn't the best idea to route under the ESP32 either...I've definitely been learning the hard way on this project.

It is a 2-layer board, most of the bottom layer is a ground plane, there are a couple very small sections of the I2C traces that go down to this layer. Top Layer and Bottom Layers are 0.03556mm thick separated by an FR-4 dielectric of 1.6mm.

Please note that this code was verified on the ESP32 DevKitC V4 and was working perfectly. I also tested different frequencies on the I2C bus as well (100kHz, 400kHz, and 700kHz).

From the oscilloscope capture, my first guess would be too high of a bus capacitance, but I would like some other opinions before I am forced to do another board revision.

I also captured the communication with a logic analyzer as seen below. It repeatedly is doing a setup write to 0xF8 which does not appear in the code at all (based on oscilloscope capture I would not expect anything meaningful from a logic analyzer anyways, but for completeness), again pointing to a hardware issue.

It does not appear to be power issues either because both 3v3 and 5v rails seem stable.

Edit: I've cut the traces going to the fuel gauge to eliminate any possible bus contention, still nothing. I also added schematic, along with oscilloscope set-up and another oscilloscope capture with repeated "data". It is interesting that the signals appear to be pretty much exact opposites. SCL & SDA traces going under a ESP32 on top layer

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here Red: SCL (CH1), White: SDA (CH2), Orange: GND

enter image description here

I managed to capture this ^^ as soon as I plugged my board into micro-USB....interesting. This shouldn't be a power issue, the DC-DC converters are rated for over an amp each at their voltages of 3v3 and 5v, not drawing anywhere near that.

enter image description here

EDIT: I was stubborn regarding answers about the oscilloscope ground, but for the wrong reason! The J2 header is having ground issues apparently, I was able to capture this on the scope using one of the mounting holes as a ground reference for the scope, I will have to check the solder connection for the header, or maybe even replace the header as there was a tiny bit of flux that surrounded the header and may have got stuck in there? I did verify the GND pin on J2 goes directly to the ground plane on the bottom layer. enter image description here

\$\endgroup\$
  • 5
    \$\begingroup\$ 1. How was the scope probe ground connected when you took the scope trace? 2. You mention having both 3.3 and 5 V power supplies. Which one are your I2C devices powered by? Which one are your pull-ups connected to? \$\endgroup\$ – The Photon Feb 19 at 5:26
  • 4
    \$\begingroup\$ I2C is pretty forgiving of layout issues. My first suspicion would be something else. Like you forgot pullups or used the wrong value of pullups or you have contention on the bus (someone driving it when they shouldn't be). Etc. \$\endgroup\$ – mkeith Feb 19 at 5:27
  • 1
    \$\begingroup\$ Can you post a picture of how the scope is connected to the SCL/SDA lines? Also, as mentioned above, a schematic could be useful. \$\endgroup\$ – crj11 Feb 19 at 5:45
  • 1
    \$\begingroup\$ Going to add picture of oscilloscope setup and schematic soon! Thanks for the help so far, as you guys mentioned I2C is not differential. Additionally, I did recheck probes with built-in test signal, they're fine. \$\endgroup\$ – seggles Feb 19 at 6:29
  • 2
    \$\begingroup\$ Please don't ignore the suggestions about the scope. You really need to know if the ground is floating or if the scope is falsely showing that. The vast improvement when you plugged the USB in says it was a scope grounding issue. \$\endgroup\$ – Annie Feb 19 at 21:01
5
\$\begingroup\$

I would like to take this time to apologize to the people of the Internets, I was wrong by ignoring those who suggested grounding issues with the oscilloscope. It was, in fact, a ground issue with the GND pin of J2. After attaching the ground probes of the oscilloscope to one of the mounting holes instead, I was able to capture this on the oscilloscope, a set of beautiful signals. Thanks all you lovely people for your assistance. Let this be a lesson of many for me in my future endeavors as I enter the world of electrical engineering (graduating in May).

enter image description here

\$\endgroup\$
  • \$\begingroup\$ +1. All in all, good job, and good attitude. \$\endgroup\$ – mkeith Feb 23 at 5:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.