Eugeneho Serialcomm
Eugeneho Serialcomm
December 4, 2002
Presented by Eugene Ho
Introduction
Serial Interfaces, part two
2
What is I2C?
Serial Interfaces, part two
3
I2C Bus Configuration
Serial Interfaces, part two
• 2-wire serial bus – Serial data (SDA) and Serial clock (SCL)
• Half-duplex, synchronous, multi-master bus
• No chip select or arbitration logic required
• Lines pulled high via resistors, pulled down via open-drain drivers
(wired-AND)
4
I2C Protocol
Serial Interfaces, part two
1. Master sends start condition (S) and controls the clock signal
2. Master sends a unique 7-bit slave device address
3. Master sends read/write bit (R/W) – 0 - slave receive, 1 - slave transmit
4. Receiver sends acknowledge bit (ACK)
5. Transmitter (slave or master) transmits 1 byte of data
5
I2C Protocol (cont.)
Serial Interfaces, part two
6
I2C Signals
Serial Interfaces, part two
• Start – high-to-low transition of the SDA line while SCL line is high
• Stop – low-to-high transition of the SDA line while SCL line is high
• Ack – receiver pulls SDA low while transmitter allows it to float high
• Data – transition takes place while SCL is slow, valid while SCL is high
7
I2C Features
Serial Interfaces, part two
8
AVR Support for I2C
Serial Interfaces, part two
9
I2C Tradeoffs
Serial Interfaces, part two
Advantages:
• Good for communication with on-board devices that are accessed
occasionally.
• Easy to link multiple devices because of addressing scheme
• Cost and complexity do not scale up with the number of devices
Disadvantages:
• The complexity of supporting software components can be higher
than that of competing schemes ( for example, SPI ).
10
What is SPI?
Serial Interfaces, part two
Applications:
• Like I2C, used in EEPROM, Flash, and real time clocks
• Better suited for “data streams”, i.e. ADC converters
• Full duplex capability, i.e. communication between a codec and
digital signal processor
11
SPI Bus Configuration
Serial Interfaces, part two
12
SPI vs. I2C
Serial Interfaces, part two
13
SPI Protocol
Serial Interfaces, part two
14
SPI Protocol (cont.)
Serial Interfaces, part two
• SPI interface defines only the communication lines and the clock
edge
• There is no specified flow control! No acknowledgement mechanism
to confirm receipt of data
15
AVR Support for SPI
Serial Interfaces, part two
16
Summary
Serial Interfaces, part two
17
References
Serial Interfaces, part two
I2C:
• http://www-us2.semiconductors.philips.com/acrobat/various/
I2C_BUS_SPECIFICATION_1995.pdf
• http://www.esacademy.com/faq/i2c/index.htm
• http://www.embedded.com/story/OEG20020528S0057
SPI:
• MC68HC11 manual
• http://www.mct.net/faq/spi.html
• http://links.epanorama.net/links/serialbus.html
• http://www.embedded.com/story/OEG20020124S0116
18