I2c Bus

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Unit-7

I2C BUS:
The name I2C is shorthand for Standard Inter-Integrated Circuit bus
I2C is a serial data protocol which operates with a master/slave relationship
Three I2C standards are:
1. Industrial 100 kbps I2C,
2.100 kbps SM I2C,
3.400 kbps I2C
2
I C Bus
The Bus has two lines that carry its signals- one line is for the clock and one is for bidirectional data.
There is a standard protocol for the I2C bus.
Device Addresses and Master in the I2C bus
Each device has a 7
Bit address using which the data transfers take place.
Master can address 127 other slaves at an instance.
Master has at a processing element functioning as bus controller or a microcontroller
with I2C
bus interface circuit.
Slaves and Masters in the I2C bus
Each slave can also optionally has I2C bus controller and processing element.
Number of masters can be connected on the bus.
Slaves and Masters in the I2C bus
Each slave can also optionally have I2C bus controller and processing element.
Number of masters can be connected on the bus.
However, at an instance, master is one, which initiates a data transfer on SDA (serial
data) line and which transmits the SCL (serial clock) pulses. From master, a data frame
has fields beginning from start bit.

Synchronous Serial Bus Fields and its length:


First field of 1 bit
Second field of 7 bits
Third field of 1 control bit
Fourth field of 1 control bit
Fifth field of 8 bits
Sixth field of 1 bit

Seventh field of 1 bit

Start bit similar to one in an UART


Address field. It defines the slave address,
which is being sent the data frame (of many
bytes) by the master
defines whether a read or write cycle is in
progress
defines whether is the present data is an
acknowledgment (from slave)
I2C device data byte
bit NACK (negative acknowledgement) from
the receiver. If active then acknowledgment
after a transfer is not needed from the slave,
else acknowledgement is expected from the
slave.
stop bit like in an UART

Disadvantage of I2C bus:


Time taken by algorithm in the hardware that analyzes the bits throughI2C in case the slave
hardware
does not provide for the hardware that support sit.
Certain ICs support the protocol and certain do not.
Open collector drivers at the master need a pull-up resistance of 2.2 K on each line.
SERIAL BUS COMMUNICATION PROTOCOLS: CAN BUS

CAN Distributed Control Area Network example a network of embedded systems in


automobile
CAN - bus line usually interconnects to a CAN controller between line and host at the
node. It gives the input and gets output between the physical and data link layers at the
host node.
The CAN controller has a BIU (bus interface unit consisting of buffer and driver),
protocol controller, status -cum-control registers, receiver-buffer and message objects.
These units connect the host node through the host interface circuit.
Three standards:
1.33 kbps CAN,
2.110 kbps Fault Tolerant CAN,
3.1 Mbps High Speed CAN

CAN protocol:
There is a CAN controller between the CAN line and the host node.
CAN controller BIU (Bus Interface Unit)consisting of a buffer and driver
Method for arbitration - CSMA/AMP (Carrier Sense Multiple Access with Arbitration
on Message Priority basis)
Each Distributed Node Uses:
Twisted Pair Connection up to 40 m - for bi-directional data
Line, which pulls to Logic 1 through a resistor between the line and + 4.5V to +12V.
Line Idle state Logic 1 (Recessive state)
Uses a buffer gate between an input pin and the CAN line
Detects Input Presence at the CAN line pulled down to dominant (active) state logic 0
(ground ~
0V) by a sender to the CAN line
Uses a current driver between the output pin and CAN line and pulls line down to dominant

(active) state logic 0(ground ~ 0V) when sending to the CAN line Protocol defined start bit
followed by six fields of frame bits Data frame starts after first detecting that dominant state
is not present at the CAN line with logic 1 (R state) to 0 (D state transition) for one serial bit
interval
After start bit, six fields starting from arbitration field and ends with seven logic0s end-field
3 -bit minimum inter frame gap before next start bit (R D transition) occurs

First field of 12 bits

Second field of 6 bits


Third field of 0 to 64
bits
Fourth field (third if
data field has nobit
present) of 16 bits

Fifth field of 2 bits

-Arbitration field. 11-bit destination address and RTR bit (Remote


Transmission Request)
-Destination device address specified in an11-bit sub-field and
whether the
data bytebeing sent is a data for the device or arequest to the device
in
1- bit sub-field.
-Maximum 211 devices can connect a CANcontroller in case of 11bit
address fieldstandard11-bit address standard CAN.
-Identifies the device to which data isbeing sent or request is being
made.
-When RTR bit is at '1', it means thispacket is for the device at
destinationaddress. If this bit is at '0' (dominantstate) it means, this
packet
is a requestfor the data from the device.
-Protocol defined frame bits Second field
Control field.
-The first bit is for the identifiersextension.
-The second bit is always '1'.
-The last 4 bits specify code for dataLength
Its lengthdepends on the data length code in thecontrol field.
CRC (CyclicRedundancy Check) with 15 bit CRC plus 1-bit
delimiter bit.
Receiver node uses it to detect theerrors, if any, during the
transmission
-First bit 'ACK slot'
-ACK = '1' and receiver sends back '0' in this slotwhen the receiver
detects
an error in the reception.
-Sender after sensing '0' in the ACK slot, generallyretransmits the
data

frame.
- Second bit 'ACK delimiter' bit. It signals the endof ACK field.
- If the transmitting node does not receive anyacknowledgement of
data
frame within a specifiedtime slot, it should retransmit.
Sixth field of 7-bits

End- of- theframespecification and has seven '0's

ETHERNET:
Ethernet is very widely used as a local area network for general-purpose
computing.Because of its ubiquity and the low cost of Ethernet interfaces,it has seen
significant use as a network for embedded computing.
Ethernet is particularly useful when PCs are used as platforms,making it possible to
use standard components,and when the network does not have to meet rigorous realtime requirements.
The physical organization of an Ethernet is very simple, as shown in below Figure.

Ethernet Organisation
The network is a bus with a single signal path; the Ethernet standard allows for several
different implementations such as twisted pair and coaxial cable.
Unlike the I2C bus,nodes on the Ethernet are not synchronizedthey can send their
bits at any time. I2C relies on the fact that a collision can be detected and quashed
within a single bit time thanks to synchronization.
But since Ethernet nodes are not synchronized, if two nodes decide to transmit at the
same time,the message will be ruined. The Ethernet arbitration scheme is known as
Carrier Sense Multiple Access with Collision Detection (CSMA/CD).
The algorithm is outlined in below Figure.

A node that has a message waits for the bus to become silent and then starts
transmitting. It simultaneously listens, and if it hears another transmission that
interferes with its transmission, it stops transmitting and waits to retransmit.
The waiting time is random,but weighted by an exponential function of the number of
times the message has been aborted.
Figure 8.16 shows the exponential backoff function both before and after it is
modulated by the random wait time. Since a message may be interfered with several
times before it is successfully transmitted,the exponential backoff technique helps to
ensure that the network does not become overloaded at high demand factors.

The random factor in the wait time minimizes the chance that two messages will
repeatedly interfere with each other.
The maximum length of an Ethernet is determined by the nodes ability to detect
collisions. The worst case occurs when two nodes at opposite ends of the bus are
transmitting simultaneously. For the collision to be detected by both nodes, each
nodes signal must be able to travel to the opposite end of the bus so that it can be
heard by the other node. In practice, Ethernets can run up to several hundred meters.
Figure 8.17 shows the basic format of an Ethernet packet. It provides addresses of both
the destination and the source. It also provides for a variable-length data payload.

The fact that it may take several attempts to successfully transmit a message and that
the waiting time includes a random factor makes Ethernet performance difficult to
analyze.
It is possible to perform data streaming and other real-time activities on
Ethernets,particularly when the total network load is kept to a reasonable level,but care
must be taken in designing such systems.
Ethernet was not designed to support real-time operations; the exponential backoff
scheme cannot guarantee delivery time of any data.
Because so much Ethernet hardware and software is available,many different
approaches have been developed to extend Ethernet to real-time operation; some of
these are compatible with the standard while others are not.
There are three ways to reduce the variance in Ethernets packet delivery time
suppress collisions on the network
reduce the number of collisions
or resolve collisions deterministically.

INTERNET:

The Internet Protocol (IP) is the fundamental protocol on the Internet.


It provides connectionless, packet-based communication.
Internet packets are assumed to be carried by some other network, such as an Ethernet.
an Internet packet will travel over several different networks from source to
destination.
The IP allows data to flow seamlessly through these networks from one end user to
another. The relationship between IP and individual networks is illustrated in Figure
8.19.

IP works at the network layer.


When node A wants to send data to node B, the applications data pass through several
layers of the protocol stack to send to the IP. IP creates packets for routing to the
destination,which are then sent to the data link and physical layers.
A node that transmits data among different types of networks is known as a router.
The routers functionality must go up to the IP layer, but since it is not running
applications, it does not need to go to higher levels of the OSI model.
A packet may go through several routers to get to its destination.
At the destination, the IP layer provides data to the transport layer and ultimately the
receiving application.
As the data pass through several layers of the protocol stack, the IP packet data are
encapsulated in packet formats appropriate to each layer.
The basic format of an IP packet is shown in Figure 8.20.

The header and data payload are both of variable length. The maximum total length of
the header and data payload is 65,535 bytes.
An Internet address is a number (32 bits in early versions of IP, 128 bits in IPv6). The
IP address is typically written in the form xxx.xx.xx.xx.

The names by which users and applications typically refer to Internet nodes, such as
foo.baz.com,are translated into IP addresses via calls to a Domain Name Server, one
of the higher-level services built on top of IP.
The fact that IP works at the network layer tells us that it does not guarantee that a
packet is delivered to its destination.
Packets that do arrive may come out of order. This is referred to as best-effort routing.
Since routes for data may change quickly with subsequent packets being routed along
very different paths with different delays, real-time performance of IP can be hard to
predict.
When a small network is contained totally within the embedded system, performance
can be evaluated through simulation or other methods because the possible inputs are
limited.
Since the performance of the Internet may depend on worldwide usage patterns, its
real-time performance is inherently harder to predict.
The Internet also provides higher-level services built on top of IP.
The Transmission Control Protocol (TCP) is one such example. It provides a
connection oriented service that ensures that data arrive in the appropriate order, and it
uses an acknowledgment protocol to ensure that packets arrive.
Because many higherlevel services are built on top of TCP, the basic protocol is often
referred to as TCP/IP.
Figure 8.21 shows the relationships between IP and higher-level Internet services.

Using IP as the foundation,TCP is used to provide File Transport Protocolfor batch


file transfers, Hypertext Transport Protocol (HTTP) for WorldWide Web service,
Simple Mail Transfer Protocol for email, and Telnet for virtual terminals.
A separate transport protocol, User Datagram Protocol, is used as the basis for the
network management services provided by the Simple Network Management
Protocol.

You might also like