Author Topic: Should I add a 50ns noise/glitch filter to the I2C interface on an RPi?  (Read 6242 times)

0 Members and 1 Guest are viewing this topic.

Offline SlowBroTopic starter

  • Regular Contributor
  • *
  • Posts: 137
  • Country: us
Should I add a 50ns noise filter to the I2C interface on an RPi, and if so how do I do it?

This document states, "The serial interface specification for high speed data transfer (400 kHz and faster) recommends a 50 ns noise filter on the inputs to prevent double-clocking and miss-communication." I am planning to use 400 kHz devices.

But if the RPi handles this already I don't need to add anything. A Google search of their forum reveals this question has not come up yet. Unless my Google foo is off. I plan to ask over there as well.

I found this TI whitepaper which describes adding ferrite beads: "Glitch filtering is provided by a ferrite bead that is rated 1000 ohms at 100 MHz. One bead on each I2C line placed close to the device protects the device from 3.3-V noise glitches that are up to 15 ns in duration. Two beads placed in series protect the device from glitches up to 25 ns."

So if I want 50 ns do I just use five or so on each line? Is there a more efficient way?
« Last Edit: January 14, 2018, 02:12:56 am by SlowBro »
 

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: Should I add a 50ns noise/glitch filter to the I2C interface on an RPi?
« Reply #1 on: January 13, 2018, 12:42:10 pm »
If you have a DSO would be prudent to set it up for runt
pulse triggering and examine what levels/pulse widths of
noise you are up against.

Additionally does your design I2C interfaces have the filter built in ?
consult their data sheets.

If you google "I2C Glitch filter" a number of approaches used are discussed.


Regards, Dana.
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 
The following users thanked this post: SlowBro

Offline SlowBroTopic starter

  • Regular Contributor
  • *
  • Posts: 137
  • Country: us
Re: Should I add a 50ns noise/glitch filter to the I2C interface on an RPi?
« Reply #2 on: January 13, 2018, 06:45:11 pm »
If you have a DSO would be prudent to set it up for runt
pulse triggering and examine what levels/pulse widths of
noise you are up against.

Thanks Dana. My DSO (a cheap Gabotronics Xprotolab Plain) does not seem to have runt pulse triggering. Is there another mode I could use to watch for runt pulses? I am planning to release this into the wild where I could be up against any and all kinds of noise.

Additionally does your design I2C interfaces have the filter built in ?
consult their data sheets.

I didn't see anything on the Pi's processor datasheet, hence my question... just trying to find if anyone knows.
 
The following users thanked this post: cdev

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: Should I add a 50ns noise/glitch filter to the I2C interface on an RPi?
« Reply #3 on: January 14, 2018, 02:03:53 am »
Your scope sample rate simply too low to capture  a 50 nS runt or less. Or
support equivalent time sampling, if it did we could put the I2C in a fixed
loop and then look. Buts that's not feasible.

There are analog techniques for pulse detetcion, I just cannot recall where
I saw them. You could use an external sample/count/compare logic solution
to flag a pulse. Trigger counter start on +edge, stop on -edge, and look at
count.  Clock at 100 Mhz or so. Small FPGA or CPLD could do this.

You might consult the ARM1176 tech docs for more info on the I2C or post
a question on the arm SITE for resolution on the filter.


Regards, Dana.
« Last Edit: January 14, 2018, 02:13:06 am by danadak »
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 

Offline cdev

  • Super Contributor
  • ***
  • !
  • Posts: 7350
  • Country: 00
Re: Should I add a 50ns noise/glitch filter to the I2C interface on an RPi?
« Reply #4 on: January 14, 2018, 03:27:40 am »
I have that problem whenever I use a GPIO it seems. First get it working, then get rid of the RFI. You can use an RTLSDR - ideally one that supports direct sampling as a cheap RFI detector.
"What the large print giveth, the small print taketh away."
 
The following users thanked this post: SlowBro

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21606
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Should I add a 50ns noise/glitch filter to the I2C interface on an RPi?
« Reply #5 on: January 14, 2018, 12:23:28 pm »
I2C port pins are supposed to have internal filtering or blanking or slew rate limiting as it is.  If not, well...

50ns blanking corresponds to about 5-10MHz analog bandwidth, which is a good precaution for lengthy digital routes.

If you're routing I2C over cables, don't even bother unless you're prepared to:
- Avoid high speed mode.
- Short lengths (under 30cm, say): use ribbon cable or better, every other line GND or VCC (doesn't matter as long as they're bypassed at each connector).  On the signal (both SCL and SDA), use ~300 ohm ferrite bead and 470pF cap at each end to filter RFI.
- Medium lengths (few m): use shielded multiconductor cable, same filtering as above (or even more C, or with R+C in parallel with C to dampen resonances).  Shield goes directly to circuit ground at each end.
- Long lengths (more than, say, 5m): forget about it.  If you insist, use an I2C extender interface chip, and something differential (usually RS422/485).

I2C is precisely what it is: a standard to use between ICs on a single PCB, or at most, a couple connected together on stacking headers, or short ribbon cables.  It is not at all robust to noise, making it very impractical over distances.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 
The following users thanked this post: cdev, Ian.M, SlowBro, Svgeesus

Offline SlowBroTopic starter

  • Regular Contributor
  • *
  • Posts: 137
  • Country: us
Re: Should I add a 50ns noise/glitch filter to the I2C interface on an RPi?
« Reply #6 on: January 15, 2018, 04:16:18 am »
cdev I have one of those cheapie Chinese $3 RTL-SDR, is that what you mean?

T3sl4co1l you've given the best recommendations I've seen yet for protecting I2C lines. I figured I wanted to add some ferrites but couldn't get a figure anywhere for what size.

Am aware of the limitations of running it over a longer connection but the cable is 1m which is widely reported to be not terribly problematic for a well-designed connection. Also I did some testing and 100 kHz is sufficient for my needs.

Confused though at your recommendation to add 470pF to the signal lines. Isn't the upper limit 400pF? I would think I want less capacitance, not more... and not even more when going beyond 30cm...
 

Offline cdev

  • Super Contributor
  • ***
  • !
  • Posts: 7350
  • Country: 00
Re: Should I add a 50ns noise/glitch filter to the I2C interface on an RPi?
« Reply #7 on: January 15, 2018, 04:28:20 am »
Thank you T3sl4co1l for this.

I2C port pins are supposed to have internal filtering or blanking or slew rate limiting as it is.  If not, well...

50ns blanking corresponds to about 5-10MHz analog bandwidth, which is a good precaution for lengthy digital routes.

If you're routing I2C over cables, don't even bother unless you're prepared to:
- Avoid high speed mode.
- Short lengths (under 30cm, say): use ribbon cable or better, every other line GND or VCC (doesn't matter as long as they're bypassed at each connector).  On the signal (both SCL and SDA), use ~300 ohm ferrite bead and 470pF cap at each end to filter RFI.
- Medium lengths (few m): use shielded multiconductor cable, same filtering as above (or even more C, or with R+C in parallel with C to dampen resonances).  Shield goes directly to circuit ground at each end.
- Long lengths (more than, say, 5m): forget about it.  If you insist, use an I2C extender interface chip, and something differential (usually RS422/485).

I2C is precisely what it is: a standard to use between ICs on a single PCB, or at most, a couple connected together on stacking headers, or short ribbon cables.  It is not at all robust to noise, making it very impractical over distances.


"What the large print giveth, the small print taketh away."
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21606
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Should I add a 50ns noise/glitch filter to the I2C interface on an RPi?
« Reply #8 on: January 15, 2018, 07:02:04 am »
You can use lower clock frequency and stronger pull-ups to compensate for the capacitance.  1m of cable will already be around 60pF, so ~100pF is minimum needed for effective filtering/damping.  If in doubt, run simulations to figure out the best filtering approach.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 
The following users thanked this post: SlowBro

Offline SlowBroTopic starter

  • Regular Contributor
  • *
  • Posts: 137
  • Country: us
Re: Should I add a 50ns noise/glitch filter to the I2C interface on an RPi?
« Reply #9 on: January 15, 2018, 11:31:14 am »
If in doubt, run simulations to figure out the best filtering approach.

Any free or cheap simulators you recommend?
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21606
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Should I add a 50ns noise/glitch filter to the I2C interface on an RPi?
« Reply #10 on: January 15, 2018, 12:14:50 pm »
LTSpice is more than sufficient here.

You will need to construct a pin model; a standard NMOS with parameters adjusted to ~match a 74HC family output transistor (including capacitances), and a large enough gate resistor to get a falling edge rate of about 50ns, should do.

You can't simply connect a current or voltage source to the filter, because the pin impedance is changing.  A transistor model captures this correctly.  (A SPICE switch could get close, but wouldn't model the falling edge quite right.  Hmm, with Miller capacitance it might be okay.)

You can use a lossless transmission line model (SPICE happens to provide this, though it's kind of slow, but that's not a problem for such a simple model), or approximate the line with a CLC network where the line's low frequency equivalent capacitance is split equally into the two C's and its inductance is the L.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 
The following users thanked this post: SlowBro

Offline SlowBroTopic starter

  • Regular Contributor
  • *
  • Posts: 137
  • Country: us
Re: Should I add a 50ns noise/glitch filter to the I2C interface on an RPi?
« Reply #11 on: January 15, 2018, 12:48:31 pm »
All that is currently over this beginner's head but I just downloaded the software and am willing to dive in and give it a go ^-^ I tend to learn pretty quickly.
 


Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21606
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Should I add a 50ns noise/glitch filter to the I2C interface on an RPi?
« Reply #13 on: January 16, 2018, 12:34:12 pm »
No need to go for multi-turn power line chokes...

Oh, "through hole", no wonder.

You might as well buy up a couple loose beads and use that.  Example:
https://www.mouser.com/productdetail/fair-rite/2643002402?qs=sGAEpiMZZMt1hubY80%2Fs8KzOR8uczPzvNMcu4%2FfkyRg%3D

The smaller "beads-on-leads" size parts are good when you're breadboarding and just need something to take the edge off, say if you're getting SPI glitches or something.  A few turns on the above will do the same, but you can use whatever wire and however many turns you like.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 
The following users thanked this post: SlowBro

Offline cdev

  • Super Contributor
  • ***
  • !
  • Posts: 7350
  • Country: 00
Re: Should I add a 50ns noise/glitch filter to the I2C interface on an RPi?
« Reply #14 on: January 17, 2018, 04:52:34 pm »
If you use a ribbon cable you can find flat ferrite clip on RFI suppressors that work very well for ribbon cable.
"What the large print giveth, the small print taketh away."
 
The following users thanked this post: SlowBro


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf