2. CONTENT
I2C COMMUNICATION
HOW I2C WORK
MULTIPLE SLAVE CONFIGURATION
STEPS OF I2C TRANSMISSION
ADVANTAGES AND DISADVANTAGES OF I2C
08-11-2022 2
3. I2C stands for inter-integrated circuit.
I2C is a serial communication protocol, so data is transferred bit by bit along a single wire (SDA).
Like SPI, I2C is synchronous, so the output of bits is synchronized to the sampling of bits by a clock
signal shared between the master and the slave. The clock signal is always controlled by master.
I2C combines the best features of SPI and UARTs. With I2C, we can connect multiple slaves to a
single master (like SPI) and we can have multiple masters controlling single, or multiple slaves. This
is really useful when we want to have more than one microcontroller logging data to a single
memory card or displaying text to a single LCD.
I2C
3. I2C COMMUNICATION
08-11-2022 3
Serial Data: The line for the master and slave to send
and receive data
Serial Clock: The line that carries the clock signal
SDA
SCL
4. HOW I2C WORK
With I2C, data is transferred in messages. Messages are broken up into frames of data.
Each message has an address frame that contains the binary address of the slave, and one or more
data frames that contain the data being transmitted.
The message also includes start and stop conditions, read/write bits, and ACK/NACK bits between
each data frame:.
08-11-2022 4
.
START CONDITION
STOP CONDITION
The start bit is used to signal the beginning of a message
The SDA line switches from a high voltage level to a low voltage level before the SCL line
switches from high to low.
The stop bit is used to signal the end of a message
The SDA line switches from a low voltage level to a high voltage level after the SCL line
switches from low to high.
5. HOW I2C WORK
08-11-2022 5
.
READ/WRITE BIT
ACK/NACK BIT
A single bit specifying whether the master is sending data to the slave (low voltage level) or
requesting data from it (high voltage level).
If the master wants to send data to the slave, the read/write bit is a low voltage level.
If the master is requesting data from the slave, the bit is a high voltage level.
An ACK/NACK bit to verify that the frame has been received successfully
Each frame in a message is followed by an acknowledge/no-acknowledge bit. If an address frame or
data frame was successfully received, an ACK bit is returned to the sender from the receiving device.
The ACK bit must be received by either the master or the slave (depending on who is sending the
data) before the next data frame can be sent.
I2C doesn’t have slave select lines like SPI, so it needs another way to let the slave know that data
is being sent to it, and not another slave. It does this by addressing.
The address frame is always the first frame after the start bit in a new message
A 7 or 10 bit sequence unique to each slave that identifies the slave when the master wants to talk
to it
ADDRESS FRAME
6. STEPS OF I2C TRANSMISSION
Step1:The master sends the start condition to
every connected slave by switching the SDA
line from a high voltage level to a low voltage
level before switching the SCL line from high to
low:
Step2:The master sends each slave the 7
or 10 bit address of the slave it wants to
communicate with, along with the
read/write bit:
08-11-2022 6
7. Step4: The master sends or receives the data
frame:
:
STEPS OF I2C TRANSMISSION
08-11-2022 7
Step3:Each slave compares the address sent
from the master to its own address. If the address
matches, the slave returns an ACK bit by pulling
the SDA line low for one bit. If the address from
the master does not match the slave’s own
address, the slave leaves the SDA line high.
8. 08-11-2022 8
Step5: After each data frame has been
transferred, the receiving device returns
another ACK bit to the sender to acknowledge
successful receipt of the frame::
:
Step6: To stop the data transmission, the
master sends a stop condition to the slave by
switching SCL high before switching SDA
high
:
STEPS OF I2C TRANSMISSION
9. 08-11-2022 9
Because I2C uses addressing, multiple slaves can be
controlled from a single master.
With a 7 bit address, 128 (27) unique address are available.
Using 10 bit addresses is uncommon, but provides 1,024
(210) unique addresses.
The problem with multiple masters in the same system comes when
two masters try to send or receive data at the same time over the SDA line.
To solve this problem, each master needs to detect if the SDA line is low or
high before transmitting a message.
If the SDA line is low, this means that another master has control of the
bus, and the master should wait to send the message.
If the SDA line is high, then it’s safe to transmit the message.
SINGLE MASTER WITH MULTIPLE SLAVES
MULTIPLE MASTERS WITH MULTIPLE SLAVES
MULTIPLE SLAVE CONFIGURATION
10. ADVANTAGES AND DISADVANTAGES OF I2C
ADVANTAGES
DISADVANTAGES
Only uses two wires
Supports multiple masters and multiple slaves
ACK/NACK bit gives confirmation that each frame is transferred successfully
Hardware is less complicated than with UARTs
Well known and widely used protocol
Slower data transfer rate than SPI
The size of the data frame is limited to 8 bits
More complicated hardware needed to implement than SPI
08-11-2022 10
12. 08-11-2022 12
Universal Serial Bus (USB) is a packet mode data link
protocol that transfers data using synchronous serial
communication. This type of communication always pair
the data line with a clock signal and allows you to perform
a USB transfer with a single function call. When the
function call returns, the transfer has completed and you
can parse the results. But one can not cancel the transfer
once the request has been submitte
USB
UART stands for Universal Asynchronous Receiver Transmitter.
USART stands for Universal Synchronous Asynchronous Receiver Transmitter. The only
difference between them is that the UART peripheral supports only asynchronous mode, whereas USART
supports both synchronous and asynchronous modes.
13. 08-11-2022 13
USART UART
.1. In USART, half duplex mode is used While in UART, full duplex mode is used.
2.
The speed of USART is more than the speed of
UART.
While the speed of UART is comparatively less.
3.
USART uses both data signals and clock for its
functioning.
While UART entails data signals only for its
functioning.
4.
In USART, data is transmitted in the form of
blocks.
While in UART, data is transmitted in the form of
bytes(one byte at a time).
5. USART can do its function like UART. Whereas UART can’t do its function like USART.
6.
USART is more complex than UART in terms of
complexity.
While UART is simple in terms of complexity.
7.
In USART, receiver doesn’t have to know the
baud-pace of the transmitter as it is gotten from
the information line gave by the master and the
clock signal.
While there is no approaching clock signal that is
related with the information, so the recipient has to
know baud-pace of the transmitter before the
inception of gathering.
8.
In the USART, data is transmitted at a definite
rate.
While in UART, data can be transmitted at a variable
speed.
14. 08-11-2022 14
One message sent over RS-232/422/485 consists of a
start bit, several data bits, a parity bit and a stop bit
The start bit -It is the bit denoting the beginning of the transmission, usually 0.
Data bits - 5, 6, 7 or 8 bits of data. The first bit is the less significant bit.
Parity bit - A bit intended for parity checking. Serves for detecting errors. It can take the following values:
The parity (EVEN) takes such value that the number of units in the message is even
Oddness (ODD), takes on such value that the number of units in the message is odd
Always 1 (MARK), the parity bit will always be 1
Always 0 (SPACE), the parity bit will always be 0
Not used (NONE)
Stop bit - a bit indicating the completion of the message transmission can take the values 1
STRUCTURE OF TRANSMITTED DATA IN RS-232
15. 08-11-2022 15
For connection to RS-232, a special D-sub connector is
used, usually a 9-pin DB9, and a 25-pin DB25 is used
less often.
RS 232
The RS-232 interface (TIA / EIA-232) is intended for the organization of data transfer between the transmitter or
terminal (Data Terminal Equipment, DTE) and the receiver or communication equipment (Data Communications
Equipment, DCE) in the point-to-point scheme.
•Information on the RS-232 interface is transmitted
digitally by logical 0 and 1.
•The logical "1" (MARK) corresponds to a voltage
in the range from -3 to -15 V.
•The logical "0" (SPACE) corresponds to a voltage
in the range from +3 to +15 V.
Data transfer speed depend on Data transmission distance
9600bps-15 meters
115kbps-minimun distance
921.6kbs-hardware support speed
16. 08-11-2022 16
DB9 DB25 Designation Name
1 8 CD Carrier Detect
2 3 RXD Receive Data
3 2 TXD Transmit Data
4 20 DTR
Data Terminal
Ready
5 7 GND System Ground
6 6 DSR Data Set Ready
7 4 RTS
Request to
Send
8 5 CTS Clear to Send
9 22 RI Ring Indicator
TYPES OF DATA CONNECTOR
There are three types of connection of devices to RS-232
terminal-terminal DTE-DTE
terminal-communication equipment DTE-DCE
modem-modem DCE-DCE
17. 08-11-2022 17
RS 422
The RS-422 interface is similar to RS-232. It allow to
simultaneously send and receive messages on
separate lines (full duplex), but uses a differential
signal
In the RS-422 network, there can only be one
transmitting device and up to 10 receiving devices.
The RS-422 line is 4 wires for data transmission (2
twisted wires for transmission and 2 twisted wires for
receiving) and one common GND ground wire.
Data transfer speed depend on Data transmission distance
10kbps-1200 meters
10mbps-10 meters
18. 08-11-2022 18
In industry, the most common interface is RS-485 (EIA-485), because the RS-485 uses a multi-point topology,
which allows we to connect several receivers and transmitter
The RS-485 interface is similar to the RS-422 in that it also uses a differential signal for data transmission
There are two types of RS-485:
•RS-485 with 2 contacts, operates in half duplex mode
•RS-485 with 4 contacts, operates in full duplex mode
In full duplex mode, we can simultaneously receive and transmit data, and in half-duplex mode either transmit or
receive
RS 485
CONNECT RS-485 DEVICES WITH 2 CONTACTS
19. 08-11-2022 19
The speed of operation also depends on the length of the line and can reach 10 Mbit / s at 10
meters.
CONNECT RS-485 DEVICES WITH 4 CONTACTS
RS 485
21. 08-11-2022 21
The RS-232 interface operates in full-duplex mode, which allows you to send and receive
information at the same time, because different lines are used for receiving and transmitting. This
is in contrast to the half-duplex mode, when one link is used to receive and transmit data, which
imposes a restriction on simultaneous operation, so in a half-duplex mode at one time, either the
reception or transmission of information is possible.
•Information on the RS-232 interface is transmitted digitally by logical 0 and 1.
•The logical "1" (MARK) corresponds to a voltage in the range from -3 to -15 V.
•The logical "0" (SPACE) corresponds to a voltage in the range from +3 to +15 V.
22. 08-11-2022 22
Description of the RS-422 interface
The potential difference between conductors A and B.
The data transfer speed in RS-422 depends on the distance and can vary from 10 kbps (1200 meters) to 10 Mbps
(10 meters).
In the RS-422 network, there can only be one transmitting device and up to 10 receiving devices.
The RS-422 line is 4 wires for data transmission (2 twisted wires for transmission and 2 twisted wires for
receiving) and one common GND ground wire.
Twisting wires (twisted pair) with each other allows you to get rid of interference and interference, because the
interference acts equally on both wires, and the information is extracted from the potential difference between the
conductors A and B of one line.
The voltage on the data lines can be in the range from -6 V to +6 V.
The logical difference between A and B is greater than +0.2 V.
Logical 1 corresponds to the difference between A and B less than -0.2 V.
The RS-422 standard does not define a specific type of connector, usually it can be a terminal block or a DB9
connector.
RS-422 pinout depends on the manufacturer of the device and is specified in the documentation for it
Because the distance between the receiver and the transmitter RS-422 can reach 1200 meters, then to prevent
reflection of the signal from the end of the line, a special 120-ohm termination resistor or "terminator" is put. This
resistor is set between RX + and RX-contacts at the beginning and end of the line.
23. 08-11-2022 23
[n full duplex mode, you can simultaneously receive and transmit data, and in half-duplex
mode either transmit or receive.
In one segment of the RS-485 network there can be up to 32 devices, but with the help of
additional repeaters and signal amplifiers up to 256 devices. At one time, only one
transmitter can be active.
The speed of operation also depends on the length of the line and can reach 10 Mbit / s at
10 meters.
The voltage on the lines is in the range from -7 V to +12 V.
The RS-485 standard does not define a specific type of connector, but it is often a terminal
block or a DB9 connector.
The pinout of the RS-485 connector depends on the manufacturer of the device and is
specified in the documentation for it.
Connect RS-485 devices with 2 contacts.
To match the line at large distances, the RS-485 is also equipped with 120 Ohm termination
resistors at the beginning and end of the line.
24. 08-11-2022 24
USART :
USART (Universal Synchronous/Asynchronous Receiver/Transmitter) is a
coordinated circuit which is appended to different specialized gadgets. These are fit for
changing the parallel information in the sequential structure. The information pace of
USART is commonly high since it creates clock data or information. USART is fit for
directing the entire procedure in the switch request where sequential information is
infused, and the parallel type of the information is created accordingly. In USART, receiver
doesn’t have to know the baud-pace of the transmitter as it is gotten from the information
line gave by the master and the clock signal. In USART, a clock is generated by sending
peripheral that is received by receiving peripheral that can be retrieved from the data
stream without knowing the baud pace over time.
25. 08-11-2022 25
UART (Universal asynchronous receiver/transmitter) is a large-scale
integration gadget offbeat is planned to deal with the transmission of
sequential information. It(UART) lies at the center between frameworks that
deal with information in a parallel structure and gadgets that handle
information in an offbeat sequential structure. UART provides lower data
transfer speed as compared to USART. There is no approaching clock signal
that is related with the information, so the recipient has to know baud-pace of
the transmitter before the inception of gathering. In UART, data clock is
generated internally into the microcontroller and synchronized with the data
stream using a start bit transition.
27. 08-11-2022 27
This mode of communication is
expensive since it requires
additional cables and
hardware. Nevertheless, it is
considered to be a swift mode
of transfer. Printers, RAM, ISA,
ATA, SCSI, PCI, Front side bus
,etc., use parallel data
transmission.
28. 08-11-2022 28
It all started with the introduction of an 8 bit parallel port (also known as
Standard Parallel Port) by IBM in 1981. It was introduced as a fast
interface replacement for Dot Matrix printers. However, there was a
major downside in this Standard Parallel Port (SPP). The downside was
that it was only providing one directional communication i.e. from
computer to Printer. A number of wires in the parallel port were left
unused, which could have been utilized for indicating the status of
printer.
On realization of various benefits of bi-directional communication,
IBM made some upgradations and brought a parallel port that
supported both ways data transfer. In spite of these upgradations,
parallel data communication was yet to make a mark as a suitable
high speed data port. It still had various downsides such as lack of
standardization in physical interfaces and limited distance (six feet)
supportability.
29. 08-11-2022 29
To overcome these downsides, a standard IEEE 1284 was introduced for
parallel communication. IEEE 1284 standardizes the physical interfaces to
ensure better inter-operable conditions for parallel interfaces. Its introduction
nullified various drawbacks of initial parallel ports such as ensuring data
integrity and communication supportability up to 30 feet.
The Parallel ports
became more
advanced with the
introduction of
Enhanced Parallel Port
(EPP) protocol. This
protocol uses the data
cycles more effectively
and provides data
transfer in real time.
EPP remarkably
increased the speed of
parallel ports from 150
kbps to 2 mbps.
30. 08-11-2022 30
When to Use Parallel Communication
It should be used when:
•Large Data needs to be transferred.
•Data to be sent is time sensitive.
•Data is required to be transferred quickly or in real time.