Professional Documents
Culture Documents
INDEX
CONTENTS
PAGE NO
1. ABSTRACT
2. INTRODUCTION
2.2 HARDWARE
5.2 CONFIGURATION
5.3DATA VALIDITY
11
12
5.5CONTROL SIGNALS
13
5.6DATA TRANSFERS
13
5.7 ACKNOWLEDGMENT
14
5.8ARBITRATION
15
5.9DATA FORMATS
16
17
20
22
6.1REGISTER DESCRIPTION
22
6.2 IMPLEMENTATION
23
6.3 RESULTS
23
7.
PAGENO
24
25
26
26
28
9. APPLICATION
29
9.1 TV RECEPTION
30
31
10. CONCLUSION
32
11. REFERENCES
32
INTRODUCTION:The I2C-bus is a de facto world standard that is now implemented in over 1000 different ICs
manufactured by more than 50 companies. Additionally, the versatile I2C-bus is used in
various control architectures such as System Management Bus (Sambas), Power Management
Bus (PMBus), Intelligent Platform Management Interface (IPMI), Display Data Channel
(DDC) and Advanced Telecom Computing Architecture (ATCA).
What isi2c ?
IC (Inter-Integrated circuit), pronounced I-squared-C, is a multimaster, multi slave, singleended, serial computer bus invented by Philip semiconductors in 1982 or known today
as NXP Semiconductors, used for attaching low-speed peripherals to computer to
communication
between
integrated
circuits
(ICs)
systems.Applications
from
that
use
different
the
manufacturers.
I2Cbus
include
microcontrollers, LCD, memory, keyboards, PCs, cell phones, car radios, TVs, and blade
servers. The I2C bus uses two bidirectional signals, one as the serial clock (SCL) line and one
as the serial data (SDA) line. Each device connected to the bus has a unique address used to
identify the device in communication. The protocol is comprised of a set of conditions to
establish or terminate communication, a designation to read or write, and the ability to
address devices with an expanded address scheme. A simple master/slave relationship is
present on the bus continuously, and any device on the line can act as the master or slave.
I2C has a data transfer rate of 400Kbits/s at a maximum length of 2 meters. It is possible to
get a transfer rate of 3.4 Mbits/s at 0.5 meters on the high speed I 2C bus, and by using signal
buffers, one can go up to 100 meters on the I2C bus.
Devices connected to the I2C-bus system can operate as Masters and Slaves. The Master
device controls bus communications by initiating/terminating transfers, sending information
and generating the I2C system clock. On the other hand, the Slave device waits to be
Addressed by the controlling Master. Upon being addressed, the Slave performs the specific
function requested. An example of this configuration is a Master Controller sending display
data to a LED Slave Receiver that would then output the requested display.
I2c Hardware:
I2C Hardware Characteristics Both SCL (Serial Clock) and SDA (Serial Data) are bi
directional lines that are connected to a positive supply Voltage via pull-up resistors. It
displays a typical lI2C-bus configuration. Devices connected to the bus require open-drain or
open-collector output stage interfaces. As a result of these interfaces, the resistors pull both
lines HIGH when the bus is free.
(.source :http://www.ermicro.com/blod)
Data is transmitted to, and received from, the I2C bus via a buffered interface. Control and
status information is relayed through a set of memory-mapped registers. (For a complete list
of I2C bus features, capabilities, and operation details, see the I2C-Bus Specification.)[5]
The I2C module can operate in any of the following I2C systems:
As a slave device
As a master device in a single master system (slave may also be active)
As a master/slave device in a multi-master system (bus collision detection and arbitration [3]
The official I2C bus protocol supports three modes of transfer
rates:
Standard Mode Up to 100 Kbps
Fast Mode Up to 400 Kbps
High-Speed Mode Up to 3.4 Mbps[5]
Key features of the I2C module include the following:
Independent master and slave logic
Multi-master support, which prevents message losses in arbitration
Detects 7-bit and 10-bit device addresses with configurable address masking in Slave
mode
Detects general call addresses as defined in the I2C protocol
Automatic SCL x clock stretching provides delays for the processor to respond to a slave
data request
Supports 100 kHz and 400 kHz bus specifications .Some intelligent control, usually a single-chip
microcontroller
General-purpose circuits like LCD and LED drivers, remote I/O ports, RAM,EEPROM, real-time
clocks or A/D and D/A converter
Application-oriented circuits such as digital tuning and signal processing circuits .[5]
I2bus Protocol :
Standard-mode, Fast-mode and Fast-mode Plus I2C-bus protocols:
Two wires, serial data (SDA) and serial clock (SCL), carry information between the Devices
connected to the bus. Each device is recognized by a unique address (whether It is a
microcontroller, LCD driver, memory or keyboard interface) and can operate as Either a
transmitter or receiver, depending on the function of the device. An LCD driver May be only
a receiver, whereas a memory can both receive and transmit data. In addition to transmitters
and receivers, devices can also be considered as masters or slaves when Performing data
transfers. A master is the device which initiates a data transfer on the bus and generates the
clock signals to permit that transfer. At that time, any device addressed is considered a slave.
[8]
I2C Bus Terminology
Transmitter - the device that sends data to the bus. A transmitter can either be a device that
puts data on the bus of its own accord (a master-transmitter), or in response to a request
from data from another devices (a slave-transmitter).
Receiver - the device that receives data from the bus.
Master - the component that initializes a transfer, generates the clock signal, and terminates
the transfer. A master can be either a transmitter or a receiver.
Slave - the device addressed by the master. A slave can be either receiver or transmitter.
Multi-master - the ability for more than one master to co-exist on the bus at the same time
without collision or data loss.
Arbitration - the prearranged procedure that authorizes only one master at a time to take
control of the bus.
Synchronization - the prearranged procedure that synchronizes the clock signals provided by
two or more masters.
SDA - data signal line (Serial DATA)
SCL - clock signal line (Serial CLOCK) [8]
Electronics and Communication EngineeringPage 8
(.source file:http://www.ermicro.com/blod)
This example highlights the master-slave and receiver-transmitter relationships found on the
I2C-bus. Note that these relationships are not permanent, but only depend on the direction of
data transfer at that time.
The transfer of data would proceed as follows:
1. Suppose microcontroller A wants to send information to microcontroller B:
microcontroller A (master), addresses microcontroller B (slave)
microcontroller A (master-transmitter), sends data to microcontroller B
(slave-receiver)
microcontroller A terminates the transfer.
2. If microcontroller A wants to receive information from microcontroller B:
microcontroller A (master) addresses microcontroller B (slave)
microcontroller A (master-receiver) receives data from microcontroller B
(slave-transmitter)
microcontroller A terminates the transfer.
Data validity:
The bit transfer protocol that must be maintained on the I2C-bus. The data on the SDA line
must be stable during the HIGH period of the SCL clock. The HIGH or LOW state of SDA
cans only change when the clock signal on the SCL is LOW. In addition, these bus lines must
meet required setup, hold and rise/fall times prescribed in the timing section of the I2C
protocol specifications always affects the Master, Transmitter and Receiver.Master every byte
transfer, the Master must generate an acknowledge related clock pulse. this clock pulse is
indicated as the 9th bit and labeled ``ACK''.Following the 8th data bit transmission, the active
Transmitter must immediately release the SDA line enabling it to float HIGH. To receive
another data byte, the Receiver must verify successful receipt of the previous byte by
generating an acknowledgment.
SDA
SCL
Change of
data allowed
START:
STOP: A LOW to HIGH transition on the SDA line while SCL is HIGH
The master always generates START and STOP conditions. The bus is considered to be busy
after the START condition. The bus is considered to be free again a certain time after the
STOP condition. The bus stays busy if a repeated START (Sr) is generated instead of a STOP
condition. In this respect, the START (S) and repeated START (Sr) conditions are
functionally identical. The S symbol will be used as a generic term to represent both the
START and repeated START conditions, unless Sr is particularly relevant.
Electronics and Communication EngineeringPage 12
11 of 40
SDA
SDA
SCL
SCL
Start Condition
Stop Condition
(Source:F. Leens, An Introduction to I2C and SPI Protocols, IEEE Instrumentation &
Measurement[8])
Control Signals
START and STOP conditions are used to signal the beginning and end of data
communications. A Master generates a START condition (S) to obtain control of afree I2Cbus by forcing a HIGH to LOW transition on the SDA line while maintaining SCL in its
HIGH
state.
This
condition
is
generated
during
software
emulation
in
the
Data Transfers
The Slave address and data being transferred across the bus must conform to specific byte
formats. The only byte transmission requirement is that data must be transferred with its Most
Significant Bit (MSB) first. However, the number of bytes that can be transmitted per transfer
is unrestricted. For both Master Transmit/Receive, the MASTER_CONTROLLER subroutine
described in a later section performs these functions. From Figure 4, it can be seen that the
Slave address is one byte made up of a unique 7-bit address followed by a Read or Write data
direction indicator bit. The Least Significant Bit (LSB) data direction indicator always
determines the direction of the message and type of transfer being requested by the Master_
either Slave Receive or Slave Transmit. If the Master requests the Slave Receive
functionality, the LSB of the addressed Slave would be set to ``0'' for Write. Therefore, them
aster would Transmit or Write information to the selected Slave. On the other hand, if the
Master was requesting the Slave Transmit functionality, the LSB would be set to ``1'' for
Read. As a result, the Master would Receive or Read information from the Slave.
SEND_DATA and RECV_DATA subroutines described later send and receive data bytes
across the bus. [8]
Address Recognition
When an address is sent from the controlling Master, each device in a system compares the
first 7 bits after the START condition with its predefined unique Slave address. If they match,
the device considers itself addressed by the Master as either a Slave-Receiver or SlaveTransmitter, depending upon the data direction indicator. Due to the bus's serial
configuration, only one device at a time may be addressed and communicated with at any
given moment.[8]
Arbitration
Multiple masters can synchronize their clocks, for example during arbitration. When bus
capacitance affects the bus rise or fall times the master will also adjust its timing in a similar
way If there are two masters on the same bus, there are arbitration procedures applied if both
try to take control of the bus at the same time. When two chips try to start communication at
the same time they may even generate a few cycles of the clock and data that match, but
eventually one will output a low when the other tries for a high. The low wins, so the
loser device withdraws and waits until the bus is freed again. Once a master (e.g.,
microcontroller) has control, no other master can take control until the first master sends a
stop condition and places the bus in an idle state.[8]
Electronics and Communication EngineeringPage 15
Data Formats
Any I2C device can be attached to the common I 2C bus and they talk with each other,
passing information back and forth. Each device has a unique 7-bit or 10-bit I 2C address. For
7-bit devices, typically the first four bits are fixed, the next three bits are set by hardware
address pins (A0, A1, and A2) that allow the user to modify the I 2C address allowing up to
eight of the same devices to operate on the I2C bus. These pins are held high to VCC,
sometimes through a resistor, or held low to GND.
Each node has a unique 7 (or 10) bit address
Peripherals often have fixed and programmable address portions
Addresses starting with 0000 or 1111 have special functions:
Figure(2)
START byte:
Microcontrollers can be connected to the I2C-bus in two ways. A microcontroller with an
on-chip hardware I2C-bus interface can be programmed to be only interrupted by requests
from the bus. When the device does not have such an interface, it must constantly monitor
the bus via software. Obviously, the more times the microcontroller monitors, or polls the
bus, the less time it can spend carrying out its intended function.[8]
Bus clear
In the unlikely event where the clock (SCL) is stuck LOW, the preferential procedure is to
reset the bus using the HW reset signal if your I2C devices have HW reset inputs. If the
I2C devices do not have HW reset inputs, cycle power to the devices to activate the
mandatory internal Power-On Reset (POR) circuit.
If the data line (SDA) is stuck LOW, the master should send nine clock pulses. The device
that held the bus LOW should release it sometime within those nine clocks. If not, then
use the HW reset or cycle power to clear the bus[8].
Processor is involved in every bus event when the interface is not Idle
Bit Banged
The official I2C bus protocol supports three modes of transfer rates:
Standard Mode Up to 100 Kbps
Fast Mode Up to 400 Kbps
High-Speed Mode Up to 3.4 Mbps
Electrical connections of I2C-bus devices to the bus lines:
Pull-up resistor sizing
The bus capacitance is the total capacitance of wire, connections and pins. This capacitance
limits the maximum value of Rp due to the specified rise time.
Shows Rp(max) as a function of bus capacitance.
Consider the VDD related input threshold of VIH = 0.7VDD and VIL = 0.3VDD for the
purposes of RC time constant calculation. Then V(t) = VDD (1 et / RC), where t is the
time since the charging started and RC is the time constant.
V(t1) = 0.3 VDD = VDD (1 et1 / RC); then t1 = 0.3566749 RC
V(t2) = 0.7 VDD = VDD (1 et2 / RC); then t2 = 1.2039729 RC
T = t2 t1 = 0.8473 RC
shows maximum Rp as a function of bus capacitance for Standard-, Fast- and Fast-mode
Plus. For each mode, the Rp(max) is a function of the rise time maximum (tr) and the
estimated bus capacitance (Cb)[1]
Rp(max)=Tr/0.8653*Cb
(Source: F. Leens, An Introduction to I2C and SPI Protocols, IEEE Instrumentation &
Measurement Magazine [8)]
Input leakage
The maximum HIGH level input current of each input/output connection has a specified
maximum value of 10 A. Due to the required noise margin of 0.2VDD for the HIGH level,
this input current limits the maximum value of Rp. This limit depends on VDD.[1]
II Register Description
There are 6 control registers and a data register. Each control register corresponds to SPI
control register. The first register corresponds to SPI status register. Second set of 8 bits are
dedicated for write operations which also includes interrupt signals for write and read
operation Third set of 8 bits are dedicated to read operations only 2 bits of this registers are
used as bus busy and abort read signals and rest of the bits are tied to 0.Fourth and fifth set
of 8 bits corresponds to 1st control register and 2nd control register of SPI respectively.
Finally sixth set of 8 bits corresponds to baud rate register of SPI.[6]
IV Results
The following Fig.is the simulation results of I2C master controller.
This result shows successful storage of data transmitted by the master on the mentioned
address location.[6]
DELAY_4_CYCLES
..
DELAY_8_CYCLES
RELEASE_S_CLHIGH
Functions
Delay loop for X seconds
where X e time
per cycle * 3
Delay loop for X seconds
where X e time
per cycle * 4
.
Delay loop for X seconds
where X e time
per cycle * 8
Releases the SCL line HIGH and waits for
any clock stretching requests
from peripheral devices
Subroutine Names
MASTER_CONTROLLER
SEND_DATA
SEND_BYTE
SEND_MSG
RECV_DATA
RECV_BYTE
RECV_MSG
TRANSFER
SEND_STOP
FUNCTIONS
Sends an I2C start
condition and Slave Address
during both a
Master Transmit and
Receive
Sends multiple data
bytes during a Master
Transmit
sends one data byte line
during a Master Transmit
Sends a message across
the I2C bus using a predefined
format
Receives multiple data
bytes from an addressed
Slave during a Master receive
Receive one data byte
during a Master Receive
Receives a message
from the I2C bus using
a predefined format
Copies EPROM programmed
data into Register
RAM
Send an I2C STOP condition
during both a
Master Transmit/Receive
[3]
Crystal speed
I2C Bus
Maximum
Performance
8751BH
12 MHZ
66.7 KHZ
87C51 (FX-Core
24 MHZ
80.0 KHZ
EXAMPLES:
Tv reception
The frequency range of most of the newer I2C devices is up to 400 kHz and we are moving to
3.4 MHz for future devices where typical uses would be in consumer electronics where a
DSP is the master and the designer wants to rapidly send out the I 2C information and then
move on to other processing needs. I2C devices are designed in the process that allows best
electrical and ESD performance and are manufacture of The SAA56xx family of
microcontrollers are a derivative of the Philips industry-standard 80C51 microcontroller and
are intended for use as the central control mechanism in a television receiver.[10]
source: file:http//www.springer.com
source:G:\ashok\url.htm
Conclusion
serial communication system, you have the option of using the Intel MCS-51 ProductThe
design of i2c master controller has immense applications in future as the number of devices
connected to a system is only going to increase. So there is always a need for a system which
supports multiple protocols. In all these situations, I2C master controller acts as a great
support and will be a key in future design to support multiple parallel functions. I2C master
controller is successfully designed in VHDL and simulated in Model SIM. Simulation results
verify that the communication has been established between the microprocessor and the
controller. Data processed and the output has been successfully verified as per SPI slave
input. The design meets timing constraints and there are no timing violations. And all these
have been achieved with minimal utilization of resources. Intel MCS-51 microcontroller scan
be successfully interfaced to an I2C-bus system as a Master controller. The interface
communicates by ASM51 software emulation modules that have been tested on a wide array
of I2C devices ranging from serial RAMS, Displays and a DTMF generators.
REFERENCES
[1] I2CBITS.ASM, G. Goodhue, Philips Semiconductors, August 1992
[2] The I2C-Bus and How to Use It (Including Specification), Philips Semiconductors,
January 1992.
[3] I2C Peripherals for Microcontrollers, Philips Semiconductors,1992 Data Handbook.
[4] OM1016 I2C Evaluation Board, E. Rodgers and G. Moss, Philips Components
Applications Lab Auckland, New Zealand.
[5] Programming the I2C Interface, Mitchell Kahn, SeniorEngineer, Intel Corporation.
[6] A.K. Oudjida, M.L. Berrandjia, R. Tiar, A.Liacha, K. Tahraoui, FPGA Implementation of
I2c & SPI Protocols: A Comparative Study Electronics, Circuits, and Systems, 2009. ICECS
2009