0% found this document useful (0 votes)
7 views

MPMC_UnitIV_SerialBus_SPI,I2c,USB (1) (1)

The document covers serial bus communication standards, focusing on SPI, I2C, and USB protocols. It details the architecture and operation of these protocols, including their advantages and limitations. Additionally, it provides references for further reading and outlines the evolution of USB technology and its applications in connecting various peripherals.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

MPMC_UnitIV_SerialBus_SPI,I2c,USB (1) (1)

The document covers serial bus communication standards, focusing on SPI, I2C, and USB protocols. It details the architecture and operation of these protocols, including their advantages and limitations. Additionally, it provides references for further reading and outlines the evolution of USB technology and its applications in connecting various peripherals.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 43

Microprocessors and

Microcontrollers

Unit IV Part 2
Serial Bus

B.Tech, ETM,
III Year, I Semester
G.Krishna Reddy
Dept. of Electronics and Telematics
GNITS, Hyderabad
04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 1
Syllabus
Unit V
The RISC microcontroller architecture:
• Introduction to RISC Microcontroller
• SPI
• I2C
• Basics of USB

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 2


Reference
Reference websites
• SPI
https://learn.sparkfun.com/tutorials/serial-peripheral-
interface-spi
• I2C
http://www.byteparadigm.com/applications/introduction-t
o-i2c-and-spi-protocols/
http://www.embedds.com/programming-avr-i2c-interface/
• TWI Serial Bus (same as I2C)
http://www.atmel.com/images/doc2564.pdf

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 3


Reference
Reference websites
• Basics of USB
http://www.eeherald.com/section/design-guide/esmod14.html

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 4


Serial Communication Standards
Serial communication
• Common serial port – Tx, Rx
– not synchronous
• Can have problem when connecting devices
with different clocks.
• Start, Stop bits added, cause overhead
• Speed of transmission (9600 baud) must be set
ahead of start of transmission

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 5


Serial Communication Standards
Serial Communication

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 6


Serial Communication Standards
SPI – Serial Peripheral Interface
Synchronous solution

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 7


Serial Communication Standards
SPI – Serial Peripheral Interface
Synchronous solution

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 8


Serial Communication Standards
SPI – Serial Peripheral Interface
• Developed by Motorola
• Synchronous solution
• Separate lines for Data and clock signals
• No need to specify speed
• Simple receiver hardware – shift register
• Master-slave concept
• Master (Microcontroller) generates the clock
• Multiple slaves possible.

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 9


Serial Communication Standards
SPI – Serial Peripheral Interface

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 10


Serial Communication Standards
SPI – Serial Peripheral Interface
• Data sent from master to slave on MOSI line
(Master Out/Slave In)
• Slave puts data in MISO line
(Master In/Slave Out)
• SPI – full duplex
Can transmit and receive data at the same time
• SS – slave select line to wake up a slave and
receive data
• Each Slave can have its own SS line
or daisy chained.
04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 11
Serial Communication Standards
SPI – Serial Peripheral Interface

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 12


Serial Communication Standards
SPI – Serial Peripheral Interface

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 13


Serial Communication Standards
I2C – Inter IC Communication
(Atmel calls it Two Wire Interface TWI)
• Multimaster, Multislave
• Any number of masters and slaves
• No slave select
• 7-bits slave addresses: each device connected to
the bus has got such a unique address;
• Data divided into 8-bit bytes
• A few control bits for controlling
communication start, end, direction and
for an acknowledgment mechanism.
04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 14
Serial Communication Standards
I2C – Inter IC Communication
• Data rate :
100 kbps, 400 kbps and 3.4 Mbps
• Some at 10 Kbps, 1 Mbps
• 2 active wires :
SDA, SCL - Both bidirectional
• IC initiating data transfer – Bus Master
Others – Bus slaves

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 15


Serial Communication Standards
I2C – Inter Integrated Chip Communication

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 16


Serial Communication Standards
I2C – Process

First, the master will issue a START condition.

This acts as an ‘Attention’ signal
to all of the connected devices.

All ICs on the bus will listen to the bus
for incoming data.

Then the master sends the ADDRESS of the device
it wants to access, along with an indication
whether the access is a Read or Write operation
(Write in our example).

Having received the address, all IC’s will compare
it with their own address.
04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 17
Serial Communication Standards
I2C – Inter IC Communication
• If it doesn’t match, they simply wait until the bus
is released by the stop condition (see below).
• If the address matches, however, the chip will
produce a response called the ACKNOWLEDGE signal.
• Once the master receives the acknowledge,
it can start transmitting or receiving DATA.
• In our case, the master will transmit data.
When all is done, the master will issue
the STOP condition.
• This is a signal that states the bus has been released
and that the connected ICs may expect another
transmission to start any moment.
04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 18
Serial Communication Standards
I2C – Inter IC Communication
• When a master wants to receive data from a slave,
it proceeds the same way,
but sets the RD/ WR bit at a logical one.
• Once the slave has acknowledged the address,
it starts sending the requested data, byte by byte.
• After each data byte, it is up to the master
to acknowledge the received data.

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 19


Serial Communication Standards
I2C – Inter Integrated Chip Communication

Figure 5 I2C Timing Diagram

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 20


Serial Communication Standards
I2C – Inter IC Communication
• START and STOP are unique conditions on the bus
that are closely dependent of the I²C bus
physical structure.
• The Data may only change on the SDA line
if the SCL clock signal is at low level;
• The data on the SDA line is considered as stable
when SCL is in high state
(refer to figure 5 in the last slide).

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 21


Serial Communication Standards
SPI - I2C comparison
Bus topology / routing / resources:
• I²C needs 2 lines while SPI formally defines
at least 4 signals and more, if you add slaves.
• Some unofficial SPI variants only need 3 wires,
that is a SCLK, SS and
a bi-directional MISO/MOSI line.
• SPI one SS line per slave
• For multimaster, SPI needs additional work
• I2C is limited by slave address of 8 bits

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 22


Serial Communication Standards
SPI - I2C comparison
Throughput
• SPI is full duplex, no limit on speed.
Speed can be up to 10 Mbps
• I2C is not full duplex,
Speed is limited to 1 Mbps for fast mode+
3.4 Mbps for High speed mode.
• I2C has advanced features such as multi-master
conflict handling, built-in address management
• SPI is very easy to understand and to implement,
and offers flexibility
04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 23
Serial Communication Standards
USB –Universal Serial Bus
• Set of interface specifications for high speed wired
communication between electronics systems
peripherals and devices with or without
PC/computer.
• Originally developed in 1995 by many of the industry
leading companies like Intel, Compaq, Microsoft,
Digital, IBM, and Northern Telecom.

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 24


Serial Communication Standards
USB –Universal Serial Bus
The major goal of USB was to define an external
expansion bus to add peripherals to a PC in easy and
simple manner.

The new external expansion architecture, highlights,


1. PC host controller hardware and software
2. Robust connectors and cable assemblies
3. Peripheral friendly master-slave protocols
4. Expandable through multi-port hubs.

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 25


Serial Communication Standards
USB – Universal Serial Bus
• USB offers users simple connectivity.
• It eliminates the mix of different connectors for
different devices like printers, keyboards, mice, and
other peripherals.
• USB-bus allows many peripherals to be connected
using a single standardized interface socket.
• In USB environment, DIP-switches are not necessary
for setting peripheral addresses and IRQs.
• It supports all kinds of data, from slow mouse inputs
to digitized audio and compressed video.
04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 26
Serial Communication Standards
USB –Universal Serial Bus
• USB allows hotswapping
• Devices can be plugged in and unplugged without
turning off the devices.
USB Logo

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 27


Serial Communication Standards
USB –Universal Serial Bus
• USB already replaced RS232
• Most successful serial interconnect in PC and
consumer electronics
• Used to connect devices such as mouse, keyboard,
PDA, printer, scanner, etc.
• USB sends data in serial mode
i.e. the parallel data is serialized before sending and
de-serialized after receiving.

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 28


Serial Communication Standards
USB –Universal Serial Bus
The benefits of USB
• Low cost
• Expandability
• Auto-configuration
• Hot-plugging
• Outstanding performance.
• Also provides power to the bus, enabling many
peripherals to operate without the added need for
an ac power adapter.
04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 29
Serial Communication Standards
USB –Universal Serial Bus
Versions of USB:
• USB 1.0
Original release, 12 Mbps, 127 devices
• USB 1.1 – Full-speed USB
Rectify adoption problems with hubs
• USB 2.0 – Hi-speed USB
Data rate upto 480 Mbps
Support low-bandwidth devices – mice, etc. and
high-bandwidth devices – webcams, scanners, etc.

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 30


Serial Communication Standards
USB –Universal Serial Bus
Versions of USB:
• USB 3.0
Super-Speed USB having a data transfer rate of
4.8 Gbit/s (600 MB/s).

04/18/25
April 4, 2016 MPMC-G.Krishna
MPMC- Reddy
Moorthy Muthukrishnan Unit
UnitIVSession
Part 21 31
Serial Communication Standards
USB – System overview

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 32


Serial Communication Standards
USB –Universal Serial Bus
• The USB system is made up of a host, multiple
numbers of USB ports, and multiple peripheral
devices connected in a tiered-star topology.
• To expand the number of USB ports, the USB hubs
can be included in the tiers, allowing branching into
a tree structure with up to five tier levels.
• Addressable bus system, with a seven-bit address
code. So it can support up to 127 different devices
or nodes at once.

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 33


Serial Communication Standards
USB –Connectors and power supply

Type A connectors head upstream Type B connectors head downstream


toward the computer and connect to individual devices

Cable length : 5 meters for 12 Mbps, 3 m for 1.5 Mbps

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 34


Serial Communication Standards
USB –Connectors and power supply

Pin No: Signal Color of the cable


1 +5V power Red
2 - Data White / Yellow
3 +Data Green / Blue
4 Ground Black/Brown
04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 35
Serial Communication Standards
USB –Connectors and power supply
• 4 wires
• +5V, GND
• 2 wires (twisted pair) carry data
• Can supply upto 500 mA
• Devices can draw up to 100 mA
• For device drawing > 500 mA, need to have own
power supply

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 36


Serial Communication Standards
USB
• The serial data is sent along the USB in differential
or push-pull mode, with opposite polarities
on the two signal lines.
• This improves the signal-to-noise ratio by doubling
the effective signal amplitude and also allowing
the cancellation of any common-mode noise
induced into the cable.
• The data is sent in non-return-to-zero (NRTZ)
format.

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 37


Serial Communication Standards
USB – Data transfer Process
• The USB connectors are designed so that power and ground
are applied before the signal lines are connected.
• When the Host powers up it polls each of the Slave devices
in turn (using the reserved address 0), it assigns each one a
unique address and finds out from each device what its
Speed is and the and type of data transfer it wishes to
perform.
• This process is called enumeration and it also takes place
whenever a device is plugged into an active network.
• The connectors design (contact to power then signal) along
with the process of enumeration and a lot of host software
allows devices to be described as "Plug-and-Play".

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 38


Serial Communication Standards
USB – Data transfer Process
• A typical transaction will consist of a number of packets
- A token indicating the type of data that the Host is sending
or requiring, the data and in some cases an
acknowledgment.
• Each packet is preceded by a sync field and followed by
an end of packet marker.
These transactions are used to provide
four basic data transfer mechanisms
Control
• Used by the host to send commands or query parameters.
• Packet lengths are 8 bytes for Low speed, 8-64 bytes for
Full speed and 64 bytes for High Speed devices.

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 39


Serial Communication Standards
USB – Data transfer Process
Interrupt
• Badly named it is in fact a polled message from the Host
which has to request specific data of the Device.
• Used by Devices which will be sending small amounts of
data (e.g. mice or keyboards).
Bulk
• Used by Devices that send or receive data in quantity
such as a printer.
• Variable length blocks of data are sent or requested by the
Host (max length is 64-byte- full speed, 512 -high speed), are
verified with a CRC and their receipt is acknowledged.
• This mechanism is not used by time critical peripherals as it
takes whatever bandwidth is left by the other mechanisms.
04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 40
Serial Communication Standards
USB – Data transfer Process
Isochronous
• Used for devices that stream data in real time
without any error recovery such as audio channels.
• For them losing some data occasionally is better than
the glitch resulting from a retransmit.
• Packet sizes can be up to 1024 bytes.

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 41


Text Books
TEXT BOOKS:
1. Advanced Microprocessors and Peripherals – A. K.
Ray and K.M. Bhurchandi, Tata-McGraw Hill,
2nd edition 2006.
2. D. V. Hall, Microprocessors and Interfacing,
Tata-McGraw Hill, 2nd edition 2006.
3. Kenneth. J. Ayala, The 8051 microcontroller ,
3rd edition, Cengage learning, 2010
4. Microprocessors and Microcontrollers, Lyla B.Das,
Pearson, 2012

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 42


References
REFERENCES:
1. The 8051 Microcontrollers, Architecture and programming and
Applications -K. Uma Rao, Andhe Pallavi, Pearson, 2009.
2. The 8051 Microcontoller and Embedded Systems Using Assembly
and C, Second Edition, Muhammad Ali Mazidi, Janice Gillispie
Mazidi, Rolin D. McKinlay, Prentice Hall
3. Micro Computer System 8086/8088 Family Architecture,
Programming and Design - Liu and GA Gibson,
Prentice Hall India, 2nd Ed.
4. Microcontrollers and application, Ajay. V. Deshmukh,
Tata-McGraw Hill, 2005
5. The 8085 Microprocessor: Architecture, programming and
Interfacing – K. Uday Kumar, B.S. Umashankar, 2008, Pearson

04/18/25 MPMC-G.Krishna Reddy Unit I Session 1 43

You might also like