UNIT-V
UNIT-V
Vishnu Kumar
Syllabus
Serial Communication Basics
Synchronous/Asynchronous Interfaces (like UART,
SPI, I2C, and USB)
Baud Rate Concepts
UART Protocol
I2C Protocol
SPI protocol
Implementing and Programming UART, I2C, SPI
Implementing Embedded Wi-Fi using CC3100
Vishnu Kumar
DATA COMMUNICATION
TYPES
1. Parallel
2. Serial:
(i) Synchronous
(ii) Asynchronous
Vishnu Kumar
Parallel Communication
In parallel communication, all the bits of
data is transmitted simultaneously on
separate communication lines.
Used for shorter distance.
In order to transmit n bit , n wires or lines
are used.
More costly.
Faster than serial transmission.
Data can be transmitted in less time.
Example : Printers and hard disk
Vishnu Kumar
Serial Communication
In serial communication the data bits are
transmitted serially one by one i.e. bit by bit
on single communication line
It requires only one communication line
Vishnu Kumar
Serial Vs Parallel
Communication
Serial Transfer Parallel Transfer
Sender Receiver
Sender Receiver
Vishnu Kumar
Serial Communication
Serial communication uses two methods:
◦ Asynchronous.
◦ Synchronous.
Asynchronous:
Transfers single byte at a time.
No need of Clock Signal
Example: UART (Universal Asynchronous Receiver
Transmitter)
Synchronous:
Transfers a block of data (characters) at a time.
Requires Clock Signal
Example: SPI (Serial Peripheral Interface),
I2C (Inter Integrated Circuit).
Vishnu Kumar
Data Transmission
In data transmission if the data can be
transmitted and received, it is a duplex
transmission.
Transmitter Receiver
Half
Duplex Receiver Transmitter
Transmitter Receiver
Full
Duplex
Receiver Transmitter
Vishnu Kumar
Various Serial Interfaces
Data
Name of Synchronous
Type Duplex transfer
interface /Asynchronous
rate (kbps)
MICROWIR
Synchronous master/slave Full-duplex > 625
E
Vishnu Kumar
Baud Rate Concepts
Data transfer rate in serial communication is measured
in terms of bits per second (bps). This is also called as
Baud Rate. Baud Rate and bps can be used inter
changeably with respect to UART.
Ex: The total number of bits gets transferred during 10
pages of text, each with 100 × 25 characters with 8 bits
per character and 1 start & stop bit is:
For each character a total number of bits are 10. The
total number of bits is:
100 × 25 × 10 = 25,000 bits per page. For 10 pages of
data it is required to transmit 2, 50,000 bits. Generally
baud rates of SCI are 1200, 2400, 4800, 9600, 19,200
etc.
To transfer 2, 50,000 bits at a baud rate of 9600, we
need: 250000/9600 = 26.04 seconds (27 seconds).
Vishnu Kumar
UART Protocol
When the receiving UART detects a start bit, it starts to read the
incoming bits at a specific frequency known as the baud rate.
Baud rate is a measure of the speed of data transfer, expressed
in bits per second (bps).
Both UARTs must operate at about the same baud rate.
Vishnu Kumar
UART Protocol Cont…
Vishnu Kumar
UART Data Packet Cont…
Vishnu Kumar
How UART Works Cont…
STEPS OF UART TRANSMISSION
1) The transmitting UART receives data in parallel from the data
bus (happens in the inside of MSP430 Controller):
Vishnu Kumar
How UART Works Cont…
STEPS OF UART TRANSMISSION
2) The transmitting UART adds the start bit, parity bit, and the
stop bit(s) to the data frame.
Vishnu Kumar
How UART Works Cont…
STEPS OF UART TRANSMISSION
3) The entire packet is sent serially from the transmitting UART
to the receiving UART.
Vishnu Kumar
How UART Works Cont…
STEPS OF UART TRANSMISSION
4) The receiving UART discards the start bit, parity bit, and stop
bit from the data frame.
Vishnu Kumar
How UART Works Cont…
STEPS OF UART TRANSMISSION
4) The receiving UART converts the serial data back into parallel
and transfers it to the data bus on the receiving end.
Vishnu Kumar
ADVANTAGES AND DISADVANTAGES OF
UART:
ADVANTAGES
Only uses two wires
No clock signal is necessary
Has a parity bit to allow for error checking
Well documented and widely used method.
DISADVANTAGES
The size of the data frame is limited to a maximum of 9 bits
Doesn’t support multiple slave or multiple master systems
The baud rates of each UART must be same each other
Vishnu Kumar
APPLICATIONS OF UART:
UART is one of the most simple and most commonly used
Serial Communication techniques.
Today, UART is being used in many applications like
GPS Receivers
Bluetooth Modules
GSM and GPRS Modems
Wireless Communication Systems
RFID based applications etc.
Vishnu Kumar
SPI Protocol
MOSI (Master Output/Slave Input) – Line for the master to send data to the
slave.
MISO (Master Input/Slave Output) – Line for the slave to send data to the
master
SCLK (Clock) – Line for the clock signal.
SS/CS (Slave Select/Chip Select) – Line for the master to select which slave to
send data
Vishnu Kumar
SPI Protocol Cont…
One unique benefit of SPI is that the data can be transferred without
interruption.
Any number of bits can be sent or received in a continuous stream.
Devices communicating via SPI are in a master-slave relationship.
The master is the controlling device (usually a microcontroller), while
the slave (usually a sensor, display, or memory chip) takes instruction
from the master.
Vishnu Kumar
MULTIPLE SLAVES Connection types Cont…
If the master has multiple slave select If only one slave select pin is available,
pins, the slaves can be wired in parallel the slaves can be daisy-chained like
like this: this:
Vishnu Kumar
How SPI Works Cont…
STEPS OF SPI TRANSMISSION
1) The master outputs the clock signal:
Vishnu Kumar
How SPI Works Cont…
STEPS OF SPI TRANSMISSION
2) The master switches the SS/CS pin to a low voltage state,
which activates the slave:
Vishnu Kumar
How SPI Works Cont…
STEPS OF SPI TRANSMISSION
3) The master sends the data one bit at a time to the slave
along the MOSI line. The slave reads the bits as they are
received:
Vishnu Kumar
How SPI Works Cont…
STEPS OF SPI TRANSMISSION
4) If a response is needed, the slave returns data one bit at a
time to the master along the MISO line. The master reads the
bits as they are received:
Vishnu Kumar
ADVANTAGES AND DISADVANTAGES OF
SPI:
ADVANTAGES
No start and stop bits, so the data can be streamed continuously
without interruption
No complicated slave addressing system like I2C
Higher data transfer rate than I2C (almost twice as fast)
Separate MISO and MOSI lines, so data can be sent and received at
the same time
DISADVANTAGES
Uses four wires (I2C and UARTs use two)
No acknowledgement that the data has been successfully received
(I2C has this)
No form of error checking like the parity bit in UART
Only allows for a single master
Vishnu Kumar
APPLICATIONS OF SPI:
SPI is a common communication protocol used by many
different devices. For example,
SD card modules
RFID card reader modules
2.4 GHz wireless transmitter/receivers etc.
Vishnu Kumar
ALTERNATE REPRESENTATION
OF
SPI DIAGRAMS:
Vishnu Kumar
I2C Protocol
SDA (Serial Data) – The line for the master and slave to send and
receive data.
SCL (Serial Clock) – The line that carries the clock signal.
I2C combines the best features of SPI and UARTs. With I2C, you
can connect multiple slaves to a single master (like SPI) and you
can have multiple masters controlling single, or multiple slaves.
Vishnu Kumar
I2C Protocol Cont…
Vishnu Kumar
I2C Message Format Cont…
Vishnu Kumar
I2C Start & Stop Condition
Cont…
Vishnu Kumar
How I2C Works Cont…
STEPS OF SPI TRANSMISSION
1) 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:
Vishnu Kumar
How I2C Works Cont…
STEPS OF SPI TRANSMISSION
2) The master sends the 7 or 10 bit address of the slave it wants
to communicate with, along with the read/write bit:
Vishnu Kumar
How I2C Works Cont…
STEPS OF SPI TRANSMISSION
3) 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.
Vishnu Kumar
How I2C Works Cont…
STEPS OF SPI TRANSMISSION
4) The master sends or receives the data frame:
Vishnu Kumar
How I2C Works Cont…
STEPS OF SPI TRANSMISSION
5) After each data frame has been transferred, the receiving
device returns another ACK bit to the sender to acknowledge
successful receipt of the frame:
Vishnu Kumar
How I2C Works Cont…
STEPS OF SPI TRANSMISSION
6) To stop the data transmission, the master sends a stop
condition to the slave by switching SCL high before switching
SDA high:
Vishnu Kumar
SINGLE MASTER WITH MULTIPLE SLAVES
Cont…
Vishnu Kumar
MULTIPLE MASTERS WITH MULTIPLE SLAVES
Cont…
Vishnu Kumar
ADVANTAGES AND DISADVANTAGES OF
I2C:
ADVANTAGES
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
DISADVANTAGES
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
Vishnu Kumar
UNIVERSAL SERIAL BUS (USB):
The USB was developed in 1995 by many of the industry leading
companies like Intel, Compaq, Microsoft, Digital, IBM, and Northern
Telecom.
The major goal of USB was to define an external expansion bus to
add peripherals to a PC in easy and simple manner.
USB offers users simple connectivity.
USB also allows hot swapping.
USB is now the most used interface to connect devices
The benefits of USB are low cost, expandability, auto-configuration,
hot-plugging and outstanding performance. It also provides power to
the bus, enabling many peripherals to operate without the added
need for an AC power adapter.
Vishnu Kumar
Various versions USB:
Cont…
USB1.0: USB 1.0 is the original release of USB having the capability
of transferring 12Mbps, supporting up to 127 devices. This USB 1.0
specification model was introduced in January 1996.
USB1.1: USB 1.1 came out in September 1998. USB 1.1 is also
known as full-speed USB. It supported two speeds, a full speed mode
of 12Mbits/s and a low speed mode of 1.5Mbits/s.
USB2.0: Hewlett-Packard, Intel, LSI Corporation, Microsoft, NEC, and
Philips jointly led the initiative to develop a higher data transfer rate
than the 1.1 specifications. The USB 2.0 specification was released in
April 2000. Supporting three speed modes (1.5, 12 and 480 Mbps).
USB 2.0, also known as hi-speed USB.
USB3.0: USB 3.0 is the latest version of USB release. It is also called
as Super-Speed USB having a data transfer rate of 4.8Gbps (600
MB/s).Its specification was released by Intel and its partners in Aug-
2008. Product is come out in 2010.
Vishnu Kumar
The USB "tiered star" topology:
Cont…
The USB system is made up of a host, multiple numbers of USB
ports, and multiple peripheral devices connected in a tiered-star
topology.
Vishnu Kumar
USB connectors:
Cont…
The USB standard uses "A" and "B" connectors mainly to avoid
confusion:
1) "A" connectors head "upstream" toward the computer.
2) "B" connectors head "downstream" and connect to individual
devices.
Vishnu Kumar
USB Data Transfer Types:
Cont…
USB can support 4 data transfer types or transfer modes.
1) Control
2) Isochronous
3) Bulk
4) Interrupt
Vishnu Kumar
Implementing Embedded Wi-Fi using CC3100
Embedded Wi-Fi:
The below figure shows the hardware architecture for SimpleLink Wi-Fi
CC3100 module. It can be used to provide Wi-Fi connectivity to any
micro-controller based system. It consists mainly of two parts:
(1) Wi-Fi Network Processor Subsystem
(2) Power-management Subsystem
Vishnu Kumar
Implementing Embedded Wi-Fi using
CC3100 by CC3100
Features of Wi-Fi supported
chip:
Vishnu Kumar
Implementing Embedded Wi-Fi using
CC3100
Vishnu Kumar
Block Diagram of Email application using
CC3100
Vishnu Kumar
Flow Char of Email application using CC3100
Vishnu Kumar
Implementing Embedded Wi-Fi using
CC3100
Applications of CC3100:
Cloud Connectivity
Home Automation
Home Appliances
Access Control
Security Systems
Smart Energy Meter
Internet Gateway
Industrial Control
Wireless Audio
IP Network Sensor Nodes
Vishnu Kumar