5
\$\begingroup\$

Background Information

I am designing a small PCB for 4* I2C devices, the baud rate of the I2C is not a major issue so 100kHz was the target. The I2C devices are a RTC, LM75, 24AA04 and a MSP23017 to drive an LCD, the board is made using a LPKF milling machine. Before fully populating the board I thought I would test one of the devices and the LM75 seemed like the easiest option. Quick edit: VCC is 5V and the Pull-Ups are both 10K

Have included some images to give you an idea of the layout:

1st image shows the PCB top view (Address jumpers to the top right, all grounded for testing) enter image description here

2nd image shows the I2C traces, the grid dimension shown is 1.27mm (J11 to the left is connected to the OS pin, but left floating at the moment) enter image description here

The Issue

I am testing this with an Arduino Uno (5V VDD) with some very simple code that polls the LM75 every second. Establish a valid reading is intermittant but once established it works fine for about 2 minutes and then hangs, both I2C lines go high. To establish a link again I have found sending an alternative slave address a few times and reverting back to the correct address usually works, then the same thing will happen.

Again I have some more images as capture the handshaking on my oscilloscope:

3rd image shows the setup (not the best I know, ignore the resistors by the jumpers originally fitted 1k's here and the inserted shorting links as per the 1st image)) enter image description here

4th image shows the first oscilloscope trace with valid data and some visible cross talk (circled in red), is this level of cross talk worth worrying about? Good post I was reading on this subject At what point does crosstalk on I2C become a problem? enter image description here

5th image is just a smaller time base so the waveform can be seen in more detail enter image description here

Would be really interested in any advice possible, I probably need to re-work the board but any suggestions on testing would be great. I have read a few post and was under the impression I2C on these lengths and low speeds should be ok, but quite sure I have made a rookie mistake!

Thanks in-advance, Ant

----UPDATE----

I found the issue eventually a week or so ago but not had time to post an update until now. I was convinced it was my PCB but it turns out that I was only requesting 1 byte from the LM75A, when I needed to request 2.

All the pointers on the hardware where incredibly useful, these allowed me to improve the design and I eventually settled on 2k2 pull-ups, which improved the I2C waveform (image below).

enter image description here

I accepted the only answer and also some of the comments as all proved useful.

\$\endgroup\$
11
  • 1
    \$\begingroup\$ Is Vcc = +5V (that's what I see on the oscilloscope screenshots, please confirm)? What value are the pull-up resistors on the I2C lines? \$\endgroup\$ Apr 13, 2015 at 18:22
  • \$\begingroup\$ Hi Nick, sorry I should have mentioned this and will edit. VCC is 5V and I am using 10K pull-ups as per the datasheet. I did originally test 2.7k and 4.7k with similar issues but don't have any oscilloscope traces for those. \$\endgroup\$
    – Ant
    Apr 13, 2015 at 18:23
  • 2
    \$\begingroup\$ It looks like you have proper start and stop sequences at the beginning and end of messages. A more time-expanded scope trace so the relative timing of edges is more obvious would be useful. First thing I'd do is to use stiffer pullups, at least until you get past this bug and you want to reduce current some time later. Replace the 10 kOhms pullups with 2 kOhms and see what that does. At the very least that will give you crisper edges to make diagnosing the problem easier. \$\endgroup\$ Apr 13, 2015 at 18:32
  • 1
    \$\begingroup\$ Do you currently have bypass caps installed on the board near the LM75? If not, give that a try. Also, the board was milled, right? How did you get continuity for your through-hole vias? Is it possible you have an intermittent connection somewhere due to poor continuity from top to bottom? \$\endgroup\$
    – mkeith
    Apr 13, 2015 at 19:20
  • 1
    \$\begingroup\$ Hi mkeith, I used 0.8mm wire to solder through all the via's and soldered both sides. I have continuity tested all the ones directly related to the incoming I2C and LM75, but was planning to re-tin all these again tomorrow to be sure. The pulls only need to be soldered on the top side closest to the MCU connector pins, the other side is only a bottom trace connection. \$\endgroup\$
    – Ant
    Apr 13, 2015 at 19:30

1 Answer 1

1
\$\begingroup\$

The small glitches you're seeing towards the ends of the last two bytes might be due to the master releasing the line so the slave can ACK. If that's the case, it's not crosstalk, it's just something that happens with I2C. It shouldn't be a problem.

I second the suggestion to try stiffer pull-ups and add a bypass capacitor to the LM75 if there's room for one. If this is a homemade circuit board, you should also measure the trace resistances to verify that the connection is good. You could also try reducing the bit rate. If that doesn't help, use your scope to look at the last transfer before the fail. A non-auto triggering mode will do this. Determine whether it was ACKed or NAKed or something else. Try to figure out how many transfers it takes to produce the fail. Is it the same number every time? Does polling more often than once per second make the system fail sooner?

\$\endgroup\$
6
  • 1
    \$\begingroup\$ Adam thanks for the pointers I will follow yours a Olins advice on the smaller pull-up and the approximate calculation I made was about 2.7k max, but had similar issues so went for the datasheet recommendations. I will try 2.2k and 1.8k possibly. Never heard of the bypass caps so will carry out some research on this now, if you have any good links for this feel free to share. I will also try and capture the last good transfer a great advice. \$\endgroup\$
    – Ant
    Apr 13, 2015 at 19:41
  • 1
    \$\begingroup\$ A bypass cap is usually a 0.1uf capacitor between the power and ground pins of an IC. If there are multiple power pins, you want one capacitor for each. This is especially important for digital ICs since they tend to draw high currents over short periods of time (clock edges). The inductance of the power traces prevents the trace current from changing quickly, so the bypass capacitor makes up the difference. \$\endgroup\$
    – Adam Haun
    Apr 13, 2015 at 19:50
  • \$\begingroup\$ Arh ok a decoupling capacitor yes I have some on the board, not soldered them at this stage, which is stupid upon reflection. I will put one across the IC for a test as should be able to squeeze it on. \$\endgroup\$
    – Ant
    Apr 13, 2015 at 19:53
  • 1
    \$\begingroup\$ For this application, just put a 0.1uF ceramic capacitor (either disc type with leads or surface mount) as close as possible to the VCC and GND pin of your LM75. That is, one capacitor, one lead connected to VCC, and the other lead connected to GND. \$\endgroup\$
    – mkeith
    Apr 13, 2015 at 19:54
  • 3
    \$\begingroup\$ Not stupid! It is just an omission easily made. It is only stupid if you do it over and over again. ;-) \$\endgroup\$
    – mkeith
    Apr 13, 2015 at 19:55

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.