


























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
its for cmp3006 and 3010 some of the university notes it will be help
Typology: Lecture notes
1 / 34
This page cannot be seen from the preview
Don't miss anything!
I2C …
Master Transmit CLK ( transmitter or receiver)
Receiver does not change the level of SDA unless it wants to generate ACK
Note: Receiver can be Master or Slave
Bit Format
Each data bit transferred on the SDA line is synchronized by a high-to-low pulse
of clock on the SCL line.
Data line can change only when the clock line is low. Stop and Start conditions
are exceptions.
Repeated Start
If a master,which has the control of the bus, wishes to initiate a new transfer
and does not want to release the bus before starting the new transfer, it issues a
new START condition between a pair of START and STOP conditions.
Typical data transmission
Packet Format
Packet Types:
Address Packet
Data Packet
Address packet
Started by a Start Condition
7 bits address, MSB first
Define R/W
ACK or NACK
Clock Stretching
If an addressed slave device is not ready to process more data, it will stretch
the clock by holding the clock line (SCL) low after receiving (or sending) a bit of
data.
Arbitration
it is possible that two or more masters initiate a transmission at about the
same time
Each transmitter has to check the level of the bus and compare it with the level it expects
if it doesn't match, that transmitter has lost the arbitration, and will switch to slave mode
I
C unit in AVR
Bus Interface Unit
detects and generates START, REPEATED START and STOP conditions.
detects arbitration
controls sending or receiving ACK transfers packets of data or address.
Bit Rate Generation Unit
controls the frequency of the system clock (SCL) when operating in a master mode
I
C unit in AVR
Address Match Unit
Compares the received address byte with the 7-bit address in TWI address register and
informs the control unit upon an address match.
Control Unit
controls the TWI module and generates responses according to settings in the TWI control
register
sets the contents of the status register
according to current state.
TWAR (TWI Address Register)
TWA6-0 (TWI slave Address)
TWGCE (TWI General Call Recognition Enable bit)
◦ 1: Answer to general call
TWI Control Register
TWINT (TWI Interrupt Flag)
TWEA (TWI Enable Acknowledge Bit)
1:ACK, 0:NACK
TWSTA (TWI Start condition bit)
TWSTO (TWI Stop condition bit)
TWWC (TWI Write Collision flag)
TWEN (TWI Enable bit)
TWIEN (TWI Interrupt Enable)