SlideShare a Scribd company logo
1 of 46
1
EECS 373
Design of Microprocessor-Based Systems
Prabal Dutta
University of Michigan
Serial buses
Some material from: Brehob, Le, Ramadas, Tikhonov & Mahal
This Week: Serial interfaces
2
Timers
CPU
Software
Hardware
Internal
External
System Buses
AHB/APB
ldr (read)
str (write)
ISA
EECS 370
USART DAC/ADC
Internal &
External
Memory
GPIO/INT
C
Assembly
Machine Code
Interrupts
interrupts
SVC#
fault
traps &
exceptions
INT#
3
Outline
• Introduction to Serial Buses
• UART
• SPI
• I2C
4
Serial bus interface motivations
• Motivation
– Connect different systems together
• Two embedded systems
• A desktop and an embedded system
– Connect different chips together in the same embedded system
• MCU to peripheral
• MCU to MCU
– Without using a lot of I/O lines
• I/O lines require I/O pads which cost $$$ and size
• I/O lines require PCB area which costs $$$ and size
– Often at relatively low data rates
– But sometimes at higher data rates
• So, what are our options?
– Universal Synchronous/Asynchronous Receiver Transmitter
– Also known as USART (pronounced: “you-zart”)
5
Serial bus design space
• Number of wires required?
• Asynchronous or synchronous?
• How fast can it transfer data?
• Can it support more than two endpoints?
• Can it support more than one master (i.e. txn initiator)?
• How do we support flow control?
• How does it handle errors/noise?
Fun with buses
• A multidrop bus (MDB) is a computer bus in
which all components are connected to the same
set of electrical wires. (from Wikipedia)
– In the general case, a bus may have more than one
device capable of driving it.
• That is, it may be a “multi-master” bus as discussed
earlier.
How can we handle multiple (potential) bus drivers?
(1/3)
• Tri-state devices, just have
one device drive at a time.
Everyone can read though
– Pros:
• Very common, fairly fast, pin-
efficient.
– Cons:
• Tri-state devices can be slow.
– Especially drive-to-tristate?
• Need to be sure two folks not driving at the same time
– Let out the magic smoke.
– Most common solution (at least historically)
• Ethernet, PCI, etc.
How can we handle multiple (potential) bus drivers?
(2/3)
• MUX
– Just have each device generate its data, and have a
MUX select.
• That’s a LOT of pins.
– Consider a 32-bit bus with 6 potential drivers.
» Draw the figure.
» How many pins needed for the MUX?
– Not generally realistic for an “on-PCB” design as we’ll
need an extra device (or a lot of pins on one device)
• But reasonable on-chip
– In fact AHB, APB do this.
How can we handle multiple (potential) bus drivers?
(3/3)
• “pull-up” aka “open
collector” aka “wired OR”
– Wire is pulled high by a
resistor
– If any device pulls the
wire low, it goes low.
• Pros:
– If two devices both drive
the bus, it still works!
• Cons:
– Rise-time is very slow.
– Constant power drain.
• Used in I2C, CAN
10
Outline
• Introduction to Serial Buses
• UART
• SPI
• I2C
UART
• Universal Asynchronous Receiver/Transmitter
• Hardware that translates between parallel and serial forms
• Commonly used in conjunction with communication
standards such as EIA, RS-232, RS-422 or RS-485
• The universal designation indicates that the data format
and transmission speeds are configurable and that the
actual electric signaling levels and methods (such as
differential signaling etc.) typically are handled by a
special driver circuit external to the UART.
11
Most of the UART stuff (including images) Taken from Wikipedia!
Protocol
• Each character is sent as
– a logic low start bit
– a configurable number of data bits (usually 7 or 8,
sometimes 5)
– an optional parity bit
– one or more logic high stop bits
– with a particular bit timing (“baud”)
• Examples
– “9600-N-8-1”  <baudrate><parity><databits><stopbits>
– “9600-8-N-1”  <baudrate><databits><parity><stopbits>
12
Variations and fun times
• UART is actually a generic term that includes a
large number of different devices/standards.
– RS-232 is a standard that specifies
• “electrical characteristics and timing of signals, the
meaning of signals, and the physical size and pin
out of connectors.
13
Signals (only most common)
• The RXD signal of a UART is the signal receiving the data. This will
be an input and is usually connected to the TXD line of the
downstream device.
• The TXD signal of a UART is the signal transmitting the data. This
will be an output and is usually connected to the RXD line of the
downstream device.
• The RTS# (Ready to Send) signal of a UART is used to indicate to
the downstream device that the device is ready to receive data.
This will be an output and is usually connected to the CTS# line of
the downstream device.
• The CTS# (Clear to Send) signal of a UART is used by the
downstream device to identify that it is OK to transmit data to
the upsteam device. This will be an input and is usually connected
to the RTS# line of the upstream device.
14
15
DB9 stuff
• DTE vs DCE
• Pinout of a DCE?
• Common ground?
• Noise effects?
Wiring a DTE device to a DCE device for communication is easy.
The pins are a one-to-one connection, meaning all wires go from pin x to pin x.
A straight through cable is commonly used for this application.
In contrast, wiring two DTE devices together requires crossing the transmit and receive wires.
This cable is known as a null modem or crossover cable.
16
RS-232 transmission example
Discussion Questions
• How fast can we run a UART?
• What are the limitations?
• Why do we need start/stop bits?
• How many data bits can be sent?
– 9600-8-N-1 is ok. Is 9600-8192-N-1 ok too?
17
18
Outline
• Introduction to Serial Buses
• UART
• SPI
• I2C
Introduction
 What is it?
 Basic Serial Peripheral Interface (SPI)
 Capabilities
 Protocol
 Pro / Cons and Competitor
 Uses
 Conclusion
Serial Peripheral Interface
http://upload.wikimedia.org/wikipedia/commons/thumb/e/ed/
SPI_single_slave.svg/350px-SPI_single_slave.svg.png
What is SPI?
• Serial Bus protocol
• Fast, Easy to use, Simple
• Everyone supports it
SPI Basics
 A communication protocol using 4 wires
 Also known as a 4 wire bus
 Used to communicate across small
distances
 Multiple Slaves, Single Master
 Synchronized
Capabilities of SPI
 Always Full Duplex
 Communicating in two directions at the
same time
 Transmission need not be meaningful
 Multiple Mbps transmission speed
 Transfers data in 4 to 16 bit characters
 Multiple slaves
 Daisy-chaining possible
Protocol
 Wires:
 Master Out Slave In (MOSI)
 Master In Slave Out (MISO)
 System Clock (SCLK)
 Slave Select 1…N
 Master Set Slave Select low
 Master Generates Clock
 Shift registers shift in and out data
Wires in Detail
 MOSI – Carries data out of Master to
Slave
 MISO – Carries data from Slave to
Master
 Both signals happen for every transmission
 SS_BAR – Unique line to select a slave
 SCLK – Master produced clock to
synchronize data transfer
Shifting Protocol
Master shifts out data to Slave, and shift in data from Slave
http://upload.wikimedia.org/wikipedia/commons/thumb/b/bb/SPI_8-bit_circular_transfer.svg/400px-SPI_8-bit_circular_transfer.svg.png
Diagram
Master and multiple independent
slaves
http://upload.wikimedia.org/wikipedia/commons/thumb/f/fc/SPI_three_sla
ves.svg/350px-SPI_three_slaves.svg.png
Master and multiple daisy-
chained slaves
http://www.maxim-ic.com/appnotes.cfm/an_pk/3947
Some wires have been renamed
Clock Phase (Advanced)
 Two phases and two polarities of clock
 Four modes
 Master and selected slave must be in
same mode
 Master must change polarity and phase
to communicate with slaves of different
numbers
Timing Diagram
Timing Diagram – Showing Clock polarities and phases
http://www.maxim-ic.com.cn/images/appnotes/3078/3078Fig02.gif
Pros and Cons
Pros:
 Fast and easy
 Fast for point-to-point connections
 Easily allows streaming/Constant data inflow
 No addressing/Simple to implement
 Everyone supports it
Cons:
 SS makes multiple slaves very complicated
 No acknowledgement ability
 No inherent arbitration
 No flow control
Uses
 Some Serial Encoders/Decoders,
Converters, Serial LCDs, Sensors, etc.
 Pre-SPI serial devices
Summary
 SPI – 4 wire serial bus protocol
 MOSI MISO SS SCLK wires
 Full duplex
 Multiple slaves, One master
 Best for point-to-point streaming data
 Easily Supported
32
Outline
• Introduction to Serial Buses
• UART
• SPI
• I2C
What is I2C (or I2C)?
Where is it Used?
34
Basic Description
35
Electrical Wiring
36
Clock
37
A Basic I2C Transaction
38
A Basic I2C Transaction
39
Start Condition
40
Address Transmission
41
Data transmission
42
Stop Condition
43
Another look at I2C
44
Exercise: How fast can I2C run?
45
• How fast can you run it?
• Assumptions
– 0’s are driven
– 1’s are “pulled up”
• Some working figures
– Rp = 10 kΩ
– Ccap = 100 pF
– VDD = 5 V
– Vin_high = 3.5 V
• Recall for RC circuit
– Vcap(t) = VDD(1-e-t/τ)
– Where τ = RC
Exercise: Bus bit rate vs Useful data rate
46
• An I2C “transactions” involves the following bits
– <S><A6:A0><R/W><A><D7:D0><A><F>
• Which of these actually carries useful data?
– <S><A6:A0><R/W><A><D7:D0><A><F>
• So, if a bus runs at 400 kHz
– What is the clock period?
– What is the data throughput (i.e. data-bits/second)?
– What is the bus “efficiency”?

More Related Content

Similar to serial.ppt

Similar to serial.ppt (20)

Ch09 system administration
Ch09 system administration Ch09 system administration
Ch09 system administration
 
Ccna day4-140715152437-phpapp01
Ccna day4-140715152437-phpapp01Ccna day4-140715152437-phpapp01
Ccna day4-140715152437-phpapp01
 
Ccna day4
Ccna day4Ccna day4
Ccna day4
 
Ccna day4
Ccna day4Ccna day4
Ccna day4
 
CCNA PPT
CCNA PPTCCNA PPT
CCNA PPT
 
Ccna day4
Ccna day4Ccna day4
Ccna day4
 
Communication protocols
Communication protocolsCommunication protocols
Communication protocols
 
12429908.ppt
12429908.ppt12429908.ppt
12429908.ppt
 
communication interfaces-Embedded real time systems
communication interfaces-Embedded real time systemscommunication interfaces-Embedded real time systems
communication interfaces-Embedded real time systems
 
Microcontroller.pptx
Microcontroller.pptxMicrocontroller.pptx
Microcontroller.pptx
 
07 input output
07 input output07 input output
07 input output
 
Mpi unit i_8086_architectures
Mpi unit i_8086_architecturesMpi unit i_8086_architectures
Mpi unit i_8086_architectures
 
Introduction to embedded System.pptx
Introduction to embedded System.pptxIntroduction to embedded System.pptx
Introduction to embedded System.pptx
 
Embedded sysyetm components
Embedded sysyetm componentsEmbedded sysyetm components
Embedded sysyetm components
 
ccna-day4-switching_1234567890123456.pdf
ccna-day4-switching_1234567890123456.pdfccna-day4-switching_1234567890123456.pdf
ccna-day4-switching_1234567890123456.pdf
 
A guide to common automation terms
A guide to common automation termsA guide to common automation terms
A guide to common automation terms
 
Ec305.13 buses mgl
Ec305.13 buses mglEc305.13 buses mgl
Ec305.13 buses mgl
 
Ec305.13 buses mgl
Ec305.13 buses mglEc305.13 buses mgl
Ec305.13 buses mgl
 
What is Motherboard?
What is Motherboard?What is Motherboard?
What is Motherboard?
 
07 input output
07 input output07 input output
07 input output
 

Recently uploaded

Digamma / CertiCon Company Presentation
Digamma / CertiCon Company  PresentationDigamma / CertiCon Company  Presentation
Digamma / CertiCon Company PresentationMihajloManjak
 
John Deere 300 3029 4039 4045 6059 6068 Engine Operation and Service Manual
John Deere 300 3029 4039 4045 6059 6068 Engine Operation and Service ManualJohn Deere 300 3029 4039 4045 6059 6068 Engine Operation and Service Manual
John Deere 300 3029 4039 4045 6059 6068 Engine Operation and Service ManualExcavator
 
BLUE VEHICLES the kids picture show 2024
BLUE VEHICLES the kids picture show 2024BLUE VEHICLES the kids picture show 2024
BLUE VEHICLES the kids picture show 2024AHOhOops1
 
Call Girl Service Global Village Dubai +971509430017 Independent Call Girls G...
Call Girl Service Global Village Dubai +971509430017 Independent Call Girls G...Call Girl Service Global Village Dubai +971509430017 Independent Call Girls G...
Call Girl Service Global Village Dubai +971509430017 Independent Call Girls G...kexey39068
 
(办理学位证)(Toledo毕业证)托莱多大学毕业证成绩单修改留信学历认证原版一模一样
(办理学位证)(Toledo毕业证)托莱多大学毕业证成绩单修改留信学历认证原版一模一样(办理学位证)(Toledo毕业证)托莱多大学毕业证成绩单修改留信学历认证原版一模一样
(办理学位证)(Toledo毕业证)托莱多大学毕业证成绩单修改留信学历认证原版一模一样gfghbihg
 
VIP Kolkata Call Girl Kasba 👉 8250192130 Available With Room
VIP Kolkata Call Girl Kasba 👉 8250192130  Available With RoomVIP Kolkata Call Girl Kasba 👉 8250192130  Available With Room
VIP Kolkata Call Girl Kasba 👉 8250192130 Available With Roomdivyansh0kumar0
 
原版工艺美国普林斯顿大学毕业证Princeton毕业证成绩单修改留信学历认证
原版工艺美国普林斯顿大学毕业证Princeton毕业证成绩单修改留信学历认证原版工艺美国普林斯顿大学毕业证Princeton毕业证成绩单修改留信学历认证
原版工艺美国普林斯顿大学毕业证Princeton毕业证成绩单修改留信学历认证jjrehjwj11gg
 
Digamma - CertiCon Team Skills and Qualifications
Digamma - CertiCon Team Skills and QualificationsDigamma - CertiCon Team Skills and Qualifications
Digamma - CertiCon Team Skills and QualificationsMihajloManjak
 
What Causes DPF Failure In VW Golf Cars & How Can They Be Prevented
What Causes DPF Failure In VW Golf Cars & How Can They Be PreventedWhat Causes DPF Failure In VW Golf Cars & How Can They Be Prevented
What Causes DPF Failure In VW Golf Cars & How Can They Be PreventedAutobahn Automotive Service
 
(8264348440) 🔝 Call Girls In Shaheen Bagh 🔝 Delhi NCR
(8264348440) 🔝 Call Girls In Shaheen Bagh 🔝 Delhi NCR(8264348440) 🔝 Call Girls In Shaheen Bagh 🔝 Delhi NCR
(8264348440) 🔝 Call Girls In Shaheen Bagh 🔝 Delhi NCRsoniya singh
 
UNIT-IV-STEERING, BRAKES AND SUSPENSION SYSTEMS.pptx
UNIT-IV-STEERING, BRAKES AND SUSPENSION SYSTEMS.pptxUNIT-IV-STEERING, BRAKES AND SUSPENSION SYSTEMS.pptx
UNIT-IV-STEERING, BRAKES AND SUSPENSION SYSTEMS.pptxDineshKumar4165
 
原版1:1定制中央昆士兰大学毕业证(CQU毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制中央昆士兰大学毕业证(CQU毕业证)#文凭成绩单#真实留信学历认证永久存档原版1:1定制中央昆士兰大学毕业证(CQU毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制中央昆士兰大学毕业证(CQU毕业证)#文凭成绩单#真实留信学历认证永久存档208367051
 
2024 TOP 10 most fuel-efficient vehicles according to the US agency
2024 TOP 10 most fuel-efficient vehicles according to the US agency2024 TOP 10 most fuel-efficient vehicles according to the US agency
2024 TOP 10 most fuel-efficient vehicles according to the US agencyHyundai Motor Group
 
如何办理(Flinders毕业证)查理斯特大学毕业证毕业证成绩单原版一比一
如何办理(Flinders毕业证)查理斯特大学毕业证毕业证成绩单原版一比一如何办理(Flinders毕业证)查理斯特大学毕业证毕业证成绩单原版一比一
如何办理(Flinders毕业证)查理斯特大学毕业证毕业证成绩单原版一比一ypfy7p5ld
 
( Best ) Genuine Call Girls In Mandi House =DELHI-| 8377087607
( Best ) Genuine Call Girls In Mandi House =DELHI-| 8377087607( Best ) Genuine Call Girls In Mandi House =DELHI-| 8377087607
( Best ) Genuine Call Girls In Mandi House =DELHI-| 8377087607dollysharma2066
 
UNIT-III-TRANSMISSION SYSTEMS REAR AXLES
UNIT-III-TRANSMISSION SYSTEMS REAR AXLESUNIT-III-TRANSMISSION SYSTEMS REAR AXLES
UNIT-III-TRANSMISSION SYSTEMS REAR AXLESDineshKumar4165
 
如何办理(UQ毕业证书)昆士兰大学毕业证毕业证成绩单原版一比一
如何办理(UQ毕业证书)昆士兰大学毕业证毕业证成绩单原版一比一如何办理(UQ毕业证书)昆士兰大学毕业证毕业证成绩单原版一比一
如何办理(UQ毕业证书)昆士兰大学毕业证毕业证成绩单原版一比一hnfusn
 
FULL ENJOY - 9953040155 Call Girls in Sector 61 | Noida
FULL ENJOY - 9953040155 Call Girls in Sector 61 | NoidaFULL ENJOY - 9953040155 Call Girls in Sector 61 | Noida
FULL ENJOY - 9953040155 Call Girls in Sector 61 | NoidaMalviyaNagarCallGirl
 
(办理学位证)墨尔本大学毕业证(Unimelb毕业证书)成绩单留信学历认证原版一模一样
(办理学位证)墨尔本大学毕业证(Unimelb毕业证书)成绩单留信学历认证原版一模一样(办理学位证)墨尔本大学毕业证(Unimelb毕业证书)成绩单留信学历认证原版一模一样
(办理学位证)墨尔本大学毕业证(Unimelb毕业证书)成绩单留信学历认证原版一模一样whjjkkk
 

Recently uploaded (20)

Digamma / CertiCon Company Presentation
Digamma / CertiCon Company  PresentationDigamma / CertiCon Company  Presentation
Digamma / CertiCon Company Presentation
 
John Deere 300 3029 4039 4045 6059 6068 Engine Operation and Service Manual
John Deere 300 3029 4039 4045 6059 6068 Engine Operation and Service ManualJohn Deere 300 3029 4039 4045 6059 6068 Engine Operation and Service Manual
John Deere 300 3029 4039 4045 6059 6068 Engine Operation and Service Manual
 
BLUE VEHICLES the kids picture show 2024
BLUE VEHICLES the kids picture show 2024BLUE VEHICLES the kids picture show 2024
BLUE VEHICLES the kids picture show 2024
 
Call Girl Service Global Village Dubai +971509430017 Independent Call Girls G...
Call Girl Service Global Village Dubai +971509430017 Independent Call Girls G...Call Girl Service Global Village Dubai +971509430017 Independent Call Girls G...
Call Girl Service Global Village Dubai +971509430017 Independent Call Girls G...
 
sauth delhi call girls in Connaught Place🔝 9953056974 🔝 escort Service
sauth delhi call girls in  Connaught Place🔝 9953056974 🔝 escort Servicesauth delhi call girls in  Connaught Place🔝 9953056974 🔝 escort Service
sauth delhi call girls in Connaught Place🔝 9953056974 🔝 escort Service
 
(办理学位证)(Toledo毕业证)托莱多大学毕业证成绩单修改留信学历认证原版一模一样
(办理学位证)(Toledo毕业证)托莱多大学毕业证成绩单修改留信学历认证原版一模一样(办理学位证)(Toledo毕业证)托莱多大学毕业证成绩单修改留信学历认证原版一模一样
(办理学位证)(Toledo毕业证)托莱多大学毕业证成绩单修改留信学历认证原版一模一样
 
VIP Kolkata Call Girl Kasba 👉 8250192130 Available With Room
VIP Kolkata Call Girl Kasba 👉 8250192130  Available With RoomVIP Kolkata Call Girl Kasba 👉 8250192130  Available With Room
VIP Kolkata Call Girl Kasba 👉 8250192130 Available With Room
 
原版工艺美国普林斯顿大学毕业证Princeton毕业证成绩单修改留信学历认证
原版工艺美国普林斯顿大学毕业证Princeton毕业证成绩单修改留信学历认证原版工艺美国普林斯顿大学毕业证Princeton毕业证成绩单修改留信学历认证
原版工艺美国普林斯顿大学毕业证Princeton毕业证成绩单修改留信学历认证
 
Digamma - CertiCon Team Skills and Qualifications
Digamma - CertiCon Team Skills and QualificationsDigamma - CertiCon Team Skills and Qualifications
Digamma - CertiCon Team Skills and Qualifications
 
What Causes DPF Failure In VW Golf Cars & How Can They Be Prevented
What Causes DPF Failure In VW Golf Cars & How Can They Be PreventedWhat Causes DPF Failure In VW Golf Cars & How Can They Be Prevented
What Causes DPF Failure In VW Golf Cars & How Can They Be Prevented
 
(8264348440) 🔝 Call Girls In Shaheen Bagh 🔝 Delhi NCR
(8264348440) 🔝 Call Girls In Shaheen Bagh 🔝 Delhi NCR(8264348440) 🔝 Call Girls In Shaheen Bagh 🔝 Delhi NCR
(8264348440) 🔝 Call Girls In Shaheen Bagh 🔝 Delhi NCR
 
UNIT-IV-STEERING, BRAKES AND SUSPENSION SYSTEMS.pptx
UNIT-IV-STEERING, BRAKES AND SUSPENSION SYSTEMS.pptxUNIT-IV-STEERING, BRAKES AND SUSPENSION SYSTEMS.pptx
UNIT-IV-STEERING, BRAKES AND SUSPENSION SYSTEMS.pptx
 
原版1:1定制中央昆士兰大学毕业证(CQU毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制中央昆士兰大学毕业证(CQU毕业证)#文凭成绩单#真实留信学历认证永久存档原版1:1定制中央昆士兰大学毕业证(CQU毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制中央昆士兰大学毕业证(CQU毕业证)#文凭成绩单#真实留信学历认证永久存档
 
2024 TOP 10 most fuel-efficient vehicles according to the US agency
2024 TOP 10 most fuel-efficient vehicles according to the US agency2024 TOP 10 most fuel-efficient vehicles according to the US agency
2024 TOP 10 most fuel-efficient vehicles according to the US agency
 
如何办理(Flinders毕业证)查理斯特大学毕业证毕业证成绩单原版一比一
如何办理(Flinders毕业证)查理斯特大学毕业证毕业证成绩单原版一比一如何办理(Flinders毕业证)查理斯特大学毕业证毕业证成绩单原版一比一
如何办理(Flinders毕业证)查理斯特大学毕业证毕业证成绩单原版一比一
 
( Best ) Genuine Call Girls In Mandi House =DELHI-| 8377087607
( Best ) Genuine Call Girls In Mandi House =DELHI-| 8377087607( Best ) Genuine Call Girls In Mandi House =DELHI-| 8377087607
( Best ) Genuine Call Girls In Mandi House =DELHI-| 8377087607
 
UNIT-III-TRANSMISSION SYSTEMS REAR AXLES
UNIT-III-TRANSMISSION SYSTEMS REAR AXLESUNIT-III-TRANSMISSION SYSTEMS REAR AXLES
UNIT-III-TRANSMISSION SYSTEMS REAR AXLES
 
如何办理(UQ毕业证书)昆士兰大学毕业证毕业证成绩单原版一比一
如何办理(UQ毕业证书)昆士兰大学毕业证毕业证成绩单原版一比一如何办理(UQ毕业证书)昆士兰大学毕业证毕业证成绩单原版一比一
如何办理(UQ毕业证书)昆士兰大学毕业证毕业证成绩单原版一比一
 
FULL ENJOY - 9953040155 Call Girls in Sector 61 | Noida
FULL ENJOY - 9953040155 Call Girls in Sector 61 | NoidaFULL ENJOY - 9953040155 Call Girls in Sector 61 | Noida
FULL ENJOY - 9953040155 Call Girls in Sector 61 | Noida
 
(办理学位证)墨尔本大学毕业证(Unimelb毕业证书)成绩单留信学历认证原版一模一样
(办理学位证)墨尔本大学毕业证(Unimelb毕业证书)成绩单留信学历认证原版一模一样(办理学位证)墨尔本大学毕业证(Unimelb毕业证书)成绩单留信学历认证原版一模一样
(办理学位证)墨尔本大学毕业证(Unimelb毕业证书)成绩单留信学历认证原版一模一样
 

serial.ppt

  • 1. 1 EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan Serial buses Some material from: Brehob, Le, Ramadas, Tikhonov & Mahal
  • 2. This Week: Serial interfaces 2 Timers CPU Software Hardware Internal External System Buses AHB/APB ldr (read) str (write) ISA EECS 370 USART DAC/ADC Internal & External Memory GPIO/INT C Assembly Machine Code Interrupts interrupts SVC# fault traps & exceptions INT#
  • 3. 3 Outline • Introduction to Serial Buses • UART • SPI • I2C
  • 4. 4 Serial bus interface motivations • Motivation – Connect different systems together • Two embedded systems • A desktop and an embedded system – Connect different chips together in the same embedded system • MCU to peripheral • MCU to MCU – Without using a lot of I/O lines • I/O lines require I/O pads which cost $$$ and size • I/O lines require PCB area which costs $$$ and size – Often at relatively low data rates – But sometimes at higher data rates • So, what are our options? – Universal Synchronous/Asynchronous Receiver Transmitter – Also known as USART (pronounced: “you-zart”)
  • 5. 5 Serial bus design space • Number of wires required? • Asynchronous or synchronous? • How fast can it transfer data? • Can it support more than two endpoints? • Can it support more than one master (i.e. txn initiator)? • How do we support flow control? • How does it handle errors/noise?
  • 6. Fun with buses • A multidrop bus (MDB) is a computer bus in which all components are connected to the same set of electrical wires. (from Wikipedia) – In the general case, a bus may have more than one device capable of driving it. • That is, it may be a “multi-master” bus as discussed earlier.
  • 7. How can we handle multiple (potential) bus drivers? (1/3) • Tri-state devices, just have one device drive at a time. Everyone can read though – Pros: • Very common, fairly fast, pin- efficient. – Cons: • Tri-state devices can be slow. – Especially drive-to-tristate? • Need to be sure two folks not driving at the same time – Let out the magic smoke. – Most common solution (at least historically) • Ethernet, PCI, etc.
  • 8. How can we handle multiple (potential) bus drivers? (2/3) • MUX – Just have each device generate its data, and have a MUX select. • That’s a LOT of pins. – Consider a 32-bit bus with 6 potential drivers. » Draw the figure. » How many pins needed for the MUX? – Not generally realistic for an “on-PCB” design as we’ll need an extra device (or a lot of pins on one device) • But reasonable on-chip – In fact AHB, APB do this.
  • 9. How can we handle multiple (potential) bus drivers? (3/3) • “pull-up” aka “open collector” aka “wired OR” – Wire is pulled high by a resistor – If any device pulls the wire low, it goes low. • Pros: – If two devices both drive the bus, it still works! • Cons: – Rise-time is very slow. – Constant power drain. • Used in I2C, CAN
  • 10. 10 Outline • Introduction to Serial Buses • UART • SPI • I2C
  • 11. UART • Universal Asynchronous Receiver/Transmitter • Hardware that translates between parallel and serial forms • Commonly used in conjunction with communication standards such as EIA, RS-232, RS-422 or RS-485 • The universal designation indicates that the data format and transmission speeds are configurable and that the actual electric signaling levels and methods (such as differential signaling etc.) typically are handled by a special driver circuit external to the UART. 11 Most of the UART stuff (including images) Taken from Wikipedia!
  • 12. Protocol • Each character is sent as – a logic low start bit – a configurable number of data bits (usually 7 or 8, sometimes 5) – an optional parity bit – one or more logic high stop bits – with a particular bit timing (“baud”) • Examples – “9600-N-8-1”  <baudrate><parity><databits><stopbits> – “9600-8-N-1”  <baudrate><databits><parity><stopbits> 12
  • 13. Variations and fun times • UART is actually a generic term that includes a large number of different devices/standards. – RS-232 is a standard that specifies • “electrical characteristics and timing of signals, the meaning of signals, and the physical size and pin out of connectors. 13
  • 14. Signals (only most common) • The RXD signal of a UART is the signal receiving the data. This will be an input and is usually connected to the TXD line of the downstream device. • The TXD signal of a UART is the signal transmitting the data. This will be an output and is usually connected to the RXD line of the downstream device. • The RTS# (Ready to Send) signal of a UART is used to indicate to the downstream device that the device is ready to receive data. This will be an output and is usually connected to the CTS# line of the downstream device. • The CTS# (Clear to Send) signal of a UART is used by the downstream device to identify that it is OK to transmit data to the upsteam device. This will be an input and is usually connected to the RTS# line of the upstream device. 14
  • 15. 15 DB9 stuff • DTE vs DCE • Pinout of a DCE? • Common ground? • Noise effects? Wiring a DTE device to a DCE device for communication is easy. The pins are a one-to-one connection, meaning all wires go from pin x to pin x. A straight through cable is commonly used for this application. In contrast, wiring two DTE devices together requires crossing the transmit and receive wires. This cable is known as a null modem or crossover cable.
  • 17. Discussion Questions • How fast can we run a UART? • What are the limitations? • Why do we need start/stop bits? • How many data bits can be sent? – 9600-8-N-1 is ok. Is 9600-8192-N-1 ok too? 17
  • 18. 18 Outline • Introduction to Serial Buses • UART • SPI • I2C
  • 19. Introduction  What is it?  Basic Serial Peripheral Interface (SPI)  Capabilities  Protocol  Pro / Cons and Competitor  Uses  Conclusion Serial Peripheral Interface http://upload.wikimedia.org/wikipedia/commons/thumb/e/ed/ SPI_single_slave.svg/350px-SPI_single_slave.svg.png
  • 20. What is SPI? • Serial Bus protocol • Fast, Easy to use, Simple • Everyone supports it
  • 21. SPI Basics  A communication protocol using 4 wires  Also known as a 4 wire bus  Used to communicate across small distances  Multiple Slaves, Single Master  Synchronized
  • 22. Capabilities of SPI  Always Full Duplex  Communicating in two directions at the same time  Transmission need not be meaningful  Multiple Mbps transmission speed  Transfers data in 4 to 16 bit characters  Multiple slaves  Daisy-chaining possible
  • 23. Protocol  Wires:  Master Out Slave In (MOSI)  Master In Slave Out (MISO)  System Clock (SCLK)  Slave Select 1…N  Master Set Slave Select low  Master Generates Clock  Shift registers shift in and out data
  • 24. Wires in Detail  MOSI – Carries data out of Master to Slave  MISO – Carries data from Slave to Master  Both signals happen for every transmission  SS_BAR – Unique line to select a slave  SCLK – Master produced clock to synchronize data transfer
  • 25. Shifting Protocol Master shifts out data to Slave, and shift in data from Slave http://upload.wikimedia.org/wikipedia/commons/thumb/b/bb/SPI_8-bit_circular_transfer.svg/400px-SPI_8-bit_circular_transfer.svg.png
  • 26. Diagram Master and multiple independent slaves http://upload.wikimedia.org/wikipedia/commons/thumb/f/fc/SPI_three_sla ves.svg/350px-SPI_three_slaves.svg.png Master and multiple daisy- chained slaves http://www.maxim-ic.com/appnotes.cfm/an_pk/3947 Some wires have been renamed
  • 27. Clock Phase (Advanced)  Two phases and two polarities of clock  Four modes  Master and selected slave must be in same mode  Master must change polarity and phase to communicate with slaves of different numbers
  • 28. Timing Diagram Timing Diagram – Showing Clock polarities and phases http://www.maxim-ic.com.cn/images/appnotes/3078/3078Fig02.gif
  • 29. Pros and Cons Pros:  Fast and easy  Fast for point-to-point connections  Easily allows streaming/Constant data inflow  No addressing/Simple to implement  Everyone supports it Cons:  SS makes multiple slaves very complicated  No acknowledgement ability  No inherent arbitration  No flow control
  • 30. Uses  Some Serial Encoders/Decoders, Converters, Serial LCDs, Sensors, etc.  Pre-SPI serial devices
  • 31. Summary  SPI – 4 wire serial bus protocol  MOSI MISO SS SCLK wires  Full duplex  Multiple slaves, One master  Best for point-to-point streaming data  Easily Supported
  • 32. 32 Outline • Introduction to Serial Buses • UART • SPI • I2C
  • 33. What is I2C (or I2C)?
  • 34. Where is it Used? 34
  • 38. A Basic I2C Transaction 38
  • 39. A Basic I2C Transaction 39
  • 44. Another look at I2C 44
  • 45. Exercise: How fast can I2C run? 45 • How fast can you run it? • Assumptions – 0’s are driven – 1’s are “pulled up” • Some working figures – Rp = 10 kΩ – Ccap = 100 pF – VDD = 5 V – Vin_high = 3.5 V • Recall for RC circuit – Vcap(t) = VDD(1-e-t/τ) – Where τ = RC
  • 46. Exercise: Bus bit rate vs Useful data rate 46 • An I2C “transactions” involves the following bits – <S><A6:A0><R/W><A><D7:D0><A><F> • Which of these actually carries useful data? – <S><A6:A0><R/W><A><D7:D0><A><F> • So, if a bus runs at 400 kHz – What is the clock period? – What is the data throughput (i.e. data-bits/second)? – What is the bus “efficiency”?

Editor's Notes

  1. Figure from http://tek-electronics.blogspot.com/
  2. Image from http://www.cs.umd.edu/class/sum2003/cmsc311/Notes/CompOrg/tristate.html