Talk:I²C

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Nonsense[edit]

"Buses of this type became popular when ??? realized that much of the expense of an integrated circuit results from the size of the package and the number of pins." There's a noun missing in this sentence, and I'm not sure what it's supposed to be --Jsnow 21:27, 6 May 2005 (UTC)[reply]

Some anon deleted the word "engineers". - Omegatron 21:54, May 6, 2005 (UTC)
If much of the cost of an IC is really the packaging why do even the lowest pin count pics cost far more than basic logic chips? Plugwash 23:44, 7 October 2006 (UTC)[reply]
Maybe they don't mean the cost of chip manufacturing, but the cost of using it on a PCB? Large size, etc. — Omegatron 02:11, 8 October 2006 (UTC)[reply]
The manufactoring cost of IC depends on the size of the die (technology) and lenght of the wires that needs to be assembled from the die to pin. So, if we got PGA and we want to make it in to DIP we are basically making manufacturing time times longer and hence increasing the component price. Reason why many things are actually expensive and others are not (pic vs 0805) is not their manufactoring cost but how much components are bought, desicions of advertisment and design costs. Basically this article does not cover the real way the price is generated but i thought someone would be happy to read. 176.46.9.165 (talk) 09:17, 26 November 2011 (UTC)[reply]

Would it not be better to say "clock frequencies down to 0Hz" rather than "down to DC"? It may be the same thing, but DC is not usually used to refer to clock frequency. —Preceding unsigned comment added by 146.232.75.208 (talk) 13:19, 5 April 2008 (UTC)[reply]

Sure, now says "arbitrarily low clocks" 69.226.236.175 (talk) 22:53, 26 August 2009 (UTC)[reply]
No, 0Hz could mean 0 Volt for an eternity, which would starve the device 130.89.167.48 (talk) 20:14, 24 October 2010 (UTC)[reply]

Synonyms[edit]

I'm not sure how to do it but could someone else edit the page so that if "2-wire serial" or similar is searched for then this page comes up? FzerozeroT 21:25, 14 November 2006 (UTC)[reply]

I think it can be done, whilst another 2-wire interface wouldn't be presented (then 2-wire serial, 2-wire redirects should be replaced by disambig). --Yuriy Lapitskiy 06:20, 15 November 2006 (UTC)

The same should be the case for TWI (Two Wire Interface) which some uC makers prefer to call the famliy of busses. 81.215.13.145 13:05, 19 February 2007 (UTC)[reply]

Now we have a bit of confusion: "Two Wire Interface" redirects to this page, but the first paragraph of the page makes a clear distinction between the I2C and TWI. ("[I2C,] Not to be confused with the term Two Wire Interface which only describes a compatible hardware interface.") If they aren't synonyms, they should have separate articles (that mention and link to each other, obviously). Mattgilbertnet (talk) 20:59, 4 December 2013 (UTC)[reply]

I think that "two-wire interface" might vary from chip-to-chip or vendor-to-vendor, since it isn't an official spec. I²C#Derivative_technologies covers it. Basically it is a subset of I2C. I would say NO to another article, but YES to clarification in this article. It would be a good idea to elaborate on the various subsets and related buses. • SbmeirowTalk • 22:06, 4 December 2013 (UTC)[reply]

Instead of "2-wire serial", it should be "3-wire", right? Same as those misleading descriptions of "1-wire" systems (which are actually 2-wire) which leave out the ground wire - totally misleading. KorgBoy (talk) 03:28, 3 May 2019 (UTC)[reply]

Pronounciation[edit]

Is there a reference which says "eye-too-see" is incorrect prounouciation? --Cowbert 22:55, 27 December 2006 (UTC)[reply]

How about the converse: can you find a source that says it is correct? Everywhere I look it says "squared" not "two". If there is no de jure pronunciation then the de facto pronunciation is eye-squared-see; I have never heard it said eye-two-see for that matter. Cburnett 23:47, 27 December 2006 (UTC)[reply]
Fine, but the article asserts that "I-two-C" is incorrect. The burden of proof for actually making an assertion is higher than observing an absence of proof to the contrary. I have no problem with the article stating that "eye-squared-see" is the de-facto pronounciation; anon_user back on 29 Nov 2006 added the "also, incorrectly..." clause, without a reference. --Cowbert 01:18, 29 December 2006 (UTC)[reply]
Except eye-two-see is incorrect pronunciation by the mere fact that virtually no one says it. Do a google search to see my point. "eye-two-see" gets 1 hit. "I-squared-C" gets 582 hits. "I-two-C" gets 4 hits. When something is widely true, so true that no source is going to assert it then you can't source it. You're not going to find a source saying that "bob" is pronounced "pop" (a bit hyperbolic, perhaps, but illustrates my point). I do welcome any suggestions on how to deal with this. If it has to be reworded to be less authoritative, then so be it. At the end of the day "eye-two-see" is incorrect though... Cburnett 01:41, 29 December 2006 (UTC)[reply]
As a counterpoint, I would wager that most anyone assuming the I-two-C pronunciation would not explicitely spell out the pronunciation on a webpage. After all, it is commonly spelled "I2C", not "I^2C" or "I²C" when not typeset. You only need to say "I-squared-C" when arguing that is is pronounced differently than it looks. I would still like to see an authoritative source that I-two-C is absolutely incorrect. The superset two doesn't mean a lot, since it has been used in other electronics (e.g. Odyssey²) to mean "two". I have indeed heard it it called I-two-C in electronics labs before. --141.212.106.126
While Philips engineers pronounce it "eye-squared-see", many end users do indeed pronounce it "eye-two-see", regardless of Google hits (I work for a company that specializes in I2C). AFAIK Philips does not specify the correct pronunciation - but when you consider that the only reason the pronunciation of "eye-two-see" abounds is because of the difficulty of printing the "squared" symbol and ignorance that it is indeed a "squared" and not a "two", I think it's fair to say that "eye-too-see" is incorrect. Philips won't take away your slave address license for saying "eye-two-see" :) but they will repeat it back to you as "eye-squared-see". --Intx13 21:57, 31 July 2007 (UTC)[reply]
For what it's worth, I've never heard anyone say anything *but* "eye-two-see" when talking. It's often written that way, what with superscripts being as hard to type as to pronounce. Google search returned 2.7 million for "i2c", barely 140 thousand for I²C... I count the latter as a pedantic path, understood but rarely used in practice. 69.226.236.175 (talk) —Preceding undated comment added 23:06, 26 August 2009 (UTC).[reply]
Actually, it's pronounced minus-one-see. But seriously, it means "inter-intergrated-circuit", so if eye-squared-see is incorrect, it would have been called 2IC.130.89.167.48 (talk) 20:20, 24 October 2010 (UTC)[reply]
Not necessarily, the W3C is the World Wide Web Consortium and is said "double-u-three-c"; the postfix number can apply to the previous element in the acronym. Haldean Brown (talk) 15:40, 2 November 2016 (UTC)[reply]
Also for what it's worth I've always said and heard "two". More generally is there a standard for double letters in acronyms? Saying squared does not seem like an appropriate way to denote two of something. — Preceding unsigned comment added by Asdf39 (talkcontribs) 01:44, 11 October 2011 (UTC)[reply]

In this video #4 - I²C (I2C) Bit Banging I²C is called Eye-two-See. (In most others Eye-Squared-See) Sebastian --188.194.197.12 (talk) 22:52, 20 August 2018 (UTC)[reply]

Proposal: Addition of I2C-RAM[edit]

Also I2C-RAMs are available, for instance the PCF8570 (Philips). It is helpful for communication between processors or controllers. —Preceding unsigned comment added by 80.156.43.1 (talk) 17:29, 30 October 2007 (UTC)[reply]

Licensing[edit]

The articale states "As of October 1, 2006, no licensing fees are required to implement the I²C protocol". I'd be interested to know about licencing terms Philips used to require. I seemed to remember that you could implement the bus logic, just not call your device "i2c compatible" unless you wrote a cheque. Anyone know more on this ? Whenrybruce (talk) 23:16, 3 November 2008 (UTC)[reply]

I believe i2c as a term was trademarked but the interface technique itself wasn't. Thus you'd have companies developing the exact same thing and calling it "two wire interface" among others. Intel developed their own version of i2c, changed the voltages, and called it smbus. —Preceding unsigned comment added by 150.135.210.16 (talk) 01:21, 29 October 2010 (UTC)[reply]
i2c was trademarked but that word mark has expired, see references. the word mark for 'i2c bus' is still effective as of this date: 70.189.92.82 (talk) 18:45, 23 February 2018 (UTC)[reply]
Also this may need clarifying as the page it references too (I²C Licensing Information) states "A license is required for implementing an I2C interface on a chip (IC, ASIC, FPGA, etc)." Whereas the wiki page contradicts this saying "no licensing fees are required to implement the I²C protocol" Please could someone clarify/correct this? 81.155.87.216 (talk) 14:49, 24 February 2014 (UTC)[reply]
The PDF link provided by anonymous 81.155.87.216 editor was created in 2003, which is 11 years old. At some point in the past months, I thought that I read that I2C no longer needs a license, but NXP does require a fee to add to their I2C Address Document...though I don't remember where I read it. • SbmeirowTalk • 20:56, 24 February 2014 (UTC)[reply]
I agree that the referenced PDF says no such thing about licensing not being required, and in fact says the opposite. And as pointed out, the attached document dates to 2003, not 2006. The sentence should either be removed or fixed. 205.153.101.8 (talk) 14:57, 15 March 2016 (UTC)[reply]

Propose removing "Example of bit-banging the I2C Master protocol"[edit]

There is a whole page of code dropped in, with no context and no explanation why it is important. Furthermore it has a lot of undefined functions (I assume some sort of library is used). And it disrupts the article. It's a good faith addition, but WP is not an instruction manual (WP:NOTMANUAL) for lots of reasons, e.g. the code cannot be ascertained to be good. I propose deleting it. Adpete (talk) 00:36, 2 February 2011 (UTC)[reply]

Your are fast : only one day after the proposal the section is removed. I suggest you remove the same section in the SPI wikipedia section.
What don't you interstand in the code ?
The code is only a template (like spi one), it isn't the full code.
Why it is usefull ? Because it helps understand how i2c realy work. And it is an illustration of all the concept explain earlier (start/stop bit, clock stretching, ack/nak, ...)
unsigned start = 0;
unsigned read_bit(void)
{
	unsigned bit;

	/* Let the slave drive data */
	READSDA();
	I2CDELAY(I2CSPEED/2);
	/* Clock stretching */
	while (READSCL() == 0);
	/* SCL is high, now data is valid */
	bit = READSDA();
	I2CDELAY(I2CSPEED/2);
	CLRSCL();
	return bit;
}

void write_bit(unsigned bit)
{
	if (bit) {
		READSDA();
	} else {
		CLRSDA();
	}
	I2CDELAY(I2CSPEED/2);
	/* Clock stretching */
	while (READSCL() == 0);
	/* SCL is high, now data is valid */
	/* If SDA is high, check that nobody else is driving SDA */
	if (bit) {
                if (READSDA() == 0) {
		       ARBITRATION_LOST();
		}
	}
	I2CDELAY(I2CSPEED/2);
	CLRSCL();
}

void start_cond(void)
{
	if (start) {
		/* set SDA to 1 */
		READSDA();
		I2CDELAY(I2CSPEED/2);
		/* Clock stretching */
		while (READSCL() == 0);
	}
	if (READSDA() == 0) {
		ARBITRATION_LOST();
	}
	/* SCL is high, set SDA from 1 to 0 */
	CLRSDA();
	I2CDELAY(I2CSPEED/2);
	CLRSCL();
	start = 1;
}

void stop_cond(void)
{
	/* set SDA to 0 */
	CLRSDA();
	I2CDELAY(I2CSPEED/2);
	/* Clock stretching */
	while (READSCL() == 0);
	/* SCL is high, set SDA from 0 to 1 */
	if (READSDA() == 0) {
		ARBITRATION_LOST();
	}
	I2CDELAY(I2CSPEED/2);
	start = 0;
}

unsigned tx(int send_start, int send_stop, unsigned char byte)
{
	unsigned bit;
	unsigned nack;

	if (send_start) {
		start_cond();
	}
	for (bit = 0; bit < 8; bit++) {
		write_bit(byte & 0x80);
		byte <<= 1;
	}
	nack = read_bit();
	if (send_stop) {
		stop_cond();
	}
	return nack;
}

unsigned char rx (int nak, int send_stop)
{
	unsigned char byte = 0;
	unsigned bit;

	for (bit = 0; bit < 8; bit++) {
             byte <<= 1;		
             byte |= read_bit();		
	}
	write_bit(nak);
	if (send_stop) {
		stop_cond();
	}
	return byte;
}

Well it's certainly no use to me. It's too long to read easily. Yes I can see functions start_cond and stop_cond, but since they are explained far far better in the above diagram, what's the point? As far as I can see, all it is doing is converting a byte to serial, and then sending/receiving it using the I2C protocol. Do we really need a page+ of code just to illustrate that? And how do we know the code works? Where is the reference? But most crucially, Wikipedia is not a technical manual. Its job is to describe I2C, not teach it. Adpete (talk) 10:58, 16 February 2011 (UTC)[reply]

No answer to these objections, so I'll delete it in the next day or two. Adpete (talk) 23:47, 10 March 2011 (UTC)[reply]
Hi! I found this code example immensely useful since it puts in concrete terms (for me, a programmer) what you have to do *and* provided me with a working implementation, which I used. An example is worth a thousand words. However, I suspect it needs correcting in that it doesn't respect the stop bit setup time, with a minimum of 4us (I2C spec UM10204, table9 / figure 27, pp37-38, t(SU:STO)), but instead raises SDA immediately after raising SCL with no delay. Can someone confirm this? 94.165.237.104 (talk) 13:56, 22 September 2011 (UTC)[reply]
void i2c_stop_cond(void)
{
        /* set SDA to 0 */
        CLRSDA();
        I2CDELAY();
        /* Clock stretching */
        while (READSCL() == 0)
                ;  /* You should add timeout to this loop */
+        /* Stop bit setup time, minimum 4us */
+        I2CDELAY();
        /* SCL is high, set SDA from 0 to 1 */
        if (READSDA() == 0)
                ARBITRATION_LOST();
        I2CDELAY();
        started = false;
}
Sorry, forgot to log in... The same goes for the repeated start condition, which has a 4.7us setup time. Martinwguy (talk) 15:22, 22 September 2011 (UTC)[reply]
void i2c_start_cond(void)
{
       if (started) {
                /* set SDA to 1 */
                READSDA();
                I2CDELAY();
                /* Clock stretching */
                while (READSCL() == 0)
                        ;  /* You should add timeout to this loop */
+                /* Repeated start setup time, minimum 4.7us */
+                I2CDELAY();
        }
        ...

Fix applied Martinwguy (talk) 16:12, 9 December 2011 (UTC)[reply]

I found the example helpful but don't understand why the delay constant is declared as 100 then divided by 2 in use. Why not just define the delay as 50? — Preceding unsigned comment added by 82.31.157.246 (talk) 11:58, 26 October 2023 (UTC)[reply]

It should be definitely be deleted. An article describing I2C does not need to be a software repository. It's far too lengthy to be included and it badly disrupts the flow of the article. If it was 10 lines or less then just maybe - but not all this guff. There's a ton of I2C software readily available from searches (exact instances of which the article does not have to reference). I'm also a software programmer and it doesn't help the article at all by being here. Otherwise the same argument can be made for copying out the spec to detail the protocol. The article should describe the I2C protocol but it's not a substitute for the real specification, which is freely available. Propose deletion. ToaneeM (talk) 00:31, 17 December 2023 (UTC)[reply]

As it is now written in C, it should be deleted. Though if it could be written in under 10 or so lines of pseudo code, that would be nice. Em3rgent0rdr (talk) 04:15, 17 December 2023 (UTC)[reply]

Code example cleared up[edit]

I just made an edit to the code comments, to clarify what the macros do. That's because there is no SETSDA() or SETSCL() macros. The original coder assumed that the READSDA() and READSCL() macros could be used for this purpose, but did not clarify that for this to work, the macros must first set the pin to an input, to allow the signal to be pulled high by the external resistors.

I have made the simplest change to make this more clear, but a more clear change would be to add SET* macros, which are separate in purpose to the READ* macros.

As for the previous discussion about the usefulness of this code and whether it belongs on the page at all, I'd like to comment that it was useful me, and should stay..... I confirm the reading and writing of single bytes works. (Arbitration and restarts untested but look good.) — Preceding unsigned comment added by Gibster777 (talkcontribs) 09:27, 11 April 2011 (UTC)[reply]

The example code in article claims to be C, but is "pseudo" C because of the "bool" type. Someone seems actually to have changed a type from "unsigned" to "bool", and also added an "!= 0" test. And that probably makes the code easier to understand for more people. So that's good. But I will just change the "C" to "pseudo C". gnirre (talk) 21:45, 30 April 2011 (UTC)[reply]

I2C driver using bit bang http://www.embeddedrelated.com/showcode/334.php — Preceding unsigned comment added by 72.205.252.194 (talk) 19:07, 28 March 2015 (UTC)[reply]

Code example and line capacitance[edit]

I feel the READ macros should be detailed, otherwise readers may not understand that the pull-ups may require up to 320ns to act if there is a lot of capacitance on the SDA or SCL lines. I suggest:

bool READSCL(void)   /* Set SCL as input and return current level of line, 0 or 1 */
{
	Set_SCL_As_Input();
	Wait( 500ns );
	return Get_SCL_Input();
}

And likewise for READSDA(). Hoptroff (talk) 15:57, 20 July 2011 (UTC)[reply]

Hot-swapping[edit]

"Peripherals can also be added to or removed from the I²C bus while the system is running, which makes it ideal for applications that require hot swapping of components.[citation needed]"

This is implied by the fact that it is based on open-collector logic and the fact that you can't communicate with more than one device at a time... Why do so many "citations needed" come from people who seemingly didn't read the articles?!71.196.246.113 (talk) 10:10, 5 August 2011 (UTC)[reply]


so you're saying it's original research? must be removed per WP:NOR — Preceding unsigned comment added by 70.189.92.82 (talk) 18:51, 23 February 2018 (UTC)[reply]

Links[edit]

More links that describe the protocol:

Propose a NEW Resistor Section[edit]

It should be noted somewhere the default values for circuits - for example, the Rp is usually 4.7 kohms

They vary widely. I just checked one board I have; 2.2K for some, and 47K (! not 4.7K !) on another branch of the tree. Don't think we can give values like that; they're circuit dependent. See the relevant specs. 69.226.236.175 (talk) —Preceding undated comment added 23:10, 26 August 2009 (UTC).[reply]
I think we need to add a section to this article that talks about "Rp" pull-up resistors (or constant current source or ICs) and "Rs" series resistors. I have noticed lots of confusion in blogs about this subject matter, so I think it would benefit everyone to have a dedicated section about it. Please reply with your thoughts! • SbmeirowTalk • 22:13, 4 December 2013 (UTC)[reply]

External links modified[edit]

Hello fellow Wikipedians,

I have just added archive links to one external link on I²C. Please take a moment to review my edit. If necessary, add {{cbignore}} after the link to keep me from modifying it. Alternatively, you can add {{nobots|deny=InternetArchiveBot}} to keep me off the page altogether. I made the following changes:

When you have finished reviewing my changes, please set the checked parameter below to true to let others know.

This message was posted before February 2018. After February 2018, "External links modified" talk page sections are no longer generated or monitored by InternetArchiveBot. No special action is required regarding these talk page notices, other than regular verification using the archive tool instructions below. Editors have permission to delete these "External links modified" talk page sections if they want to de-clutter talk pages, but see the RfC before doing mass systematic removals. This message is updated dynamically through the template {{source check}} (last update: 18 January 2022).

  • If you have discovered URLs which were erroneously considered dead by the bot, you can report them with this tool.
  • If you found an error with any archives or the URLs themselves, you can fix them with this tool.

Cheers. —cyberbot IITalk to my owner:Online 18:57, 29 August 2015 (UTC)[reply]

I3C (Improved Inter-Integrated Circuits)[edit]

Could somebody please add this as successor for I²C. It is specified since Dec. 2016. -- 194.0.94.11 (talk) 07:04, 2 August 2017 (UTC)[reply]

Wow, it is based on top of the free I2C standard, yet they paywalled the I3C spec behind a $2000+ membership, like WTF? • SbmeirowTalk • 07:46, 2 August 2017 (UTC)[reply]
http://www.techdesignforums.com/practice/technique/i3c-specification-updates-i2c-interface-for-sensor-subsystems/
http://eecatalog.com/sensors/2017/07/05/after-35-years-of-i2c-i3c-improves-capability-and-performance/
https://www.mipi.org/specifications/i3c-sensor-specification
https://www.mipi.org/join-mipi

Controlling LCD Screens[edit]

Are we sure I2C is used for this purpose? It's not in my experience. The standard way is to use SPI, because I2C is too slow. The LCD screens typically come with a controller which does the really fast stuff and provides a frame memory, then commands to this chip are sent via the SPI protocol at about 50MHz, whereas an I2C usually runs at 100-400kHz.2.97.33.218 (talk) 16:43, 31 January 2018 (UTC)[reply]

It's used, because many screens are text-only and pretty slow. SPI is popular (as is 4 bit parallel) but if the machine is already using I2C, it's often easier to just make everything use I2C.
I've got some new custom boards here (front panels for CNC machines): 16×2 LCD display with a 44780 controller, a tiny chip doing I2C for it, and then six beefy great pushbuttons and they're on I2C too. It connects to any microcontroller with a couple of wires and saves me a whole bunch of plumbing. Andy Dingley (talk) 18:31, 31 January 2018 (UTC)[reply]

Applications - list is better[edit]

I see there is a note encouraging editors to "improve readability" by turning the list into prose. Actually, speaking as someone who just visited this page to learn about I2C, the list is more helpful. — Preceding unsigned comment added by 80.47.157.107 (talk) 11:15, 10 January 2021 (UTC)[reply]

"Physical layer" section - Signal diagrams would be helpful[edit]

There is a lot of dense description of the protocol which can quickly get confusing. Signal diagrams like the one at https://www.beyond-circuits.com/wordpress/wp-content/uploads/2015/04/tutorial18_i2s_timing.png would be helpful. I tried to make some but my understanding of I2C is too weak. Matt-bacon-bcm (talk) 00:06, 17 December 2023 (UTC)[reply]