Why i2c bus is used




















I had the same issue. Your email address will not be published. Save my name, email, and website in this browser for the next time I comment.

Notify me of follow-up comments by email. Notify me of new posts by email. I agree to these terms. Related Posts. Great series of posts. Thanks for sharing this! Thanks for this,u are a genius,i need simple circuit for invater and power Bank circuit Reply. Dani on February 22, at am. Thank you for taking the time to explain it so well Reply. Sachin Gupta on February 24, at am. Thanks very nice information.

I liked all your articles and the way you explained all. Please add for PCIe communication as well. Manuel Antonio Nava on March 30, at pm. Simple and easy to understand. I suggest some example to put in practice Reply. Phil Howard on July 3, at am. Mitek on July 4, at am. Nigel on July 5, at am. Great post. Thank you very much!! RAVI on November 22, at pm.

Please share CAN article also Reply. Bri on August 19, at pm. ArchonOSX on December 18, at pm. Circuit Basics on March 24, at am. Otherwise good articles and helpful explanations. Thanks for the work. Hello World on February 2, at pm. Where is information about clock stretching? Very useful feature Reply. Good article on I2C. M Tilak on June 5, at pm.

Really helpful Reply. Debabrata Ghosh on July 20, at pm. DtcInstall Reply. Brian on September 23, at am. Johnny on January 23, at am. Step5: Then, the master can transmit 8-bit of data to the receiver which replies with a 1-bit acknowledgement.

Transmitting and receiving the information step by step serially with respect to the clock pulses is called I2C protocol. It is an inter-system and short-distance protocol, which means, it is used within the circuit board to communicate the master and slave devices.

By using these ADCs, we can interface the analog sensors to the microcontroller. To overcome this problem, the protocol concept comes into the picture for reducing the hardware complexity and power consumption. Terminology Used in I2C Protocols. Transmitter: The device that sends data to the bus is called transmitter. Receiver: The device that receives data from the bus is called a receiver.

Master: The device that initiates transfers to generate a clock signals and terminate a transfer is called a master. Slave: The device addressed by a master is called a slave. Multimaster: More than one master can attempt to control the bus at the same time without corrupting the message is called a Multimaster. Arbitration: Procedure to ensure that, if more than one master simultaneously tries to control the bus — only one is allowed to do so; the winning message is not corrupted.

Synchronization: Procedure to synchronize the clock singles of two or more devices is called synchronization. When the master microcontroller wishes to talk to a slave device for example ADC , it begins communication by issuing a start condition on the I2C bus, and then issues a stop condition. This was later increased to kHz as Fast mode.

There is also a High speed mode which can go up to 3. There are also I2C level shifters which can be used to connect to two I2C buses with different voltages.

Basic I2C communication is using transfers of 8 bits or bytes. Each I2C slave device has a 7-bit address that needs to be unique on the bus. Some devices have fixed I2C address while others have few address lines which determine lower bits of the I2C address. This makes it very easy to have all I2C devices on the bus with unique I2C address. There are also devices which have bit address as allowed by the specification.

After the transmission of the address byte, the master releases the data lines to put the data line SDA in a high impedance state, which allows the receiver to give the acknowledgment bit. If this transmitted address is matched with any receiver then it pulls down the SDA lines low for the acknowledgment and after the acknowledgment, it releases the data lines. The master generates a clock pulse to read this acknowledgment bit and continue the read or write operation.

If this transmitted address is not matched with any receiver then nobody is pull down the data lines low, master understands it is a NACK and in that situation, the master asserts a stop bit or repeated start bit for further communication. After getting the ACK bit master send the address of the register, where it wishes to write, the slave will acknowledge again, letting the master know it is ready for the write operation.

After getting this acknowledgment, the master will start sending the data to the slave. Master will get the acknowledgment of each transmitted byte. If the master does not get the acknowledgment from the slave then the master asserts a stop condition to stop the communication or either assert the repeated start to establish a new communication.

There or another option to stop the communication when the master has sent all the data then the master is terminated the transmission with a STOP condition.

I2C read operation same as the I2C write operation, In which the master asserts the start condition before the read operation. After getting ACK bit, the master releases the data bus but continues sending the clock pulse, in that situation master becomes the receiver and the slave becomes the slave transmitter. In the read operation, the master gives the acknowledgment to the slave on receiving every byte to let the slave know that it is ready for more data.

Once the master has received the number of bytes which it is expecting, it will send a NACK bit to release the bus and assert the stop bit to halt the communication. There is some special scenario in the I2C protocol, here I am explaining these special scenarios one by one.

Unlike Rs, I2C is synchronous communication, in which a clock is always generated by the master and this clock is shared by both master and slave. In the case of multi-master, all master generate their own SCL clock, hence the clock of all masters must be synchronized.

In the I2C, this clock synchronization is done by wired and logic. In that situation, both masters generate their own clock signal, master M1 generates clk1 and master M2 generates clk2, and the clock observed on the bus is SCL. Arbitration is required in the case of a multi-master, where more than one master is tried to communicate with a slave simultaneously.

For Example, Suppose two masters in the I2C bus try to communicate with a slave simultaneously and assert a start condition on the bus. In the above case, everything will be good till the state of the SDA line will the same as what is the masters driving on the bus.

If any master sees that the state of the SDA line differs, what is it driving, then they will exit from the communication and lose their arbitration. Note: Master who is losing their arbitration will wait till the bus become free. Communication in the I2C bus can be paused by the clock stretching to holding the SCL line low and it cannot continue until the SCL line released high again. In I2C, the slave able to receive the data at a fast rate but sometimes the slave takes more time in the processing of received data.

In that situation, slave pulls the SCL line low to pause the communication and after the processing of the received bytes, it again released the SCL line high to resume the communication. The clock stretching is how slave drive the SCL line but it is the fact, most of the slave does not drive the SCL line. Note: In the I2c communication protocol, most of the I2C slave devices do not use the clock stretching feature, but every master should support the clock stretching.

There is a lot of advantage of I2C protocol which makes the user helpless to use the I2C protocol in many applications. I2c is an easy and cheap communication protocol, It can be multi-master or multi-slave. Some disadvantage also attaches with I2C, it is a half-duplex communication and slow as compared to SPI serial peripheral communication.

Is there something like a repeater for I2C? There is one more article on I2C.



0コメント

  • 1000 / 1000