Reducing capacitance on an I2C bus - Page 1
Forum section: electronics / projects

author: Northy
author_rank: Regular Contributor
timestamp: December 28, 2020, 01:58:46 pm
content: After changing some parts on an I2C bus that used to work, it looks like I've now got a problem with bus capacitance.Does anyone have any tips on reducing capacitance on I2C lines to improve performance?Thanks,G

author: srb1954
author_rank: Super Contributor
timestamp: December 29, 2020, 08:28:46 am
content: How do you know that bus capacitance is the cause of your problems?Have you used a scope to compare waveforms between the old and the new circuits?

author: tszaboo
author_rank: Super Contributor
timestamp: December 29, 2020, 10:56:39 am
content: Some solutions, starting from easy to hard:Reduce the pull-up resistor valueUse narrower tracks.Use shorter tracks.Don't use cables.Separate the I2C for different peripherals (use more than 1 on the MCU)There are I2C accelerators and address translators, use one of these ICs

author: David Hess
author_rank: Super Contributor
timestamp: December 31, 2020, 02:59:48 am
content: Quote from: NANDBlog on December 29, 2020, 10:56:39 amOr replace pull-up resistor with current source.

author: bson
author_rank: Unknown
timestamp: December 31, 2020, 08:45:55 pm
content: Yep, pull-up current sources and series resistors to limit capacitive load currents.

author: MattHollands
author_rank: Frequent Contributor
timestamp: December 31, 2020, 08:54:48 pm
content: In terms of specifics, it's quite important to know if you're using a breadboard or a PCB or what?In generality the capacitance equation is pretty simple. Capacitance is proportional to surface area and dielectric constant while inversely proportional to distance. So either reduce the area of your tracks (thinner or shorter), reduce the dielectric constant of your substrate (if it's a PCB), or increase the distance between the trace and ground (e.g. use hashed ground, remove ground plane beneath).Of course, your devices will also provide some capacitive loading (though it is likely small), so if you have many devices on the same bus this may cause an issue too.If you risk other aspects of the design by making any of the above changes then, as other have suggested, current sources and reduced resistances can help.Also would be curious to know what has changed to create this issue and why you're sure it's capacitive loading that is the issue.

author: Northy
author_rank: Regular Contributor
timestamp: January 05, 2021, 09:21:37 am
content: Thanks for all the replies.The 'bus' is a mixture of a PCB, a cable to another PCB, and wires to a 'hacked on' prototype PCB.An couple of IC's disappeared from sale literally overnight, so I created a prototype PCB with alternative parts on to hack onto the existing board to try them out without having to create a large, expensive prototype.The I2C has never been ideal on the design, and I realise long bodged on wires are not ideal, but it was to reduce risk on the new parts.Re-spinning the entire board properly will improve things, but when I do it I want to improve the routing of the I2C to give extra margin.Does anyone have much experience taking I2C over cables to other boards? Are there some rules to improve thing there?Thanks,G

author: Ice-Tea
author_rank: Super Contributor
timestamp: January 05, 2021, 09:40:38 am
content: The most important question remains unanswered: have you measured waveforms prior and after the substitution?

author: Siwastaja
author_rank: Super Contributor
timestamp: January 05, 2021, 11:47:13 am
content: What is the measured rise time now, and what was it before the changes?

author: Northy
author_rank: Regular Contributor
timestamp: January 08, 2021, 10:26:19 pm
content: Unfortunately due to Covid I'm now working form home and the one prototype unit is in the office.The guy who is writing the firmware just said the edges look 'slow'. He shortened the wires to the hacked on board and it made things more reliable.In the final design the hacked on board will not exist, it will be all one board, but there will need to be a cable with I2C on it to another board.Has anyone done that successfully? Are there any rules to follow? I think the preferred cable at the moment would be an IDC style.Thanks,G

author: Siwastaja
author_rank: Super Contributor
timestamp: January 09, 2021, 09:56:28 am
content: I2C is not supposed to be used in cables. It's on-board communication bus for short distances. Short ribbon cables or pin headers connecting multiple PCBs together is OK, but keep them short, i.e., a few inches.For longer cabling, I would look into using proper signaling, but this depends on the application (maybe you can replace it with UART & RS422 transceivers, maybe you can't).The very first thing to do is to actually measure the rise time. Also tell us what the pull-up resistor value is. Typically somewhere around 500-1000 ohms is the sweet spot for speed/reliability; for low power, higher value needs to be used. Below some 500 ohms the bus drivers can't drive the line low enough and you start losing margin for detecting '0' level properly. Note this is heavily temperature and unit dependent, the CMOS low side fet on the IC may be 10 ohms on your lab table but suddenly nearly 100 ohms with some specific unit on the field in high temperature! This resistance forms a voltage divider with your pull-up, defining the '0' level.If you just use some "default" 10 kOhm or the internal 40kOhm-ish MCU pullup, you are quickly in trouble with the bus capacitance.Slowing down I2C clock (so the bit time gets longer) and reducing the pullup resistor values are suitable hacks to give a bit more margin if the design is marginal now.

author: Karel
author_rank: Super Contributor
timestamp: January 09, 2021, 10:45:51 am
content: For 3 - 3.3 Volt supplies, I use pull-up resistors with a value of 2K2. Works fine up to 1Mbit/sec.(everything on the same pcb and just a couple of devices on the bus)Always check the waveforms with a DSO and carefully check the settings of the I2C timings of the MCU.Specially the STM32 settings for I2C timings were not immediately clear to me. I had to read twice or tripple...Pay attention, the sampling time/position of the I2C receiver can not be observed externally (e.g. with a DSO).

author: Northy
author_rank: Regular Contributor
timestamp: January 13, 2021, 10:56:57 am
content: Thanks guys, very useful replies.When I'm allowed back into the office I can have a good poke about on the prototype and see what's going on. I have confidence now that it's fixable.Thanks,G

author: Doctorandus_P
author_rank: Super Contributor
timestamp: January 13, 2021, 07:03:41 pm
content: I would start with looking at the I2C signals with an oscilloscope to diagnose the real problem.It takes the guesswork out of the equation and replaces it with knowledge / insight.Don't forget to poke the bus at several locations, maybe you have some bad wiring, connector or something like that.This way you can also verify what your safety margins are when changing pullup resistors or cabling.Another possible solution is to lower the clock frequency of your I2C bus to give the bus capacitance more time to (dis) charge.