Should I add a 50ns noise/glitch filter to the I2C interface on an RPi? - Page 1
Forum section: electronics / beginners

author: SlowBro
author_rank: Regular Contributor
timestamp: January 13, 2018, 04:59:30 am
content: Should I add a 50ns noise filter to the I2C interface on an RPi, and if so how do I do it?This documentstates, "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. AGoogle search of their forumreveals this question has not come up yet. Unless my Google foo is off. I plan to ask over there as well.I foundthis TI whitepaperwhich 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?

author: danadak
author_rank: Super Contributor
timestamp: January 13, 2018, 12:42:10 pm
content: If you have a DSO would be prudent to set it up for runtpulse triggering and examine what levels/pulse widths ofnoise 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.

author: SlowBro
author_rank: Regular Contributor
timestamp: January 13, 2018, 06:45:11 pm
content: Quote from: danadak on January 13, 2018, 12:42:10 pmThanks Dana. My DSO (a cheapGabotronics 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.Quote from: danadak on January 13, 2018, 12:42:10 pmI didn't see anything on thePi's processor datasheet, hence my question... just trying to find if anyone knows.

author: danadak
author_rank: Super Contributor
timestamp: January 14, 2018, 02:03:53 am
content: Your scope sample rate simply too low to capture a 50 nS runt or less. Orsupport equivalent time sampling, if it did we could put the I2C in a fixedloop and then look. Buts that's not feasible.There are analog techniques for pulse detetcion, I just cannot recall whereI saw them. You could use an external sample/count/compare logic solutionto flag a pulse. Trigger counter start on +edge, stop on -edge, and look atcount. 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 posta question on the arm SITE for resolution on the filter.Regards, Dana.

author: cdev
author_rank: Super Contributor
timestamp: January 14, 2018, 03:27:40 am
content: 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.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: January 14, 2018, 12:23:28 pm
content: 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

author: SlowBro
author_rank: Regular Contributor
timestamp: January 15, 2018, 04:16:18 am
content: 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 wantlesscapacitance, not more... and not evenmorewhen going beyond 30cm...

author: cdev
author_rank: Super Contributor
timestamp: January 15, 2018, 04:28:20 am
content: Thank you T3sl4co1l for this.Quote from: T3sl4co1l on January 14, 2018, 12:23:28 pm

author: T3sl4co1l
author_rank: Super Contributor
timestamp: January 15, 2018, 07:02:04 am
content: 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

author: SlowBro
author_rank: Regular Contributor
timestamp: January 15, 2018, 11:31:14 am
content: Quote from: T3sl4co1l on January 15, 2018, 07:02:04 amAny free or cheap simulators you recommend?

author: T3sl4co1l
author_rank: Super Contributor
timestamp: January 15, 2018, 12:14:50 pm
content: 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

author: SlowBro
author_rank: Regular Contributor
timestamp: January 15, 2018, 12:48:31 pm
content: 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 goI tend to learn pretty quickly.

author: SlowBro
author_rank: Regular Contributor
timestamp: January 16, 2018, 12:12:32 am
content: Quote from: T3sl4co1l on January 14, 2018, 12:23:28 pmIs this a case of more is better? I see a 998 ohms:https://www.digikey.com/products/en/filters/ferrite-beads-and-chips/841?FV=1140050%2C1f140000%2Cmu300Ohms%7C2280%7C0%2Cffe00349&mnonly=0&ColumnSort=1000011&page=1&stock=1&pbfree=0&rohs=0&cad=0&datasheet=0&nstock=1&photo=0&nonrohs=0&newproducts=0&quantity=100&ptm=0&fid=0&pageSize=25

author: T3sl4co1l
author_rank: Super Contributor
timestamp: January 16, 2018, 12:34:12 pm
content: 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%3DThe 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

author: cdev
author_rank: Super Contributor
timestamp: January 17, 2018, 04:52:34 pm
content: If you use a ribbon cable you can find flat ferrite clip on RFI suppressors that work very well for ribbon cable.