<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.element14.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>If and When Do I²C Pull-Up Values Matter? -- Workbench Wednesdays 83</title><link>https://community.element14.com/challenges-projects/element14-presents/workbenchwednesdays/w/documents/28424/if-and-when-do-i2c-pull-up-values-matter----workbench-wednesdays-83</link><description /><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>If and When Do I²C Pull-Up Values Matter? -- Workbench Wednesdays 83</title><link>https://community.element14.com/challenges-projects/element14-presents/workbenchwednesdays/w/documents/28424/if-and-when-do-i2c-pull-up-values-matter----workbench-wednesdays-83</link><pubDate>Tue, 05 Mar 2024 17:25:45 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:1c24b830-d648-4ef2-bbe6-110d84819d09</guid><dc:creator>pchan</dc:creator><comments>https://community.element14.com/challenges-projects/element14-presents/workbenchwednesdays/w/documents/28424/if-and-when-do-i2c-pull-up-values-matter----workbench-wednesdays-83#comments</comments><description>Current Revision posted to Documents by pchan on 3/5/2024 5:25:45 PM&lt;br /&gt;
&lt;p&gt;&lt;span class="TextRun SCXW186597832 BCX0" lang="EN-US" data-contrast="auto"&gt;&lt;span class="NormalTextRun SCXW186597832 BCX0"&gt;How do you pick I2C pull-up resistor values? The common response is to choose anything between 1 &lt;/span&gt;&lt;span class="NormalTextRun SpellingErrorV2Themed SCXW186597832 BCX0"&gt;kOhm&lt;/span&gt;&lt;span class="NormalTextRun SCXW186597832 BCX0"&gt; and 10 &lt;/span&gt;&lt;span class="NormalTextRun SpellingErrorV2Themed SCXW186597832 BCX0"&gt;kOhm&lt;/span&gt;&lt;span class="NormalTextRun SCXW186597832 BCX0"&gt;. But, still, how do you know the best value? The answer is related to the maximum number of devices you can have without using a repeater, switch, or multiplexer on an I2C bus. Many people would answer a number like 127 since that is how many 7-bit addresses are available. However, creating an I2C bus with more than 20 or so devices is &lt;/span&gt;&lt;span class="NormalTextRun SCXW186597832 BCX0"&gt;nearly impossible&lt;/span&gt;&lt;span class="NormalTextRun SCXW186597832 BCX0"&gt;. Why? Because the bus capacitance matters most&amp;ndash;which is also the key to &lt;/span&gt;&lt;span class="NormalTextRun SCXW186597832 BCX0"&gt;determining&lt;/span&gt;&lt;span class="NormalTextRun SCXW186597832 BCX0"&gt; I2C pull-up resistor values!&lt;/span&gt;&lt;/span&gt;&lt;span class="EOP SCXW186597832 BCX0"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ho7oo31m0"&gt;&lt;span class="EOP SCXW186597832 BCX0"&gt;Watch the Video:&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span class="EOP SCXW186597832 BCX0"&gt;&lt;a href="https://www.youtube.com/watch?v=n2eaY51rkJQ"&gt;www.youtube.com/watch&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="EOP SCXW186597832 BCX0"&gt;&lt;a href="#Downloads" data-e14adj="t"&gt;Downloads &amp;amp; Links&lt;/a&gt; | &lt;a href="#BOM" data-e14adj="t"&gt;Bill of Material&lt;/a&gt; | &lt;a href="#Discussion" data-e14adj="t"&gt;Discussion&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;&lt;img alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-19/01-_2D00_-baldee-looking-at-app-note.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;James was looking for application notes about picking I2C pull-up resistor values. One that caught his attention was from Texas Instruments. I2C Bus Pullup Resistor Calculation (SLVA689) covers calculating the maximum and minimum pull-up values. It also clearly shows the math for the rise time calculation and bus capacitance. James created an online spreadsheet with pre-configured equations to make things easier for you.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Application notes from many other vendors and tutorials on the web have a similar example as the TI app note. It comes up with the ridiculous range of 966.667 to 1770 ohms. As James says in the video, the only sane value in that range is 1 kOhm. (Although there are a couple of other E12 and E24 values too!) But if that&amp;#39;s the usable range, how do other I2C devices use 2.2, 4.7, or 10 kOhm kOhm work?!&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ho7ou98p1"&gt;&lt;span data-contrast="auto"&gt;Key I2C Numbers to Know&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;We need to know some key information about the I2C specification. James uses a DesignCon 2003 presentation, but these numbers are also available in the full I2C spec. The two most common speeds for I2C are 100 kbit/s and 400 kbit/s. Later in the video, James uses an OLED screen running at 400 kbits/s, so most of the video centers around the faster speed.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-19/02-_2D00_-key-I2C-numbers-to-know.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;The maximum bus capacitance allowed on I2C for both speeds is 400 picofarads. The maximum rise time of the bus is limited to 1000 nanoseconds and 300 nanoseconds, respectively, depending on the bus speed. Last, it is essential to know that the spec uses the 30% and 70% points of the edge to determine rise time.&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-19/03-_2D00_-open-drain-example.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;I2C devices need a pull-up resistor because they use an open-drain (or open-collector) architecture. This setup means a device only drives the bus to ground, effectively letting it float when it wants to represent a logic high. When the bus goes high, the pull-up resistor and the bus capacitance limit the signal&amp;#39;s rise time. We see sloped edges on the rise and sharp edges on the fall of I2C waveforms because the two components form an RC network!&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ho7p4p9f3"&gt;&lt;span data-contrast="auto"&gt;Measuring I2C Bus Capacitance&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Estimating I2C bus capacitance has a few issues. Not all I2C devices define their input capacitance. And you need a good model for the interconnects. A far simpler method is to measure it on an actual circuit. James uses an Arduino Uno and an SSD1306-based OLED on a breadboard connected with wires as an example.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-19/04-_2D00_-OLED-resistors.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;On the back of these OLEDs are 4.7 kOhm pull-up resistors on both the SDA and SCL lines.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;James assumed that SCL and SDA should look very similar, so most measurements only look at SCL. The initial rise time measurement is 534 nanoseconds! The display works, but this value is way outside of the I2C&amp;#39;s spec of 300 nanoseconds for a 400 kHz bus. However, most oscilloscopes default to the 10-90 points of the rise time. After changing the reference levels to use 30-70, the rise time comes out to be 193 nanoseconds.&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-19/05-_2D00_-70_2D00_30-and-10_2D00_90-rise-times.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Using the 4.7 kOhm pull-up resistor value and the 193 nanosecond rise time, James shows how to calculate the effective bus capacitance using the equations in the TI app note. This math is where the spreadsheet comes in handy! It turns out the bus capacitance is 48 picofarads.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-19/06-_2D00_-bus-capactiance-example.png" /&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;For most designs, this verification step is the endpoint. Both the rise time and bus capacitance are well below the I2C spec! We have verified this bus is in compliance and could move on. However, James points out that we did ignore one other resistor on the bus: the Arduino&amp;#39;s internal pull-up!&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ho7p8uhf4"&gt;&lt;span data-contrast="auto"&gt;Arduino Internal Pull-Ups&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Nearly all microcontroller GPIO pins offer an internal pull-up resistor. The values of these resistors are usually in the 20 to 50 kilohm range. (They are not actual resistors on the silicon. They&amp;#39;re the resistance of a MOSFET&amp;#39;s drain-to-source channel. But that&amp;#39;s a topic for a different video.)&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;The Arduino&amp;#39;s I2C library, also called &amp;quot;Wire&amp;quot; or &amp;quot;Two-Wire Interface (TWI), enables the internal pull-ups for the I2C pins. James did not consider the internal pull-up when he showed the rise time calculations. An interesting side-effect of a 5V Arduino Uno using its internal pull-up resistor is that it makes the bus compatible with a 3.3 volt device.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-19/07-_2D00_--simulation-example-50k-par-4k.png" /&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;A quick simulation shows what happens when the internal pull-up connects to 5 volts, and the external pull-up connects to 3.3 volts. The effective high voltage on the I2C bus becomes about 3.4 volts!&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Regarding bus capacitance and rise time, the 50 kOhm resistor has a minimal effect since a smaller external resistor has significantly more pull. But that did leave James to wonder, what if you didn&amp;#39;t use external pull-up resistors at all?&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ho7pbi095"&gt;&lt;span data-contrast="auto"&gt;How Much Pull-Up is Too Much?&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;James removed the 4.7 kOhm surface mount resistors from the OLED module. After that change, the OLED no longer worked! On the oscilloscope, James showed the rise time is over 900 nanoseconds now! No wonder this 400 kbit/s device is not responding.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-19/08-_2D00_-internal-pull_2D00_ups-are-845-ns.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;The 50 kOhm internal pull-up is too much resistance. Next, James used an external 10 kOhm resistor to see the performance. And with 10 kOhm, the OLED worked and had rise times around 200 nanoseconds. The 50 kOhm internal pull-up is probably strong enough for 100 kbit/s devices. However, it seems far too weak for faster I2C devices.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Going the other direction, what is the smallest value you can use? Why not just use something like 100 ohms to be safe? Remember, I2C devices have to sink the bus&amp;#39;s current. So, the pull-up resistor value must be large enough to limit the current to a safe value, which for most I2C devices is 3 milliamps.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-19/09-_2D00_-calc-smallest-value.png" /&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;The 3 mA limit is where the TI app note came up with the approximate 966.6666666666667 ohm resistor!&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ho7pf62h6"&gt;&lt;span data-contrast="auto"&gt;But What VALUE Do You Pick?!&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;After going through these measurement and math exercises, you might still wonder: what value is the right one to pick? Like most engineering answers, the answer depends on your application.&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-19/10-_2D00_-small-vs-weak.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Strong pull-up resistors are small values because they allow more current. Weak pull-up resistors are large values because they allow less current. So, 1 kOhm is very strong, and 10 kOhm is somewhat weak. Meanwhile, the internal pull-up at 50 kOhm is very weak.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;If your application is battery-powered, you will want to use weaker pull-ups to limit the amount of energy wasted. And if you are putting the circuit into a noisy environment, you probably want a solid value for increased noise immunity.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Regardless of your pick, the vital thing to do is make a rise time measurement and determine if you violate the I2C spec! For example, James recommends starting at 4.7 kOhm, measuring the rising edge of SCL, and adjusting the value if your rise time is too slow.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ho7pl1p30"&gt;&lt;span&gt;Downloads &amp;amp; Links:&lt;a id="Downloads" rel="noopener noreferrer nofollow" target="_blank" data-e14adj="t"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;&lt;a href="https://docs.google.com/spreadsheets/d/1moOWFkCpAseQMlNe_JnS2uoikF01dLPxJ75BF_ghdlE/edit?usp=sharing" rel="noopener noreferrer nofollow" target="_blank" data-e14adj="t"&gt;Bald Engineer&amp;#39;s I2C Pull-Up Calcatron&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;a href="https://www.ti.com/lit/an/slva689/slva689.pdf" rel="noopener noreferrer nofollow" target="_blank" data-e14adj="t"&gt;TI I2C Bus Pullup Resistor Calculation App Note&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;a href="https://www.nxp.com/docs/en/application-note/AN10216.pdf" rel="noopener noreferrer nofollow" target="_blank" data-e14adj="t"&gt;I2C Manual (AN10216)&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;a href="https://community.element14.com/challenges-projects/element14-presents/workbenchwednesdays/w/documents/5212/triggering-and-decoding-serial-protocols-on-an-oscilloscope---workbench-wednesdays-34"&gt;Triggering And Decoding Serial Protocols On An Oscilloscope - Workbench Wednesdays 34&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="mcetoc_1ho7q1dt51"&gt;Bill of Material:&lt;a id="BOM" rel="noopener noreferrer nofollow" target="_blank" data-e14adj="t"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id="mcetoc_1ho7q11ik0"&gt;&lt;/h3&gt;
&lt;table class="e14-product-bom-main"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th&gt;Product Name&lt;/th&gt;
&lt;th&gt;Manufacturer&lt;/th&gt;
&lt;th&gt;Quantity&lt;/th&gt;
&lt;th&gt;&lt;a id="e14-product-link-89c2c" data-at-areainteracted="rte-content" data-at-type="click" data-at-link-type="button" href="https://referral.element14.com/OrderCodeView?fsku=2285200,9342362&amp;nsku=63W3545,38K5264&amp;COM=e14c-noscript&amp;CMP=e14c-noscript&amp;osetc=e14-noscript-tracking-loss" data-at-label="PRODUCT_BUY_KIT" class="e14-embedded e14_shopping-cart-far e14-button" onclick="event.preventDefault();e14.func.displayProduct(e14.meta.user.country, this, 'embedded-link', e14.func.getProductLinkJSON('89c2c'));" data-farnell="2285200,9342362" data-newark="63W3545,38K5264" data-comoverride="" data-cmpoverride="" data-cpc="" data-avnetemea="" data-avnetema="" data-avnetasia="" &gt;Buy Kit&lt;/a&gt; &lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Arduino Uno&lt;/td&gt;
&lt;td&gt;Arduino&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;a id="e14-product-link-6c534" data-at-areainteracted="rte-content" data-at-type="click" data-at-link-type="button" href="https://referral.element14.com/OrderCodeView?fsku=2285200&amp;nsku=63W3545&amp;COM=e14c-noscript&amp;CMP=e14c-noscript&amp;osetc=e14-noscript-tracking-loss" data-at-label="PRODUCT_POPUP_OPEN"class="e14-embedded e14_shopping-cart-far e14-button" onclick="event.preventDefault();e14.func.displayProduct(e14.meta.user.country, this, 'embedded-link', e14.func.getProductLinkJSON('6c534'));" data-farnell="2285200" data-newark="63W3545" data-comoverride="" data-cmpoverride="" data-cpc="SC13001" data-avnetemea="" data-avnetema="" data-avnetasia="" &gt;Buy Now&lt;/a&gt; &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3100 piece resistor kit with E6 values, metal film, 1%&lt;/td&gt;
&lt;td&gt;Multicomp Pro&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;a id="e14-product-link-b09c4" data-at-areainteracted="rte-content" data-at-type="click" data-at-link-type="button" href="https://referral.element14.com/OrderCodeView?fsku=9342362&amp;nsku=38K5264&amp;COM=e14c-noscript&amp;CMP=e14c-noscript&amp;osetc=e14-noscript-tracking-loss" data-at-label="PRODUCT_POPUP_OPEN"class="e14-embedded e14_shopping-cart-far e14-button" onclick="event.preventDefault();e14.func.displayProduct(e14.meta.user.country, this, 'embedded-link', e14.func.getProductLinkJSON('b09c4'));" data-farnell="9342362" data-newark="38K5264" data-comoverride="" data-cmpoverride="" data-cpc="" data-avnetemea="" data-avnetema="" data-avnetasia="" &gt;Buy Now&lt;/a&gt; &lt;/td&gt;
&lt;/tr&gt;
&lt;tr class="xs-hide"&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;div style="background:#ffffff;border:1px solid #dadada;margin:0;padding:14px 16px 16px 18px;vertical-align:top;"&gt;
&lt;div style="display:inline-block;float:left;padding:0px 25px 8px 0px;"&gt;&lt;a href="/challengesprojects/element14-presents/" data-e14adj="t"&gt;&lt;img loading="lazy" alt="Workbench Wednesday" src="/e14/assets/main/2021/e14pWorkbench%20Wednesdays_2021.png" width="180px" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style="display:inline-block;vertical-align:top;width:70%;"&gt;&lt;/div&gt;
&lt;div style="display:inline-block;vertical-align:top;width:70%;"&gt;&lt;/div&gt;
&lt;div style="display:inline-block;vertical-align:top;width:70%;"&gt;&lt;span&gt;&lt;a class="jivecontainerTT-hover-container jive-link-community-small" href="/challengesprojects/element14-presents/" data-e14adj="t"&gt;element14 presents&lt;/a&gt;&lt;/span&gt;&amp;nbsp; &lt;strong&gt;|&lt;/strong&gt;&amp;nbsp; &lt;a class="jive-link-wiki-small" href="/challenges-projects/element14-presents/vcp-program/w/documents/3704/vcp-biography-james" data-e14adj="t"&gt;About James&lt;/a&gt;&amp;nbsp;&lt;strong&gt;|&lt;/strong&gt;&amp;nbsp; &lt;a class="jivecontainerTT-hover-container jive-link-community-small" style="color:#007fac;font-family:Arial, &amp;#39;Lucida Grande&amp;#39;, sans-serif;" href="/challengesprojects/element14-presents/workbenchwednesdays/" data-e14adj="t"&gt;Workbench Wednesdays&lt;/a&gt;&amp;nbsp;&lt;a id="Discussion" rel="noopener noreferrer nofollow" target="_blank" data-e14adj="t"&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style="display:inline-block;vertical-align:top;width:70%;"&gt;
&lt;p style="margin:5;"&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: tutorial, i2c, Pull-Up, Bus Capacitance, resistor, electronics&lt;/div&gt;
</description></item><item><title>If and When Do I²C Pull-Up Values Matter? -- Workbench Wednesdays 83</title><link>https://community.element14.com/challenges-projects/element14-presents/workbenchwednesdays/w/documents/28424/if-and-when-do-i2c-pull-up-values-matter----workbench-wednesdays-83/revision/3</link><pubDate>Tue, 05 Mar 2024 17:25:45 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:1c24b830-d648-4ef2-bbe6-110d84819d09</guid><dc:creator>tariq.ahmad</dc:creator><comments>https://community.element14.com/challenges-projects/element14-presents/workbenchwednesdays/w/documents/28424/if-and-when-do-i2c-pull-up-values-matter----workbench-wednesdays-83#comments</comments><description>Revision 3 posted to Documents by tariq.ahmad on 3/5/2024 5:25:45 PM&lt;br /&gt;
&lt;p&gt;&lt;span class="TextRun SCXW186597832 BCX0" lang="EN-US" data-contrast="auto"&gt;&lt;span class="NormalTextRun SCXW186597832 BCX0"&gt;How do you pick I2C pull-up resistor values? The common response is to choose anything between 1 &lt;/span&gt;&lt;span class="NormalTextRun SpellingErrorV2Themed SCXW186597832 BCX0"&gt;kOhm&lt;/span&gt;&lt;span class="NormalTextRun SCXW186597832 BCX0"&gt; and 10 &lt;/span&gt;&lt;span class="NormalTextRun SpellingErrorV2Themed SCXW186597832 BCX0"&gt;kOhm&lt;/span&gt;&lt;span class="NormalTextRun SCXW186597832 BCX0"&gt;. But, still, how do you know the best value? The answer is related to the maximum number of devices you can have without using a repeater, switch, or multiplexer on an I2C bus. Many people would answer a number like 127 since that is how many 7-bit addresses are available. However, creating an I2C bus with more than 20 or so devices is &lt;/span&gt;&lt;span class="NormalTextRun SCXW186597832 BCX0"&gt;nearly impossible&lt;/span&gt;&lt;span class="NormalTextRun SCXW186597832 BCX0"&gt;. Why? Because the bus capacitance matters most&amp;ndash;which is also the key to &lt;/span&gt;&lt;span class="NormalTextRun SCXW186597832 BCX0"&gt;determining&lt;/span&gt;&lt;span class="NormalTextRun SCXW186597832 BCX0"&gt; I2C pull-up resistor values!&lt;/span&gt;&lt;/span&gt;&lt;span class="EOP SCXW186597832 BCX0"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ho7oo31m0"&gt;&lt;span class="EOP SCXW186597832 BCX0"&gt;Watch the Video:&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span class="EOP SCXW186597832 BCX0"&gt;&lt;a href="https://www.youtube.com/watch?v=n2eaY51rkJQ"&gt;www.youtube.com/watch&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="EOP SCXW186597832 BCX0"&gt;&lt;a href="#Downloads" data-e14adj="t"&gt;Downloads &amp;amp; Links&lt;/a&gt; | &lt;a href="#BOM" data-e14adj="t"&gt;Bill of Material&lt;/a&gt; | &lt;a href="#Discussion" data-e14adj="t"&gt;Discussion&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;&lt;img alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/01-_2D00_-baldee-looking-at-app-note.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;James was looking for application notes about picking I2C pull-up resistor values. One that caught his attention was from Texas Instruments. I2C Bus Pullup Resistor Calculation (SLVA689) covers calculating the maximum and minimum pull-up values. It also clearly shows the math for the rise time calculation and bus capacitance. James created an online spreadsheet with pre-configured equations to make things easier for you.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Application notes from many other vendors and tutorials on the web have a similar example as the TI app note. It comes up with the ridiculous range of 966.667 to 1770 ohms. As James says in the video, the only sane value in that range is 1 kOhm. (Although there are a couple of other E12 and E24 values too!) But if that&amp;#39;s the usable range, how do other I2C devices use 2.2, 4.7, or 10 kOhm kOhm work?!&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ho7ou98p1"&gt;&lt;span data-contrast="auto"&gt;Key I2C Numbers to Know&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;We need to know some key information about the I2C specification. James uses a DesignCon 2003 presentation, but these numbers are also available in the full I2C spec. The two most common speeds for I2C are 100 kbit/s and 400 kbit/s. Later in the video, James uses an OLED screen running at 400 kbits/s, so most of the video centers around the faster speed.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/02-_2D00_-key-I2C-numbers-to-know.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;The maximum bus capacitance allowed on I2C for both speeds is 400 picofarads. The maximum rise time of the bus is limited to 1000 nanoseconds and 300 nanoseconds, respectively, depending on the bus speed. Last, it is essential to know that the spec uses the 30% and 70% points of the edge to determine rise time.&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/03-_2D00_-open-drain-example.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;I2C devices need a pull-up resistor because they use an open-drain (or open-collector) architecture. This setup means a device only drives the bus to ground, effectively letting it float when it wants to represent a logic high. When the bus goes high, the pull-up resistor and the bus capacitance limit the signal&amp;#39;s rise time. We see sloped edges on the rise and sharp edges on the fall of I2C waveforms because the two components form an RC network!&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ho7p4p9f3"&gt;&lt;span data-contrast="auto"&gt;Measuring I2C Bus Capacitance&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Estimating I2C bus capacitance has a few issues. Not all I2C devices define their input capacitance. And you need a good model for the interconnects. A far simpler method is to measure it on an actual circuit. James uses an Arduino Uno and an SSD1306-based OLED on a breadboard connected with wires as an example.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/04-_2D00_-OLED-resistors.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;On the back of these OLEDs are 4.7 kOhm pull-up resistors on both the SDA and SCL lines.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;James assumed that SCL and SDA should look very similar, so most measurements only look at SCL. The initial rise time measurement is 534 nanoseconds! The display works, but this value is way outside of the I2C&amp;#39;s spec of 300 nanoseconds for a 400 kHz bus. However, most oscilloscopes default to the 10-90 points of the rise time. After changing the reference levels to use 30-70, the rise time comes out to be 193 nanoseconds.&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/05-_2D00_-70_2D00_30-and-10_2D00_90-rise-times.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Using the 4.7 kOhm pull-up resistor value and the 193 nanosecond rise time, James shows how to calculate the effective bus capacitance using the equations in the TI app note. This math is where the spreadsheet comes in handy! It turns out the bus capacitance is 48 picofarads.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/06-_2D00_-bus-capactiance-example.png" /&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;For most designs, this verification step is the endpoint. Both the rise time and bus capacitance are well below the I2C spec! We have verified this bus is in compliance and could move on. However, James points out that we did ignore one other resistor on the bus: the Arduino&amp;#39;s internal pull-up!&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ho7p8uhf4"&gt;&lt;span data-contrast="auto"&gt;Arduino Internal Pull-Ups&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Nearly all microcontroller GPIO pins offer an internal pull-up resistor. The values of these resistors are usually in the 20 to 50 kilohm range. (They are not actual resistors on the silicon. They&amp;#39;re the resistance of a MOSFET&amp;#39;s drain-to-source channel. But that&amp;#39;s a topic for a different video.)&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;The Arduino&amp;#39;s I2C library, also called &amp;quot;Wire&amp;quot; or &amp;quot;Two-Wire Interface (TWI), enables the internal pull-ups for the I2C pins. James did not consider the internal pull-up when he showed the rise time calculations. An interesting side-effect of a 5V Arduino Uno using its internal pull-up resistor is that it makes the bus compatible with a 3.3 volt device.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/07-_2D00_--simulation-example-50k-par-4k.png" /&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;A quick simulation shows what happens when the internal pull-up connects to 5 volts, and the external pull-up connects to 3.3 volts. The effective high voltage on the I2C bus becomes about 3.4 volts!&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Regarding bus capacitance and rise time, the 50 kOhm resistor has a minimal effect since a smaller external resistor has significantly more pull. But that did leave James to wonder, what if you didn&amp;#39;t use external pull-up resistors at all?&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ho7pbi095"&gt;&lt;span data-contrast="auto"&gt;How Much Pull-Up is Too Much?&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;James removed the 4.7 kOhm surface mount resistors from the OLED module. After that change, the OLED no longer worked! On the oscilloscope, James showed the rise time is over 900 nanoseconds now! No wonder this 400 kbit/s device is not responding.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/08-_2D00_-internal-pull_2D00_ups-are-845-ns.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;The 50 kOhm internal pull-up is too much resistance. Next, James used an external 10 kOhm resistor to see the performance. And with 10 kOhm, the OLED worked and had rise times around 200 nanoseconds. The 50 kOhm internal pull-up is probably strong enough for 100 kbit/s devices. However, it seems far too weak for faster I2C devices.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Going the other direction, what is the smallest value you can use? Why not just use something like 100 ohms to be safe? Remember, I2C devices have to sink the bus&amp;#39;s current. So, the pull-up resistor value must be large enough to limit the current to a safe value, which for most I2C devices is 3 milliamps.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/09-_2D00_-calc-smallest-value.png" /&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;The 3 mA limit is where the TI app note came up with the approximate 966.6666666666667 ohm resistor!&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ho7pf62h6"&gt;&lt;span data-contrast="auto"&gt;But What VALUE Do You Pick?!&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;After going through these measurement and math exercises, you might still wonder: what value is the right one to pick? Like most engineering answers, the answer depends on your application.&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/10-_2D00_-small-vs-weak.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Strong pull-up resistors are small values because they allow more current. Weak pull-up resistors are large values because they allow less current. So, 1 kOhm is very strong, and 10 kOhm is somewhat weak. Meanwhile, the internal pull-up at 50 kOhm is very weak.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;If your application is battery-powered, you will want to use weaker pull-ups to limit the amount of energy wasted. And if you are putting the circuit into a noisy environment, you probably want a solid value for increased noise immunity.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Regardless of your pick, the vital thing to do is make a rise time measurement and determine if you violate the I2C spec! For example, James recommends starting at 4.7 kOhm, measuring the rising edge of SCL, and adjusting the value if your rise time is too slow.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ho7pl1p30"&gt;&lt;span&gt;Downloads &amp;amp; Links:&lt;a id="Downloads" rel="noopener noreferrer nofollow" target="_blank" data-e14adj="t"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;&lt;a href="https://docs.google.com/spreadsheets/d/1moOWFkCpAseQMlNe_JnS2uoikF01dLPxJ75BF_ghdlE/edit?usp=sharing" rel="noopener noreferrer nofollow" target="_blank" data-e14adj="t"&gt;Bald Engineer&amp;#39;s I2C Pull-Up Calcatron&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;a href="https://www.ti.com/lit/an/slva689/slva689.pdf" rel="noopener noreferrer nofollow" target="_blank" data-e14adj="t"&gt;TI I2C Bus Pullup Resistor Calculation App Note&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;a href="https://www.nxp.com/docs/en/application-note/AN10216.pdf" rel="noopener noreferrer nofollow" target="_blank" data-e14adj="t"&gt;I2C Manual (AN10216)&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;a href="https://community.element14.com/challenges-projects/element14-presents/workbenchwednesdays/w/documents/5212/triggering-and-decoding-serial-protocols-on-an-oscilloscope---workbench-wednesdays-34"&gt;Triggering And Decoding Serial Protocols On An Oscilloscope - Workbench Wednesdays 34&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="mcetoc_1ho7q1dt51"&gt;Bill of Material:&lt;a id="BOM" rel="noopener noreferrer nofollow" target="_blank" data-e14adj="t"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id="mcetoc_1ho7q11ik0"&gt;&lt;/h3&gt;
&lt;table class="e14-product-bom-main"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th&gt;Product Name&lt;/th&gt;
&lt;th&gt;Manufacturer&lt;/th&gt;
&lt;th&gt;Quantity&lt;/th&gt;
&lt;th&gt;&lt;a id="e14-product-link-72b48" data-at-areainteracted="rte-content" data-at-type="click" data-at-link-type="button" href="https://referral.element14.com/OrderCodeView?fsku=2285200,9342362&amp;nsku=63W3545,38K5264&amp;COM=e14c-noscript&amp;CMP=e14c-noscript&amp;osetc=e14-noscript-tracking-loss" data-at-label="PRODUCT_BUY_KIT" class="e14-embedded e14_shopping-cart-far e14-button" onclick="event.preventDefault();e14.func.displayProduct(e14.meta.user.country, this, 'embedded-link', e14.func.getProductLinkJSON('72b48'));" data-farnell="2285200,9342362" data-newark="63W3545,38K5264" data-comoverride="" data-cmpoverride="" data-cpc="" data-avnetemea="" data-avnetema="" data-avnetasia="" &gt;Buy Kit&lt;/a&gt; &lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Arduino Uno&lt;/td&gt;
&lt;td&gt;Arduino&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;a id="e14-product-link-c034f" data-at-areainteracted="rte-content" data-at-type="click" data-at-link-type="button" href="https://referral.element14.com/OrderCodeView?fsku=2285200&amp;nsku=63W3545&amp;COM=e14c-noscript&amp;CMP=e14c-noscript&amp;osetc=e14-noscript-tracking-loss" data-at-label="PRODUCT_POPUP_OPEN"class="e14-embedded e14_shopping-cart-far e14-button" onclick="event.preventDefault();e14.func.displayProduct(e14.meta.user.country, this, 'embedded-link', e14.func.getProductLinkJSON('c034f'));" data-farnell="2285200" data-newark="63W3545" data-comoverride="" data-cmpoverride="" data-cpc="SC13001" data-avnetemea="" data-avnetema="" data-avnetasia="" &gt;Buy Now&lt;/a&gt; &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3100 piece resistor kit with E6 values, metal film, 1%&lt;/td&gt;
&lt;td&gt;Multicomp Pro&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;a id="e14-product-link-304be" data-at-areainteracted="rte-content" data-at-type="click" data-at-link-type="button" href="https://referral.element14.com/OrderCodeView?fsku=9342362&amp;nsku=38K5264&amp;COM=e14c-noscript&amp;CMP=e14c-noscript&amp;osetc=e14-noscript-tracking-loss" data-at-label="PRODUCT_POPUP_OPEN"class="e14-embedded e14_shopping-cart-far e14-button" onclick="event.preventDefault();e14.func.displayProduct(e14.meta.user.country, this, 'embedded-link', e14.func.getProductLinkJSON('304be'));" data-farnell="9342362" data-newark="38K5264" data-comoverride="" data-cmpoverride="" data-cpc="" data-avnetemea="" data-avnetema="" data-avnetasia="" &gt;Buy Now&lt;/a&gt; &lt;/td&gt;
&lt;/tr&gt;
&lt;tr class="xs-hide"&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;div style="background:#ffffff;border:1px solid #dadada;margin:0;padding:14px 16px 16px 18px;vertical-align:top;"&gt;
&lt;div style="display:inline-block;float:left;padding:0px 25px 8px 0px;"&gt;&lt;a href="/challengesprojects/element14-presents/" data-e14adj="t"&gt;&lt;img loading="lazy" alt="Workbench Wednesday" src="/e14/assets/main/2021/e14pWorkbench%20Wednesdays_2021.png" width="180px" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style="display:inline-block;vertical-align:top;width:70%;"&gt;&lt;/div&gt;
&lt;div style="display:inline-block;vertical-align:top;width:70%;"&gt;&lt;/div&gt;
&lt;div style="display:inline-block;vertical-align:top;width:70%;"&gt;&lt;span&gt;&lt;a class="jivecontainerTT-hover-container jive-link-community-small" href="/challengesprojects/element14-presents/" data-e14adj="t"&gt;element14 presents&lt;/a&gt;&lt;/span&gt;&amp;nbsp; &lt;strong&gt;|&lt;/strong&gt;&amp;nbsp; &lt;a class="jive-link-wiki-small" href="/challenges-projects/element14-presents/vcp-program/w/documents/3704/vcp-biography-james" data-e14adj="t"&gt;About James&lt;/a&gt;&amp;nbsp;&lt;strong&gt;|&lt;/strong&gt;&amp;nbsp; &lt;a class="jivecontainerTT-hover-container jive-link-community-small" style="color:#007fac;font-family:Arial, &amp;#39;Lucida Grande&amp;#39;, sans-serif;" href="/challengesprojects/element14-presents/workbenchwednesdays/" data-e14adj="t"&gt;Workbench Wednesdays&lt;/a&gt;&amp;nbsp;&lt;a id="Discussion" rel="noopener noreferrer nofollow" target="_blank" data-e14adj="t"&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style="display:inline-block;vertical-align:top;width:70%;"&gt;
&lt;p style="margin:5;"&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: tutorial, i2c, Pull-Up, Bus Capacitance, resistor, electronics&lt;/div&gt;
</description></item><item><title>If and When Do I²C Pull-Up Values Matter? -- Workbench Wednesdays 83</title><link>https://community.element14.com/challenges-projects/element14-presents/workbenchwednesdays/w/documents/28424/if-and-when-do-i2c-pull-up-values-matter----workbench-wednesdays-83/revision/2</link><pubDate>Tue, 05 Mar 2024 17:18:01 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:1c24b830-d648-4ef2-bbe6-110d84819d09</guid><dc:creator>tariq.ahmad</dc:creator><comments>https://community.element14.com/challenges-projects/element14-presents/workbenchwednesdays/w/documents/28424/if-and-when-do-i2c-pull-up-values-matter----workbench-wednesdays-83#comments</comments><description>Revision 2 posted to Documents by tariq.ahmad on 3/5/2024 5:18:01 PM&lt;br /&gt;
&lt;p&gt;&lt;span class="TextRun SCXW186597832 BCX0" lang="EN-US" data-contrast="auto"&gt;&lt;span class="NormalTextRun SCXW186597832 BCX0"&gt;How do you pick I2C pull-up resistor values? The common response is to choose anything between 1 &lt;/span&gt;&lt;span class="NormalTextRun SpellingErrorV2Themed SCXW186597832 BCX0"&gt;kOhm&lt;/span&gt;&lt;span class="NormalTextRun SCXW186597832 BCX0"&gt; and 10 &lt;/span&gt;&lt;span class="NormalTextRun SpellingErrorV2Themed SCXW186597832 BCX0"&gt;kOhm&lt;/span&gt;&lt;span class="NormalTextRun SCXW186597832 BCX0"&gt;. But, still, how do you know the best value? The answer is related to the maximum number of devices you can have without using a repeater, switch, or multiplexer on an I2C bus. Many people would answer a number like 127 since that is how many 7-bit addresses are available. However, creating an I2C bus with more than 20 or so devices is &lt;/span&gt;&lt;span class="NormalTextRun SCXW186597832 BCX0"&gt;nearly impossible&lt;/span&gt;&lt;span class="NormalTextRun SCXW186597832 BCX0"&gt;. Why? Because the bus capacitance matters most&amp;ndash;which is also the key to &lt;/span&gt;&lt;span class="NormalTextRun SCXW186597832 BCX0"&gt;determining&lt;/span&gt;&lt;span class="NormalTextRun SCXW186597832 BCX0"&gt; I2C pull-up resistor values!&lt;/span&gt;&lt;/span&gt;&lt;span class="EOP SCXW186597832 BCX0"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ho7oo31m0"&gt;&lt;span class="EOP SCXW186597832 BCX0"&gt;Watch the Video:&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span class="EOP SCXW186597832 BCX0"&gt;&lt;a href="https://www.youtube.com/watch?v=n2eaY51rkJQ"&gt;www.youtube.com/watch&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;&lt;img alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/01-_2D00_-baldee-looking-at-app-note.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;James was looking for application notes about picking I2C pull-up resistor values. One that caught his attention was from Texas Instruments. I2C Bus Pullup Resistor Calculation (SLVA689) covers calculating the maximum and minimum pull-up values. It also clearly shows the math for the rise time calculation and bus capacitance. James created an online spreadsheet with pre-configured equations to make things easier for you.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Application notes from many other vendors and tutorials on the web have a similar example as the TI app note. It comes up with the ridiculous range of 966.667 to 1770 ohms. As James says in the video, the only sane value in that range is 1 kOhm. (Although there are a couple of other E12 and E24 values too!) But if that&amp;#39;s the usable range, how do other I2C devices use 2.2, 4.7, or 10 kOhm kOhm work?!&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ho7ou98p1"&gt;&lt;span data-contrast="auto"&gt;Key I2C Numbers to Know&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;We need to know some key information about the I2C specification. James uses a DesignCon 2003 presentation, but these numbers are also available in the full I2C spec. The two most common speeds for I2C are 100 kbit/s and 400 kbit/s. Later in the video, James uses an OLED screen running at 400 kbits/s, so most of the video centers around the faster speed.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/02-_2D00_-key-I2C-numbers-to-know.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;The maximum bus capacitance allowed on I2C for both speeds is 400 picofarads. The maximum rise time of the bus is limited to 1000 nanoseconds and 300 nanoseconds, respectively, depending on the bus speed. Last, it is essential to know that the spec uses the 30% and 70% points of the edge to determine rise time.&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/03-_2D00_-open-drain-example.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;I2C devices need a pull-up resistor because they use an open-drain (or open-collector) architecture. This setup means a device only drives the bus to ground, effectively letting it float when it wants to represent a logic high. When the bus goes high, the pull-up resistor and the bus capacitance limit the signal&amp;#39;s rise time. We see sloped edges on the rise and sharp edges on the fall of I2C waveforms because the two components form an RC network!&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ho7p4p9f3"&gt;&lt;span data-contrast="auto"&gt;Measuring I2C Bus Capacitance&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Estimating I2C bus capacitance has a few issues. Not all I2C devices define their input capacitance. And you need a good model for the interconnects. A far simpler method is to measure it on an actual circuit. James uses an Arduino Uno and an SSD1306-based OLED on a breadboard connected with wires as an example.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/04-_2D00_-OLED-resistors.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;On the back of these OLEDs are 4.7 kOhm pull-up resistors on both the SDA and SCL lines.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;James assumed that SCL and SDA should look very similar, so most measurements only look at SCL. The initial rise time measurement is 534 nanoseconds! The display works, but this value is way outside of the I2C&amp;#39;s spec of 300 nanoseconds for a 400 kHz bus. However, most oscilloscopes default to the 10-90 points of the rise time. After changing the reference levels to use 30-70, the rise time comes out to be 193 nanoseconds.&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/05-_2D00_-70_2D00_30-and-10_2D00_90-rise-times.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Using the 4.7 kOhm pull-up resistor value and the 193 nanosecond rise time, James shows how to calculate the effective bus capacitance using the equations in the TI app note. This math is where the spreadsheet comes in handy! It turns out the bus capacitance is 48 picofarads.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/06-_2D00_-bus-capactiance-example.png" /&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;For most designs, this verification step is the endpoint. Both the rise time and bus capacitance are well below the I2C spec! We have verified this bus is in compliance and could move on. However, James points out that we did ignore one other resistor on the bus: the Arduino&amp;#39;s internal pull-up!&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ho7p8uhf4"&gt;&lt;span data-contrast="auto"&gt;Arduino Internal Pull-Ups&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Nearly all microcontroller GPIO pins offer an internal pull-up resistor. The values of these resistors are usually in the 20 to 50 kilohm range. (They are not actual resistors on the silicon. They&amp;#39;re the resistance of a MOSFET&amp;#39;s drain-to-source channel. But that&amp;#39;s a topic for a different video.)&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;The Arduino&amp;#39;s I2C library, also called &amp;quot;Wire&amp;quot; or &amp;quot;Two-Wire Interface (TWI), enables the internal pull-ups for the I2C pins. James did not consider the internal pull-up when he showed the rise time calculations. An interesting side-effect of a 5V Arduino Uno using its internal pull-up resistor is that it makes the bus compatible with a 3.3 volt device.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/07-_2D00_--simulation-example-50k-par-4k.png" /&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;A quick simulation shows what happens when the internal pull-up connects to 5 volts, and the external pull-up connects to 3.3 volts. The effective high voltage on the I2C bus becomes about 3.4 volts!&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Regarding bus capacitance and rise time, the 50 kOhm resistor has a minimal effect since a smaller external resistor has significantly more pull. But that did leave James to wonder, what if you didn&amp;#39;t use external pull-up resistors at all?&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ho7pbi095"&gt;&lt;span data-contrast="auto"&gt;How Much Pull-Up is Too Much?&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;James removed the 4.7 kOhm surface mount resistors from the OLED module. After that change, the OLED no longer worked! On the oscilloscope, James showed the rise time is over 900 nanoseconds now! No wonder this 400 kbit/s device is not responding.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/08-_2D00_-internal-pull_2D00_ups-are-845-ns.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;The 50 kOhm internal pull-up is too much resistance. Next, James used an external 10 kOhm resistor to see the performance. And with 10 kOhm, the OLED worked and had rise times around 200 nanoseconds. The 50 kOhm internal pull-up is probably strong enough for 100 kbit/s devices. However, it seems far too weak for faster I2C devices.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Going the other direction, what is the smallest value you can use? Why not just use something like 100 ohms to be safe? Remember, I2C devices have to sink the bus&amp;#39;s current. So, the pull-up resistor value must be large enough to limit the current to a safe value, which for most I2C devices is 3 milliamps.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/09-_2D00_-calc-smallest-value.png" /&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;The 3 mA limit is where the TI app note came up with the approximate 966.6666666666667 ohm resistor!&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ho7pf62h6"&gt;&lt;span data-contrast="auto"&gt;But What VALUE Do You Pick?!&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;After going through these measurement and math exercises, you might still wonder: what value is the right one to pick? Like most engineering answers, the answer depends on your application.&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/10-_2D00_-small-vs-weak.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Strong pull-up resistors are small values because they allow more current. Weak pull-up resistors are large values because they allow less current. So, 1 kOhm is very strong, and 10 kOhm is somewhat weak. Meanwhile, the internal pull-up at 50 kOhm is very weak.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;If your application is battery-powered, you will want to use weaker pull-ups to limit the amount of energy wasted. And if you are putting the circuit into a noisy environment, you probably want a solid value for increased noise immunity.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Regardless of your pick, the vital thing to do is make a rise time measurement and determine if you violate the I2C spec! For example, James recommends starting at 4.7 kOhm, measuring the rising edge of SCL, and adjusting the value if your rise time is too slow.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ho7pl1p30"&gt;&lt;span&gt;Downloads &amp;amp; Links:&lt;/span&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;&lt;a href="https://docs.google.com/spreadsheets/d/1moOWFkCpAseQMlNe_JnS2uoikF01dLPxJ75BF_ghdlE/edit?usp=sharing" rel="noopener noreferrer nofollow" target="_blank" data-e14adj="t"&gt;Bald Engineer&amp;#39;s I2C Pull-Up Calcatron&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;a href="https://www.ti.com/lit/an/slva689/slva689.pdf" rel="noopener noreferrer nofollow" target="_blank" data-e14adj="t"&gt;TI I2C Bus Pullup Resistor Calculation App Note&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;a href="https://www.nxp.com/docs/en/application-note/AN10216.pdf" rel="noopener noreferrer nofollow" target="_blank" data-e14adj="t"&gt;I2C Manual (AN10216)&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;a href="https://community.element14.com/challenges-projects/element14-presents/workbenchwednesdays/w/documents/5212/triggering-and-decoding-serial-protocols-on-an-oscilloscope---workbench-wednesdays-34"&gt;Triggering And Decoding Serial Protocols On An Oscilloscope - Workbench Wednesdays 34&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item><item><title>If and When Do I²C Pull-Up Values Matter? -- Workbench Wednesdays 83</title><link>https://community.element14.com/challenges-projects/element14-presents/workbenchwednesdays/w/documents/28424/if-and-when-do-i2c-pull-up-values-matter----workbench-wednesdays-83/revision/1</link><pubDate>Tue, 05 Mar 2024 17:12:06 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:1c24b830-d648-4ef2-bbe6-110d84819d09</guid><dc:creator>tariq.ahmad</dc:creator><comments>https://community.element14.com/challenges-projects/element14-presents/workbenchwednesdays/w/documents/28424/if-and-when-do-i2c-pull-up-values-matter----workbench-wednesdays-83#comments</comments><description>Revision 1 posted to Documents by tariq.ahmad on 3/5/2024 5:12:06 PM&lt;br /&gt;
&lt;p&gt;&lt;span class="TextRun SCXW186597832 BCX0" lang="EN-US" data-contrast="auto"&gt;&lt;span class="NormalTextRun SCXW186597832 BCX0"&gt;How do you pick I2C pull-up resistor values? The common response is to choose anything between 1 &lt;/span&gt;&lt;span class="NormalTextRun SpellingErrorV2Themed SCXW186597832 BCX0"&gt;kOhm&lt;/span&gt;&lt;span class="NormalTextRun SCXW186597832 BCX0"&gt; and 10 &lt;/span&gt;&lt;span class="NormalTextRun SpellingErrorV2Themed SCXW186597832 BCX0"&gt;kOhm&lt;/span&gt;&lt;span class="NormalTextRun SCXW186597832 BCX0"&gt;. But, still, how do you know the best value? The answer is related to the maximum number of devices you can have without using a repeater, switch, or multiplexer on an I2C bus. Many people would answer a number like 127 since that is how many 7-bit addresses are available. However, creating an I2C bus with more than 20 or so devices is &lt;/span&gt;&lt;span class="NormalTextRun SCXW186597832 BCX0"&gt;nearly impossible&lt;/span&gt;&lt;span class="NormalTextRun SCXW186597832 BCX0"&gt;. Why? Because the bus capacitance matters most&amp;ndash;which is also the key to &lt;/span&gt;&lt;span class="NormalTextRun SCXW186597832 BCX0"&gt;determining&lt;/span&gt;&lt;span class="NormalTextRun SCXW186597832 BCX0"&gt; I2C pull-up resistor values!&lt;/span&gt;&lt;/span&gt;&lt;span class="EOP SCXW186597832 BCX0"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ho7oo31m0"&gt;&lt;span class="EOP SCXW186597832 BCX0"&gt;Watch the Video:&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span class="EOP SCXW186597832 BCX0"&gt;&lt;a href="https://www.youtube.com/watch?v=n2eaY51rkJQ"&gt;www.youtube.com/watch&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;&lt;img alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/01-_2D00_-baldee-looking-at-app-note.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;James was looking for application notes about picking I2C pull-up resistor values. One that caught his attention was from Texas Instruments. I2C Bus Pullup Resistor Calculation (SLVA689) covers calculating the maximum and minimum pull-up values. It also clearly shows the math for the rise time calculation and bus capacitance. James created an online spreadsheet with pre-configured equations to make things easier for you.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Application notes from many other vendors and tutorials on the web have a similar example as the TI app note. It comes up with the ridiculous range of 966.667 to 1770 ohms. As James says in the video, the only sane value in that range is 1 kOhm. (Although there are a couple of other E12 and E24 values too!) But if that&amp;#39;s the usable range, how do other I2C devices use 2.2, 4.7, or 10 kOhm kOhm work?!&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ho7ou98p1"&gt;&lt;span data-contrast="auto"&gt;Key I2C Numbers to Know&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;We need to know some key information about the I2C specification. James uses a DesignCon 2003 presentation, but these numbers are also available in the full I2C spec. The two most common speeds for I2C are 100 kbit/s and 400 kbit/s. Later in the video, James uses an OLED screen running at 400 kbits/s, so most of the video centers around the faster speed.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/02-_2D00_-key-I2C-numbers-to-know.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;The maximum bus capacitance allowed on I2C for both speeds is 400 picofarads. The maximum rise time of the bus is limited to 1000 nanoseconds and 300 nanoseconds, respectively, depending on the bus speed. Last, it is essential to know that the spec uses the 30% and 70% points of the edge to determine rise time.&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/03-_2D00_-open-drain-example.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;I2C devices need a pull-up resistor because they use an open-drain (or open-collector) architecture. This setup means a device only drives the bus to ground, effectively letting it float when it wants to represent a logic high. When the bus goes high, the pull-up resistor and the bus capacitance limit the signal&amp;#39;s rise time. We see sloped edges on the rise and sharp edges on the fall of I2C waveforms because the two components form an RC network!&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ho7p4p9f3"&gt;&lt;span data-contrast="auto"&gt;Measuring I2C Bus Capacitance&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Estimating I2C bus capacitance has a few issues. Not all I2C devices define their input capacitance. And you need a good model for the interconnects. A far simpler method is to measure it on an actual circuit. James uses an Arduino Uno and an SSD1306-based OLED on a breadboard connected with wires as an example.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/04-_2D00_-OLED-resistors.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;On the back of these OLEDs are 4.7 kOhm pull-up resistors on both the SDA and SCL lines.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;James assumed that SCL and SDA should look very similar, so most measurements only look at SCL. The initial rise time measurement is 534 nanoseconds! The display works, but this value is way outside of the I2C&amp;#39;s spec of 300 nanoseconds for a 400 kHz bus. However, most oscilloscopes default to the 10-90 points of the rise time. After changing the reference levels to use 30-70, the rise time comes out to be 193 nanoseconds.&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/05-_2D00_-70_2D00_30-and-10_2D00_90-rise-times.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Using the 4.7 kOhm pull-up resistor value and the 193 nanosecond rise time, James shows how to calculate the effective bus capacitance using the equations in the TI app note. This math is where the spreadsheet comes in handy! It turns out the bus capacitance is 48 picofarads.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/06-_2D00_-bus-capactiance-example.png" /&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;For most designs, this verification step is the endpoint. Both the rise time and bus capacitance are well below the I2C spec! We have verified this bus is in compliance and could move on. However, James points out that we did ignore one other resistor on the bus: the Arduino&amp;#39;s internal pull-up!&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ho7p8uhf4"&gt;&lt;span data-contrast="auto"&gt;Arduino Internal Pull-Ups&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Nearly all microcontroller GPIO pins offer an internal pull-up resistor. The values of these resistors are usually in the 20 to 50 kilohm range. (They are not actual resistors on the silicon. They&amp;#39;re the resistance of a MOSFET&amp;#39;s drain-to-source channel. But that&amp;#39;s a topic for a different video.)&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;The Arduino&amp;#39;s I2C library, also called &amp;quot;Wire&amp;quot; or &amp;quot;Two-Wire Interface (TWI), enables the internal pull-ups for the I2C pins. James did not consider the internal pull-up when he showed the rise time calculations. An interesting side-effect of a 5V Arduino Uno using its internal pull-up resistor is that it makes the bus compatible with a 3.3 volt device.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/07-_2D00_--simulation-example-50k-par-4k.png" /&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;A quick simulation shows what happens when the internal pull-up connects to 5 volts, and the external pull-up connects to 3.3 volts. The effective high voltage on the I2C bus becomes about 3.4 volts!&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Regarding bus capacitance and rise time, the 50 kOhm resistor has a minimal effect since a smaller external resistor has significantly more pull. But that did leave James to wonder, what if you didn&amp;#39;t use external pull-up resistors at all?&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ho7pbi095"&gt;&lt;span data-contrast="auto"&gt;How Much Pull-Up is Too Much?&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;James removed the 4.7 kOhm surface mount resistors from the OLED module. After that change, the OLED no longer worked! On the oscilloscope, James showed the rise time is over 900 nanoseconds now! No wonder this 400 kbit/s device is not responding.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/08-_2D00_-internal-pull_2D00_ups-are-845-ns.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;The 50 kOhm internal pull-up is too much resistance. Next, James used an external 10 kOhm resistor to see the performance. And with 10 kOhm, the OLED worked and had rise times around 200 nanoseconds. The 50 kOhm internal pull-up is probably strong enough for 100 kbit/s devices. However, it seems far too weak for faster I2C devices.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Going the other direction, what is the smallest value you can use? Why not just use something like 100 ohms to be safe? Remember, I2C devices have to sink the bus&amp;#39;s current. So, the pull-up resistor value must be large enough to limit the current to a safe value, which for most I2C devices is 3 milliamps.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/09-_2D00_-calc-smallest-value.png" /&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;The 3 mA limit is where the TI app note came up with the approximate 966.6666666666667 ohm resistor!&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1ho7pf62h6"&gt;&lt;span data-contrast="auto"&gt;But What VALUE Do You Pick?!&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;After going through these measurement and math exercises, you might still wonder: what value is the right one to pick? Like most engineering answers, the answer depends on your application.&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;img loading="lazy" alt="image" style="max-height:360px;max-width:640px;"  src="/resized-image/__size/1280x720/__key/communityserver-wikis-components-files/00-00-00-04-35/10-_2D00_-small-vs-weak.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Strong pull-up resistors are small values because they allow more current. Weak pull-up resistors are large values because they allow less current. So, 1 kOhm is very strong, and 10 kOhm is somewhat weak. Meanwhile, the internal pull-up at 50 kOhm is very weak.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;If your application is battery-powered, you will want to use weaker pull-ups to limit the amount of energy wasted. And if you are putting the circuit into a noisy environment, you probably want a solid value for increased noise immunity.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-contrast="auto"&gt;Regardless of your pick, the vital thing to do is make a rise time measurement and determine if you violate the I2C spec! For example, James recommends starting at 4.7 kOhm, measuring the rising edge of SCL, and adjusting the value if your rise time is too slow.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item></channel></rss>