I am using a 5k pullup resistor on my SDA and SCL lines. I am using a 62kHz clock signal on SCL. I have made two boards so far. For the first board I routed all the traces myself, but for the second I used the auto-router feature in Eagle. I routed the important traces myself, but for everything else, including SCL and SDA, I left things up to the auto-router.

For the first board, I get good performance on the I2C lines: Clean

However on the second board (auto-routed I2C lines), the traces show that the SDA and SCL lines are coupled:Dirty

From the logic capture, it appears that the communication still works on the second board. However the analog levels tell a different story.

Moreover, after running this test program on my microcontroller (PIC16LF), the program goes into a bad state. What I mean by this is that the I2C lines begin to float, and the clock signal becomes "stretched". I also have a debug LED that toggles with a certain event, and the pin the controls that LED seems to let go, as the LED flickers in a somewhat random way.

My questions are therefore:

1) Is this in fact caused by the layout?

2) What would cause the program to go into a bad state?

To give an idea of how bad the SDA trace looks, here is a screenshot of the the layout:


  • \$\begingroup\$ If the lines appear to be shorted then they very well may be shorted. Have you checked with an ohm meter? Many of I2C type chips have SCL and SDA on adjacent pins and you may very well have a solder short between those pins. If you etched your own board there may still be traces of copper between the pads causing the short. \$\endgroup\$ – Michael Karas Feb 25 '17 at 22:09
  • \$\begingroup\$ By the "steps" that show up on your logic analyzer it seems the trace capacitance is too high for 5k, so rise time is too long. Try changing the resistors for 2k2 or even 1k. A proper scope would also help showing this. \$\endgroup\$ – Wesley Lee Feb 25 '17 at 22:09
  • 1
    \$\begingroup\$ BTW - With an experience like this - whatever the root cause of the I2C problem - you may come to side with those like me that find zero utility with auto-routing traces on a PC board. \$\endgroup\$ – Michael Karas Feb 25 '17 at 22:11
  • \$\begingroup\$ Looking at your routing, the one thing I notice quite clearly is your pull-up resistors connect together than then to a very long thin trace off to wherever your power supply is. That long thin trace will mean your resistors are being pulled up to a weak voltage rail, meaning the SCL/SDA lines will float around together (your pull up resistors essentially connect them together). \$\endgroup\$ – Tom Carpenter Feb 25 '17 at 22:14
  • \$\begingroup\$ It doesn't surprise me you are having issues in any case - the whole board looks a complete routing mess with components randomly strewn around everywhere. If you spend the time to making a PCB look clean and neatly laid out, it will always work better. \$\endgroup\$ – Tom Carpenter Feb 25 '17 at 22:16

Your Answer

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

Browse other questions tagged or ask your own question.