I2C calculator - Page 1
Forum section: electronics / projects

author: Nikos A.
author_rank: Regular Contributor
timestamp: July 26, 2021, 09:22:05 am
content: Hi guys,I did a spreadsheet calculator based on the I2C-bus specificationhttps://www.nxp.com/docs/en/user-guide/UM10204.pdfto calculate the I2C pull-up resistors. Could someone validate this calculator?I have used the equations for Rmin and Rmax in Section 7 pg 55 and Tables 9 & 10 pg 47-48In my application, I will use the standard mode (100kHz) and Vcc = 1.8. Taking into account the bus capacitance I calculate Rmin = 480ohms and Rmax = 35k.Between the range 480ohms - 35k what resistor should I select?If I want to use fast mode (400kHz) then I calculate Rmin = 480ohms and Rmax = 10.5kBetween the range 480ohms - 10.5k what resistor should I select?Also another engineer told me that regarding I2C bus, there are two things you need to worry about: total bus capacitance and input impedances of the node. My calculator do not take into account the input impedance of the nodes.. Should I take it into account and how should I modify my calculator in that case?ThanksNick

author: Siwastaja
author_rank: Super Contributor
timestamp: July 26, 2021, 10:08:33 am
content: Smaller value increases margin against noise, but increases power consumption during transactions: whenever a device outputs '0', current I = Vcc / Rpu flows through that resistor.I just usually default to 4.7k unless it's a high-speed bus or shares enough devices that 4.7k is uncomfortably close to the maximum value (obtained with similar calculations you presented), in which case I reduce it to 2.2k. Or obviously for BOM optimization, some close-by value.For low power design, increasingspeedinstead of the pull-up value and getting back to sleep faster is likely better choice.I also prefer to leave a bit safety margin on the low side because the driver's Rds_on (i.e., the transistor resistance) may be underestimated in some formulas. This output pin resistance forms a voltage divider, rising "zero" voltage above zero, again bad for noise margins. For example, if Rio = 50 ohms, Rpu = 500 ohms, Vdd=3.3V, zero level will be 50/550 * 3.3V = 0.3V. This may be still acceptable but just barely so. For this reason alone, I never go below 1kOhm. If I have to "for speed", I2C is clearly the wrong choice.But as you found out, generally, the suitable range of resistor values is wide. Pick something in the middle of that range, when unsure.

author: Renate
author_rank: Super Contributor
timestamp: July 26, 2021, 10:43:45 am
content: Best results for minimum current and maximum speed would be with a constant current pullup.I don't think that I've ever seen that done though.

author: Siwastaja
author_rank: Super Contributor
timestamp: July 26, 2021, 01:58:26 pm
content: Quote from: Renate on July 26, 2021, 10:43:45 amYes, that can be done and I think I have heard of someone doing that, but really, makes no sense, it's like retrofitting a modern computer controlled direct fuel injection system into a carburetor based cheap lawn mover which is used twice a year.I2C is supposed to be minimized cost, highly integrated, minimized number of parts, and slow. The real speed optimization is getting rid of the pull-up concept completely, not trying to improve it. For example, SPI easily performs at up to 50MHz on a PCB, and if that is not enough, then we are discussing real differential high-speed physical interfaces.Low power consumption is mostly achieved by avoiding excess communication. If large amounts of data is moved around through I2C, something's weird in the design. Usually it's used to configure some settings initially, or query slowly changing measurements like temperature or battery voltage.

author: Nikos A.
author_rank: Regular Contributor
timestamp: July 26, 2021, 07:40:24 pm
content: Thank you for your answer guys!!

author: Nikos A.
author_rank: Regular Contributor
timestamp: July 27, 2021, 07:16:27 am
content: Hi again,I just want to comfirm the following advice that an engineer provide me. He told that I must take into account the input impedance of the I2C nodes.He told me the following:"As a rough estimate, count on about 50K as the input impedance of each digital input. So here is an example:Assume you have five devices on the bus, at 50K input impedance each, and you chose a pull up resistor of 10K1. Equivalent input impedance seen by the driver is 10K.2. The maximum logic high level you will see is 1/2 of your unloaded logic high. That's because of the potential divider effect of 10K:10K. So, if you have 3.3V logic, you will now see 3.3V/2, or 1.65V. That will not be enough to register as a logic 1.3. If you had a 2K pull up instead, your logic 1 voltage would be (10K/12K) x 3.3V, or 2.75V. That is enough to register as a logic 1."Is this rough estimation about 50k of imput impedance valid and should I take it into account before selecting pull-up resistors?The input impedance of the nodes is provided in datasheets? I am straggling to find such kind of information

author: Siwastaja
author_rank: Super Contributor
timestamp: July 27, 2021, 09:04:35 am
content: No, that's complete bullshit and makes zero sense. Maybe it's some advice pre-CMOS inputs, i.e., 1970's? But all I2C devices in existence have CMOS inputs, the resistive input impedance of which is comparable to PCB surface leakages, this is in tens to hundreds of megaohms, there will be no voltage divider effect.But while input impedance can be assumed infinite, as I said earlier,outputresistance is non-zero and can't be ignored in thesmallrange of pull-up values, i.e., somewhere below 1k.Capacitive loading can be called "input impedance" of course, and it acts like a voltage dividerduring state change, creating the maximum frequency rating, but that you have already addressed.Ignore that "engineer" from now on.

author: Nikos A.
author_rank: Regular Contributor
timestamp: July 27, 2021, 01:00:51 pm
content: Quote from: Siwastaja on July 27, 2021, 09:04:35 amThank you Siwastaja