8 Serial Interfaces 3 Flashcards
History I2C?
- Philips Semiconductor is now NXP, who used to hold a patent on the protocol, but this has now expired
- Originally used by Philips inside television sets but is now a very common peripheral bus standard
I2C overview?
- I2C is a two wire serial bus that was invented by Philips Semiconductor in the early 1980s
- Intended for use in embedded systems
- I 2C is a multi-master multi-slave interface designed for connecting integrated circuits together
- The original specification was fixed to operate at 100 kHz, the most recent version supports clock rates of up to ~5 MHz
- Inspired I2S (inter-integrated sound)
Main difference I2C?
there are strict conditions
Common I2C layout?
I2C connections
• I²C uses only two bidirectional open-drain lines, Serial Data Line (SDA) and Serial Clock Line (SCL), pulled up with resistors (don’t forget these!)
I2C typical voltages?
Typical voltages used are + 5 V or + 3.3 V although systems with other voltages are permitted
I2C chip select lines?
There are no chip select lines, instead, I²C devices have a 7-bit or a 10-bit address, each device is required to have a unique address
Data Transmission I2C?
- Each device has an open drain output and so lines can be pulled low by any device, and are high when all devices release them. Multiple devices pulling the lines low do not cause internal short circuits
- Data is clocked synchronously to SCL, with the clock being generated by the master device
- It is possible to have multiple masters, but arbitration must be used to ensure correct communication. The arbitration is normally as simple and checking both SDA and SCL have been high for some time before transmitting
How is the basic flow of communication controlled by the master?
Starts the communication
Signals the slave address, including a read/write bit
Looks for an acknowledgement
Reads/write data until done, then stops
Diagram I2C communication?
How to write I2C?
- All Devices: Allow SDA & SCL to float high
- Master: Pull SDA low to signal start
- Master: Drive clock on SCL, and 7 bit address followed by 0 (W) on SDA
- Slave: Pull SDA low to signify ACKnowledge
- Master: Clock out 8 data bits on SDA
- Slave: ACK
- All: Allow SDA to float high when SCL is high (stop)
How to read I2C?
- Master: Address followed by 1 (R) on SDA
- Slave: Clock out 8 data bits on SDA
- Master: ACK
What is clock stretching?
- Clock stretching is a tool used to temporarily slow down the data transfer if the slave device is not ready to receive/transmit more data
- Commonly seen on very high speed data converters where sometimes data just isn’t ready for transmission yet
Advantages of I2C?
- Multi-master and multi-slave are supported
- Individual chip addressing, up to 127 slave devices using only two wires!
- Very low pin count compared to parallel or SPI
- Fairly simple, although more complex than SPI
- Uses ACK to confirm that the devices have correctly understood each other
- Clear, fixed specification so generally easier to implement
- Possible to perform verification against the specification
- Supports hot swapping (you can connect new devices with the bus running)
Disadvantages of I2C?
- Signals are bidirectional, more difficult to achieve Galvanic isolation
- Each slave device must have a unique address, in practice this means you can’t have more than a handful of the same device
- If two devices have the same address then bus conflicts can occur
- Due to the open-drain design, the maximum clock frequency can be lower than SPI
- Only handles short distances
- Only one device can ever be driving the bus at once (so if you have lots of devices you have to talk to them one at a time)
- Full compliance to the specification sometimes involves paying NXP a license fee