<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>EmbLogic &#187; Kopal</title>
	<atom:link href="https://www.emblogic.com/blog/author/kopal-e1/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.emblogic.com/blog</link>
	<description>Embedded System and ARM Training</description>
	<lastBuildDate>Tue, 03 Mar 2020 13:00:06 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.9.1</generator>
	<item>
		<title>I2c protocol</title>
		<link>https://www.emblogic.com/blog/02/i2c-protocol/</link>
		<comments>https://www.emblogic.com/blog/02/i2c-protocol/#comments</comments>
		<pubDate>Tue, 15 Feb 2011 17:38:46 +0000</pubDate>
		<dc:creator><![CDATA[Kopal]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://emblogic.org/blog/?p=484</guid>
		<description><![CDATA[One of the most common communication buses in the world, and hence one that should be well understood by prospective engineers, is the I2C bus.  It may not be as well known as USB or Ethernet, but much of the world &#8230; <a href="https://www.emblogic.com/blog/02/i2c-protocol/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>One of the most common communication buses in the world, and hence one  that should be well understood by prospective engineers, is the I2C  bus.  It may not be as well known as USB or Ethernet, but much of the world of electronic devices is completely dependent on it.</p>
<p><strong>I²C</strong> (<strong>Inter-Integrated Circuit</strong>) is a <strong>multi-master serial single-ended computer bus</strong> invented by Philips that is used to attach low-speed peripherals to a motherboard, embedded system etc.</p>
<p>The I2C bus physically consists of 2 active wires and a ground  connection. The active wires, called <strong>SDA and SCL</strong>, are both <strong> bi-directional</strong>.</p>
<p><strong>SDA &#8212; Serial DAta line </strong></p>
<p><strong>SCL &#8211;  Serial CLock  line</strong>.</p>
<p>Every device hooked up to the bus has its own unique address, no matter  whether it is an MCU, LCD driver, memory. Each of these chips  can act as a receiver and/or transmitter, depending on the  functionality.</p>
<p><strong>MASTER &amp; SLAVE</strong></p>
<p>The I2C bus is a multi-master bus. This means that more than one IC  capable of initiating a data transfer can be connected to it. The I2C  protocol specification states that the IC that initiates a data transfer  on the bus is considered the Bus Master. Consequently, at that time,  all the other ICs are regarded to be Bus Slaves.</p>
<p>.</p>
<p><img src="http://www.esacademy.com/assets/images/g01proto.gif" alt="I2C Bus" width="600" height="120" /></p>
<p>Lets consider the following setup and assume the MCU wants to send data to one of its slaves</p>
<p>First, the MCU will issue a   <strong>START </strong>condition. This acts as an &#8216;Attention&#8217; signal to all of the connected  devices. All ICs on the bus will listen to the bus for incoming data.</p>
<p>Then the MCU sends the <strong>ADDRESS</strong> of the device it wants to access, along with an indication whether the  access is a Read or Write operation (Write in our example). Having  received the address, all IC&#8217;s will compare it with their own address.  If it doesn&#8217;t match, they simply wait until the bus is released by the  stop condition. If the address matches, however, the chip  will produce a response called the <strong>ACKNOWLEDGEMENT</strong> signal.</p>
<p>Once  the MCU receives the acknowledge, it can start transmitting or  receiving DATA. In our case, the MCU will transmit data. When all is  done, the MCU will issue the <strong>STOP </strong>condition. This is a signal that the bus has been released and that the  connected ICs may expect another transmission to start any moment.</p>
<p><strong>TRANSMITTING A BYTE TO A SLAVE DEVICE</strong></p>
<p>Once the start condition has been sent, a byte can be transmitted by the MASTER to the SLAVE.<br />
This  first byte after a start condition will identify the slave on the bus  (address) and will select the mode of operation. The meaning of all  following bytes depends on the slave.</p>
<p><img src="http://www.esacademy.com/assets/images/g01sendb.gif" alt="Waveform sending byte" width="600" height="120" /></p>
<p>An IDLE bus condition is defined as having both SDA and SCL high. A &#8216;START&#8221; condition is generated by the Master,  followed by 7 bits of address, then a ReadWrite bit.  If a slave device  detects an address match, it will send an ACK by driving SDA low during  the next clock cycle; if no slave recognizes the address then the SDA  line will be left alone to be pulled up high.  Following a successful  ACK, data will be either sent to the slave device or read from the slave  device (depending on what was indicated by the Read/Write bit).   Therefore, each byte is 9 bits: either 7 address plus one R/W plus one  ACK/NAK, or 8 data plus one ACK/NAK.  The last data byte of a  transaction should generally be followed by a NAK, to indicate that it  is intended to be the final byte.  After this, either a STOP or a  ReSTART should be issued by the Master. <strong></strong></p>
<p>Sample bitstream of the I2C protocol.  <img src="http://www.totalphase.com/image/docs/aardvark_datasheet/i2c-02.png" alt="\includegraphics[clip=true]{i2c-02}" width="529" height="96" /></p>
<p><img src="///tmp/moz-screenshot-2.png" alt="" /></p>
<p><img src="///tmp/moz-screenshot-3.png" alt="" /></p>
<p><img src="///tmp/moz-screenshot-1.png" alt="" /></p>
<p><img src="///tmp/moz-screenshot.png" alt="" /></p>
]]></content:encoded>
			<wfw:commentRss>https://www.emblogic.com/blog/02/i2c-protocol/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
