Author Topic: Decoupling caps + resistors for I2C over twisted pair  (Read 10606 times)

0 Members and 1 Guest are viewing this topic.

Offline StarlordTopic starter

  • Frequent Contributor
  • **
  • Posts: 325
  • Country: us
Decoupling caps + resistors for I2C over twisted pair
« on: February 08, 2015, 10:17:14 am »
Hey guys,

I need to communicate with some I2C LED drivers at the end of 7' and 3' (chained, so 10' in total for furthest driver) of Cat5e cable, and I was reading the spec:

http://www.nxp.com/documents/user_manual/UM10204.pdf

It says on page 60 that if I twist the lines, and I don't want to pair each data line with a ground return, I can pair one with VCC and one with GND, but I need to put decoupling capacitors on both ends.

Just wondering if it will make any difference if I use .1uF, 1uF or 10uF ceramic caps for this. 

I assume .1uF caps on there will be fine, but I don't know much about all the ways in which data can be corrupted when transmitting it long distances, so I  thought I should check since the document does mention the capacitance of the line needs to be below a certain amount and I don't know how to calculate that or if this counts towards that.  I don't think it does though, and I'm pretty sure I'm worrying about nothing at this distance.

I'll either be communicating at 100KHz or 400KHz.  My microcontroller can't do higher speeds.

Oh, and do you think I should go with 4K7 pullups here, or something lower?
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22433
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Decoupling caps + resistors for I2C over twisted pair
« Reply #1 on: February 08, 2015, 03:51:42 pm »
In and of itself, the cable with bypass should be well damped.  What else it connects to (at each end) matters, and can screw with this; but...

The "pairs" impedance is around 100 ohms.  The impedance between single wires in different pairs will be higher, maybe 150 ohms.  The inductivity of free space is 1.257 uH/m at the impedance of free space (377 ohms); so the inductivity of the odd pairs should be around 0.5 uH/m.  The propagation velocity of this mode is probably in the 0.8c range, due to capacitive loading, which is factored into the impedance; therefore the inductance should be higher by this, or 0.625 uH/m.  So, a 10m run is about 6uH.

I think that's right?

So whatever bypass you use, you should want to make sure it's well damped; 0.1uF paired at either end against 6uH is an impedance of 11 ohms (the capacitors act in series; Z = sqrt(L/C)).  You could put 11 ohms in series with one, but that would allow ripple; if you put 11 ohms in series with a larger capacitor (>3x the value) and connect that across the first, you can mostly dampen it.  You can do this at one or both ends.  The effect is to have impedance rise slightly at some crossover frequency, but having it go "thud" instead of "ding", and to have a modest to low impedance at all other frequencies.

In principle, you should connect a few uH from your outside circuit to the line, so the line can be somewhat isolated from the unknown circuit.  In practice, this would be a silly length to go to.  I don't know what your supply looks like, but some general advice: do avoid large, low ESR caps (polymer and ceramic), going instead for tantalum (stable, controlled ESR), or ceramic with a resistor, for the bulk capacitors.


As for your signals -- I2C, note that the capacitance (8.84 pF/m * 10m * 377/100 / 0.8 = ~417pF, but that's per pair, not one wire against all others, which is probably slightly more) limits how much clock speed you can run at, and, if you ever have to pass EMC, expect it to be hopelessly messy in the 0.15-10MHz range (even with ferrite beads or other filtering on the driving pins; for which I would suggest 300 ohm 0805 FBs and/or 220 ohm series resistors -- place the pull-ups before the series resistors, if you can).  Let alone susceptibility, which is probably trashed for any kind of stimulus.  If you must do it this way, use four conductor shielded (at least foil screened, but foil and braid is even better), and ground the shield at the enclosure (if you have a metal enclosure), or lead it down to a shielded connector on the board, with the shield connected directly to the board ground plane (it has a ground plane, right?).

If anyone else is still reading... FYI, the same precautions are necessary for USB.  That's why it's fully shielded in even the cheapest cables (though the way they terminate that shield might suck), and still limited on length.

Tim
« Last Edit: February 08, 2015, 04:01:16 pm by T3sl4co1l »
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline Paul Price

  • Super Contributor
  • ***
  • Posts: 1433
Re: Decoupling caps + resistors for I2C over twisted pair
« Reply #2 on: February 08, 2015, 03:52:42 pm »
Use 1K instead of 4.7K pullups, 1uF  bypass caps, and use twisted pairs with power and ground pairs, should work fine. The pullups should only be required to be used on the most distant device in the chain of 10'

The internal timing inherent in the I2C data sampling relative to clock should give any transients time to die out. Try first at lowest practical I2C clocks.

Try the simplest approach first, but If you notice problems, try using 100-ohm series resistors at the I2C master clock and data output pins feeding the twisted pairs.
« Last Edit: February 08, 2015, 04:02:50 pm by Paul Price »
 

Offline StarlordTopic starter

  • Frequent Contributor
  • **
  • Posts: 325
  • Country: us
Re: Decoupling caps + resistors for I2C over twisted pair
« Reply #3 on: February 08, 2015, 05:55:15 pm »
Use 1K instead of 4.7K pullups, 1uF  bypass caps, and use twisted pairs with power and ground pairs, should work fine. The pullups should only be required to be used on the most distant device in the chain of 10'

Will it make a difference if I have 1K pullups on each device?  I'd like to keep them consistent if possible and I may have more than two, but probably never more than four in series.


Quote
Try the simplest approach first, but If you notice problems, try using 100-ohm series resistors at the I2C master clock and data output pins feeding the twisted pairs.

This all sounds a lot like the general advice I've read elsewhere.  I guess I can put some cuttable jumpers there in case I need to add resistors.
 

Offline StarlordTopic starter

  • Frequent Contributor
  • **
  • Posts: 325
  • Country: us
Re: Decoupling caps + resistors for I2C over twisted pair
« Reply #4 on: February 08, 2015, 06:10:30 pm »
So whatever bypass you use, you should want to make sure it's well damped; 0.1uF paired at either end against 6uH is an impedance of 11 ohms (the capacitors act in series; Z = sqrt(L/C)).  You could put 11 ohms in series with one, but that would allow ripple; if you put 11 ohms in series with a larger capacitor (>3x the value) and connect that across the first, you can mostly dampen it.  You can do this at one or both ends.  The effect is to have impedance rise slightly at some crossover frequency, but having it go "thud" instead of "ding", and to have a modest to low impedance at all other frequencies.

In principle, you should connect a few uH from your outside circuit to the line, so the line can be somewhat isolated from the unknown circuit.  In practice, this would be a silly length to go to.  I don't know what your supply looks like, but some general advice: do avoid large, low ESR caps (polymer and ceramic), going instead for tantalum (stable, controlled ESR), or ceramic with a resistor, for the bulk capacitors.

So if I understand you right, what you're suggesting here is that I wire a 0.1uF cap across VCC and GND at each end, AND in parallel with that, I wire, say, a 1uF cap (>3x 0.1uF) in series with an 11 ohm resistor. 

And this is to avoid ringing? 

I'd prefer to avoid tantalum caps.  Expensive, flammable.  When you say supply, you are referring to my 5V power supply, and not the data lines correct?  I didn't ask about the supply, and you were just talking about bypass caps, so I just want to make sure we're on the same page. 

For the supply, I was going to have a 100uF electrolytic near where the cable leaves the board, and on each module I'd have one of those and a 10uF and 0.1uF ceramics.  But the 100uF on the board is a general bulk cap for several sources.  And the LEDs would be supplied by the 100uF on the boards, so I'm not sure sticking a resistor in series with that would be a good idea?


Quote
place the pull-ups before the series resistors, if you can).

I was going to just have the pull ups on the modules.  Though the Atmega I believe has internal pullups which I could selectively enable.  I'd like to keep the port configurable so if I need it for general IO I could use it for that, so the less stuff between the port and the microcontroller the better.
 

Offline Paul Price

  • Super Contributor
  • ***
  • Posts: 1433
Re: Decoupling caps + resistors for I2C over twisted pair
« Reply #5 on: February 08, 2015, 06:42:45 pm »
Don't use pull-up resistors on each device or you will overload the drive capability of the I2C outputs and cause excessive voltage drop(meaning it just will won't function) if you have 100-ohm series damping resistors. Each of the module's pullup resistors are in parallel with all others on other I2C modules, and this means overload. Don't put any resistors in series with the bypass caps(1uf I have suggested, but just connect them from +V to gnd wires on each module.)
« Last Edit: February 08, 2015, 06:47:54 pm by Paul Price »
 

Offline StarlordTopic starter

  • Frequent Contributor
  • **
  • Posts: 325
  • Country: us
Re: Decoupling caps + resistors for I2C over twisted pair
« Reply #6 on: February 08, 2015, 07:41:11 pm »
What if I can't guarantee the order of the modules and I'd prefer not to have a solder jumper for enabling the pull ups? 

As I said before I'd like to keep the modules consistent and I may have up to 4 modules.  If I put 4.7K on each module that's equivalent to a bit more than 1K, and if I went to five modules that's 940 ohms, which I assume is also close enough to 1K to be fine.

How good do you think my chances are for this working with just 4.7K on each module and the 1uF bypass cap?

 
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22433
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Decoupling caps + resistors for I2C over twisted pair
« Reply #7 on: February 09, 2015, 02:41:40 am »
100uF electrolytic will have around 10 ohms ESR, but it won't be stable, so the supply may permit more bumps and dips at low temperatures, or on that unlucky build that was weak caps, or after 20 years and the caps go dry.

Tantalum are perfectly reliable when used right; the problem is most don't, just throwing them at beefy supplies with insufficient derating.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline GK

  • Super Contributor
  • ***
  • Posts: 2607
  • Country: au
Re: Decoupling caps + resistors for I2C over twisted pair
« Reply #8 on: February 09, 2015, 05:34:43 am »
100uF electrolytic will have around 10 ohms ESR,


What?

An example from 1950 maybe. I just measured a run of the mill 100uF/63V Jamicon that has been sitting in the junk box for ~10 years - 0.18 ohms.
Bzzzzt. No longer care, over this forum shit.........ZZzzzzzzzzzzzzzzz
 

Offline GK

  • Super Contributor
  • ***
  • Posts: 2607
  • Country: au
Re: Decoupling caps + resistors for I2C over twisted pair
« Reply #9 on: February 09, 2015, 05:41:35 am »
Or perhaps you meant 1uF. Closest I have at hand is a 0.47F/50V Elna, of similar vintage (at least 10 years) - it measures 2.1 ohms.
Bzzzzt. No longer care, over this forum shit.........ZZzzzzzzzzzzzzzzz
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22433
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Decoupling caps + resistors for I2C over twisted pair
« Reply #10 on: February 09, 2015, 06:56:42 am »
Maybe I meant more like 10uF... those things are pretty weak.  To be honest I haven't seen much data on 100uF class parts; they rarely give more than ripple current spec.  Which is probably as good as sign as any; if the manufacturers won't say what ESR to expect, what should you?

Well... let's measure some then.

Offhand, I have (aluminum electrolytic unless otherwise noted, at 230kHz):

25V 220uF EPCOS (a few years old), 0.205 ohm
10uF 35V Panasonic (new), 1.06 ohm
10uF 25V Nichicon axial (old), 1.42 ohms
10uF 25V Kemet, dipped tantalum, 0.335 ohm
1uF 50V Chemi-con (4mm can), 5.3 ohms
and just to be really unfair,
1uF 450V Capxon, 17.9 ohms.

Good call, I should measure things more often!

So, since bulk caps tend to be fairly low ESR, you may want a larger "fast" bypass, so the impedance is on par with the ESR.  Continuing from the earlier example, 6uH and 0.3 ohms gives C = L/Z^2 = 66uF.  Which is pretty big, and a low enough impedance with or without ESR, so, hey, who cares about stacking bypass, the 100uF should be pretty close as-is.

Oh also, if there's hot plugging involved, that would be a good recommendation against tantalum by the way -- but besides surge current, it will also produce overshoot, even if the supply is modestly damped like this.  A TVS like a P6KExxA or SMAJxxA, rated for nominal supply voltage, would be fine.  So, an xx = 5.0 device for 5V rails, etc.  (Note that this doesn't really do much for rails below 5V, because avalanche diodes under 6V... aren't.  You can get 3.3V TVSs but they're very soft and don't clamp to a voltage much lower than the 5V parts.  Not to say they aren't still beneficial on a 3.3V supply -- just that the relative advantage isn't as great.  I don't think I've ever seen TVS diodes under 3.3V, as they'd really be useless.)

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline StarlordTopic starter

  • Frequent Contributor
  • **
  • Posts: 325
  • Country: us
Re: Decoupling caps + resistors for I2C over twisted pair
« Reply #11 on: February 09, 2015, 09:58:54 am »
So if I understand you correctly, you're saying a lone 100uF at each end of the cable across the supply should be fine?  Ie, one 100uF on my main board, and one on each module which is also acting as a bulk supply for my LEDs?

Of course I will still have 10uF and 100nF caps by my chips.
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22433
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Decoupling caps + resistors for I2C over twisted pair
« Reply #12 on: February 09, 2015, 05:15:29 pm »
Correct.
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline nuno

  • Frequent Contributor
  • **
  • Posts: 606
  • Country: pt
Re: Decoupling caps + resistors for I2C over twisted pair
« Reply #13 on: February 09, 2015, 11:18:51 pm »
I have this project, a Raspberry Pi controlling 2 power (250W each) H-Bridges over I2C. The bus is splited in 2 at the Pi, and then goes about 50cm (~19 inches) each side to each controller. It runs at 550 kbps.

At the end of each bus, on the controller, there's an I2C galvanic isolator chip (from AD), which needs to be powered on both sides; therefore, the "bus" consists of the I2C signals plus Vcc (3V3) for the isolator chip. I put a 10uF ceramic at the controller's board bus Vcc/GND entry after a schottky diode in series with Vcc, plus 100nF ceramic decoupling at the isolator's power pins. The diode together with the
10uF cap will work to keep the power voltage stable on the controller part of the bus.

I used 3 pairs of a CAT5 ethernet cable: Vcc/GND, SDA/GND and SCL/GND. All GND wires are connected on both sides of the system (at the Pi and at the controllers), inductance will only be minimized if any current does run through the GND wires. I used an independant pair for each I2C bus to, I thought, reduce crosstalk (trying to keep them as away as possible); maybe I'm wrong here as I read above, will have to study this in more detail.

No pull-ups at the controller, the entire system has only the pull-ups that are on the RaspPi (I don't know their value).

Anyways, the signal looks good on the scope, no transmission errors detected so far with frequent use (messages flow between master and slaves 10+ times per second).
« Last Edit: February 09, 2015, 11:29:39 pm by nuno »
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22433
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Decoupling caps + resistors for I2C over twisted pair
« Reply #14 on: February 10, 2015, 01:34:08 am »
What are the H-bridges doing?  They'd better be quiet, or well grounded...

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline nuno

  • Frequent Contributor
  • **
  • Posts: 606
  • Country: pt
Re: Decoupling caps + resistors for I2C over twisted pair
« Reply #15 on: February 10, 2015, 02:01:05 am »
They're driving upto 20A into DC motors 8) . Power is star at the battery and the I2C communications are galvanicaly isolated.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf