0% found this document useful (0 votes)
24 views44 pages

6b SerialIO Part 2

Uploaded by

mhasan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views44 pages

6b SerialIO Part 2

Uploaded by

mhasan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 44

ECE 485/585

Microprocessor System Design


Yuchen Huang

Maseeh College of Engineering


and Computer Science

Initial content copied verbatim from ECE 485/585 material


developed by Professor Mark G. Faust @ PSU ECE
Serial Buses
- Part 2
Serial Buses
• Bus Trends
• Clocking
• Line Codes
• Differential Signaling
• USB 2.0, USB 3.0

ECE 485/585: Serial Buses 3


USB
• Universal Serial Bus
– Need for new peripheral bus
• Inexpensive
• Capable of supporting wide range of devices
• Simple (no IRQ contention, etc)
• “Hot-pluggable” (plug and play)
– USB introduced 1995
• Compaq, Digital, IBM, Intel, Microsoft, NEC, Northern Telecom, later 25
companies
– USB 2.0 Finalized April 2000
• Fully backward compatible  implications!

LS Low Speed 1.5 Mbps


USB 1.X Low speed devices: keyboard, mice
FS Full Speed 12 Mbps
USB 2.0 HS High Speed 480 Mbps Higher speed devices: scanners
disks, CD/RW, flash storage

ECE 485/585: Serial Buses 4


USB – Flexible Peripheral Interface
• Tree Topology
– Point-to-point links
– Hubs (7 peripherals/hub)
– 127 devices maximum
– 5m maximum cable length
• Serial Interface
– LSB first
• Low power devices can be powered
through cable
– 100mA
– 500mA if permitted by host
• Isochronous
– Device can request guaranteed
bandwidth
• “Mission Critical” applications
• Audio, streaming video

ECE 485/585: Serial Buses 5


USB Interfaces
Through PCI Bus Integrated into I/O Controller Hub (SouthBridge)

ECE 485/585: Serial Buses 6


Tree Topology
• Host Controller
– Generates transactions
• Hubs
– Controls power to its ports
– Enables/disables ports
– Recognizes devices attached ports
– Reports status events associated with ports
(when requested by host)
• Devices

ECE 485/585: Serial Buses 7


USB 2.0 Connectors
Contact Signal Cable
• Standard A connectors Number Name Color

– USB cable to USB port 1 Vcc/VBus Red (Orange)


2 -Data White (Yellow)
– Most common
3 +Data Green (Grey)
– Cable attached to peripheral at other end
4 Ground Black (Blue, Brown)
• Standard B connectors
– USB cable to peripheral
– Used with detachable cables
• Mini connectors (A and B)
– 5th wire: ID signal (Gnd/NC for A/B)
– No longer being developed
• Micro connectors (A and B) “A” connection “B” connection “Mini B” connection
– Replace mini connectors upstream downstream downstream
– OTG (On The Go) devices to PC to peripheral to peripheral
– Micro A-B receptacle accepts micro-A or micro-B plugs
– Devices senses ID, behaves as host or peripheral
• Power contacts (1mm) longer than differential data contacts
– Ensure power prior to data contacts mating

ECE 485/585: Serial Buses 8


USB Signaling
• Differential and Single-Ended Receivers

When no device connected,


D+ and D- both low

When device attached, pull-up


D+ high (FS device)

D- high (LS device)

ECE 485/585: Serial Buses 9


FS Device Connection/Detection

• For FS devices, D+ is pulled up


– R for pulldown is 15KW
– R for pullup is 1.5KW
– V will be 90% of Vcc

ECE 485/585: Serial Buses 10


LS Device Connection/Detection

• For LS devices, D- is pulled up


– R for pulldown is 15KW
– R for pullup is 1.5KW
– V will be 90% of Vcc

ECE 485/585: Serial Buses 11


Device Disconnect

ECE 485/585: Serial Buses 12


Bus Idle State (J state)

Device Reset
High Speed: Both D- and D+ low

ECE 485/585: Serial Buses 13


High Speed Devices

ECE 485/585: Serial Buses 14


High Speed Device Connect
Initially connect as Full Speed devices
Then “chirp” K state awaiting KJ chirp
response from hub if hub is HS capable

ECE 485/585: Serial Buses 15


Power Up (Software Controlled)

ECE 485/585: Serial Buses 16


Layers and Logical Communication

ECE 485/585: Serial Buses 17


Endpoints

• Drivers communicate with device endpoints


• All devices must support endpoint 0 (control)
• Except for endpoint 0 all endpoints unidirectional
• Devices can implement multiple endpoints
• CD/ROM
– Endpoint for control
– Endpoint for writing data
– Endpoint for reading data
– Endpoint for reading audio
• Isochronous

ECE 485/585: Serial Buses 18


USB Devices Share “Frames”

ECE 485/585: Serial Buses 19


Transfer Types
• Control
– Used to transfer requests to devices
– Particular use for configuration
• Interrupt
– For traditionally interrupt-driven devices (e.g. keyboard)
– Actually implemented with polling
• Bulk
– Large blocks of data without transfer rate requirements (e.g. printer)
• Isochronous
– Data requiring constant delivery rate (e.g. audio, video-conferencing)
– No error checking (occasional bad data better than no or late data)
– During configuration devices indicate amount of guaranteed
bandwidth needed

ECE 485/585: Serial Buses 20


Transactions
• Transaction consists of multiple packets
– Token/Data/ACK
• Must complete in (micro) frame
• USB Client Driver
– Initiates transfers
– Using IRP (I/O Request Packet)
• USB Driver
– Breaks IRPs into transactions
– Achievable in single frame
– Transaction descriptors created
• Host Controller Driver
– Schedules transaction descriptors
– Using knowledge of devices
– Allocates to frames
• USB Host Controller
– Traverses transaction descriptors
– Serializes data
– Creates USB packets

ECE 485/585: Serial Buses 21


Transfer Descriptors
• USB Device Address
• Type of Transfer
• Direction of Transfer
• Speed of Device
• Address of Device Driver’s Buffer

ECE 485/585: Serial Buses 22


Frame Generation

ECE 485/585: Serial Buses 23


Frames and mFrames
1ms

125ms

Low Speed Mode Full Speed Mode High Speed Mode


1ms frames 1ms frames 125ms frames
1,500 bits per frame 12,000 bits per frame 60,000 bits per mframe
187.5 KB/s 1.5 MB/s 60 MB/s

ECE 485/585: Serial Buses 24


Microframes

ECE 485/585: Serial Buses 25


Host Controller Handles USB

ECE 485/585: Serial Buses 26


“Payload” Efficiency
Packet Details
How effectively is the available
bandwidth used to deliver data?
High Speed
Transfer Max Efficiency
Type Packet Size
Isochronous 1024 bytes ~96%
Interrupt 1024 bytes ~96%
Bulk 512 bytes ~90%
Control 64 bytes ~27%

Full Speed
Transfer Max Efficiency
Type Packet Size
Isochronous 1023 bytes ~99%
Isochronous 512 bytes ~98%
Isochronous 64 bytes ~86%
Other 64 bytes ~82%

ECE 485/585: Serial Buses 27


Start of Packet (SOP)
Sync

End of Packet (EOP)

ECE 485/585: Serial Buses 28


High Speed Start Of Packet

High Speed End Of Packet

ECE 485/585: Serial Buses 29


Packet Format
Packet Type ID (PID) determines packet type. Actually four bits. Second 4 bits are first
4 bits complemented (as error check)

ECE 485/585: Serial Buses 30


Packets
• Token packets
– Sent at beginning of transaction to specify target endpoint address
• Define type of transaction
– SOF (Start of Frame)
– IN (transfer from target USB device to system)
– OUT (transfer from system to target USB device)
– SETUP (start of control transfer)
• Data packets
– For data payload (follow token packets)
• Handshake packets
– Sent by device to acknowledge receipt of data
• ACK/NAK/NYET/STALL
• Special packets
– Pre-amble packets to enable low-speed ports prior to sending low-speed
packets
ECE 485/585: Serial Buses 31
Transactions
Isochronous transactions do
not use handshake packets

Data Toggle: Data sent in alternating DATA0 and DATA1 packets to facilitate error recovery.

1 OUT 2

3 DATA0 4 9 DATA1 10
Host Target Host Target
01 7 ACK 6 01 10 13 ACK 12 10
8 5 14 11

Host begins with toggle = 0, sends DATA0 packet Host with toggle = 1, sends DATA1 packet
Target (also toggle=0) is expecting DATA0 packet Target (also toggle=1) is expecting DATA1 packet
Target, receiving correct packet type, toggles & sends ACK Target, receiving correct packet type, toggles & sends ACK
Host, receiving ACK, toggles Host, receiving ACK, toggles
ECE 485/585: Serial Buses 32
Transactions – Data Packet Errors
1 OUT 2

3 DATA0 4 7 DATA0 8
Host Target Host Target
00 00 01 11 ACK 10 01
6 5 12 9

Host begins with toggle = 0, sends DATA0 packet Host retries with DATA0 packet
Target (also toggle=0) is expecting DATA0 packet Host and target consistent
Target detects errors in packet, ignores packet, discards data, maintains toggle = 0
Host, not receiving ACK, maintains toggle and retries…

Errors can also occur because ACK wasn’t received in specified number of bit times

ECE 485/585: Serial Buses 33


OUT transaction, bad ACK
1 OUT 2

3 DATA0 4
Host Target
00 7 ACK 6 01
8 5

Host begins with toggle = 0, sends DATA0 packet


Target (also toggle=0) is expecting DATA0 packet
Target, receiving correct packet type, toggles & sends ACK
Host fails to receive correct ACK handshake, doesn’t toggle

9 DATA0 10
Host Target
01 13 ACK 12 11
14 11

Host with toggle = 0, re-sends DATA0 packet


Target (toggle=1) expecting DATA1 packet, discards DATA0 packet,
maintains toggle, sends ACK
ECE 485/585: Serial Buses Host, receiving ACK, toggles, next transaction will use DATA1 packet 34
USB Features
• No arbitration!
– Everything controlled by host (master)
– Point-to-point with host as one point
– No device-to-device communication
• USB devices don’t use I/O or memory address space
– Memory used for buffers, descriptors
– Devices have “addresses” but not from I/O or memory space
• Error detection and correction
– CRC (16-bit for data packets, 5-bit for others)
– ACK, DATA0/DATA1
– Resend bad packets (unless isochronous)

ECE 485/585: Serial Buses 38


USB 3.0
• Status
– Introduced September 2007 at Intel Developer’s Forum
– Version 1.0 specification complete November 2008
– First consumer products certified in January 2010
• Introduces SuperSpeed Mode
– Preserves backwards compatibility
• USB 2.0 devices will work in USB 3.0 systems
– Forward compatible
• USB 3.0 devices will work in USB 2.0 systems
– Signaling similar to PCI-e 2.0
– Essentially adds second bus alongside USB 2.0
• 4.8 Gbps (5Gbps less overhead of 8b/10b)
• Two additional differential signal pairs (separate transmit/receive)
• Eliminate polling
• Additional power and ground
• Additional power available to devices
• Low power modes
ECE 485/585: Serial Buses 39
USB 3.0

ECE 485/585: Serial Buses 40


USB 2.0 Connectors
Contact Signal Cable
• Standard A connectors Number Name Color

– USB cable to USB port 1 Vcc/VBus Red (Orange)


2 -Data White (Yellow)
– Most common
3 +Data Green (Grey)
– Cable attached to peripheral at other end
4 Ground Black (Blue, Brown)
• Standard B connectors
– USB cable to peripheral
– Used with detachable cables
• Mini connectors (A and B)
– 5th wire: ID signal (Gnd/NC for A/B)
– No longer being developed
• Micro connectors (A and B) “A” connection “B” connection “Mini B” connection
– Replace mini connectors upstream downstream downstream
– OTG (On The Go) devices to PC to peripheral to peripheral
– Micro A-B receptacle accepts micro-A or micro-B plugs
– Devices senses ID, behaves as host or peripheral
• Power contacts (1mm) longer than differential data contacts
– Ensure power prior to data contacts mating

ECE 485/585: Serial Buses 41


USB 3.0 Connectors

USB 3.0
Standard-A plug
Works with USB 2.0
Standard-A receptacle

USB 3.0
Standard-B plug and receptacle
Receptacle can accept USB 2.0
plug

ECE 485/585: Serial Buses 42


USB 3.0 Signals

ECE 485/585: Serial Buses 43


USB 3.0

ECE 485/585: Serial Buses 44


USB 3.0
• Details
– 8b/10b encoding
– Spread spectrum clocking

ECE 485/585: Serial Buses 45


IEEE 1394
• Introduced 1995
• Apple FireWire, Sony iLink
• 400 Mbps
• Supports peer-to-peer communications
– Doesn’t require PC
• Consumer electronics
– e.g. Video camera to PC

ECE 485/585: Serial Buses 46


Comparison
Interface Introduced Speed
Serial Port 1960s 20 Kbps
Parallel Port 1981 1.1 Mbps
USB 1995 12 Mbps
FireWire (1394) 1995 400 Mbps
USB 2.0 2000 480 Mbps
FireWire 800 2001 850 Mbps
USB 3.0 2010 4.8 Gbps (bidir)
ECE 485/585: Serial Buses 47

You might also like