Professional Documents
Culture Documents
Kuliah #10
TCK210 Teknik Interface dan Peripheral
Panjang kabel: 5m
Perlu hub agar lebih jauh
Pin USB (Standar)
Wikipedia.org
Kabel USB
Sinyal USB
● Jarak maksimal kabel 5 meter
● Skema enkoding: NRZI (non return to zero invert)
Receiver
Driver
Hub
P P
P
Hub
P P
P
Endpoints
Up to 32
endpoints
●
Endpoints are logical channels inside a
peripheral device
– Diidentifikasi dengan tuple (device_address,
endpoint_number)
●
In hardware they’re addressable buffers (FIFOS)
– Every host transfer includes a 4-bit endpoint number
and a direction bit
●
CONTROL endpoint 0 is mandatory
●
All others are up to the design
●
Endpoints are handy for separating data types
Kelas Device
Kelas Peripheral / Device
4 Tipe Transfer
●
Control
– Mission-critical, highest error protection
– Used to interrogate, configure and control devices
●
Bulk (easiest to use and the most flexible)
– Large, sporadic, use all remaining available bandwidth
– Ex: file transfer
●
Interrupt
– Guaranteed quick responses (bounded latency)
– Ex: pointing devices, keyboards
●
Isochronous
– Guaranteed data rate, but w/ possible data lost
– Ex: realtime audio or video
Frame Data USB (Cypress)
1 msec frame
...
SOF
SOF
Video Audio Mouse Control Printer Printer
PC PC
USB USB USB USB
Hub
Device Device Device
USB USB USB USB
Device Device
Hub: Memberikan Arus ke Device
PC PC Wall Wart
USB USB
USB USB
500 500
500 500
Hub Hub
Device Device
USB USB USB USB
USB USB USB USB
500 500
100 100
PC Wall Wart
USB USB
500 500
Hub
Device
USB USB USB USB USB USB USB
500 500 500
Class Driver
IRP
USB Driver
Transaction List
PC Simple Embedded
Implementasi PC
Apps or class drivers create IO
Application Request Packets (IRP)
USB Driver
Class Driver
• Processes IRP’s
IRP
• Manages CONTROL pipe
• Division of duties between USBD and HCD
USB Driver is not defined
Host Controller Driver (HCD)
Host Controller Driver • Provides abstraction
– Of host controller registers
Transaction List – Of data transfer specifics
• HCD creates a transaction list
– Schedule of transfers
Host Controller
Host Controller turns transaction list
into packets
Implementasi PC: Kompleks
App needs no knowledge of
Application
• Which host controller is installed
• USB signaling details
Class Driver
• Bus utilization details
IRP • Transaction lists
USB Driver
App talks to buffers in your device
using “pipes”
Host Controller Driver
Most of the HCD/HC complexity is due
to the flexible nature of USB
Transaction List
• 127 devices
• Devices appear and disappear at random
Host Controller
• Bandwidth must be fairly shared between
devices
Implementasi Embedded
Looks simple Application
The hardware is simple
But software is “low-level”
• Detect USB device attachment
• Detect speed
• Enumerate devices
• Suspend and resume devices
• Manage error recovery
• Generate USB resets
Host Controller
• Conduct transfers
Simple Embedded
RTOS Menjembatasi Host - Driver
Host Controller
Implementasi USB
USB Host/Device
USB On The Go (OTG), 2006
●
Connect two peripherals together
– PC is not required (but still
supported)
●
Allow peripherals to awaken each
other
– Session Request Protocol
(SRP)
● Allow devices to exchange the host role
– Host Negotiation Protocol (HNP)
● New OTG devices can tap into the existing 900 million
USB devices
USB On The Go (OTG)
●
Defines a new connector and cable
– “Mini-AB” receptacle
– Mini-A to Mini-B cable
– Cable establishes the default host
●
A-Device is the default host
●
Host turns on VBUS
●
Dual-role USB devices:
– Sometimes a peripheral, sometimes a host
– Must use the new AB connector
– Provide limited host capability
– Supply 8 mA (min) on VBUS
– Operate at full speed (high speed optional)
APLIKASI USB
USB Physical Hit Counter (AVRTiny)
http://www.bobhobby.com/2008/04/22/usb-physical-hit-counter-based-on-avr-attiny25/
Skematik
Kelas Peripheral / Device
USB Peripheral Dev Tools
Serial
Develop--Debug PC USB
Test USB
Full-speed USB
Development Board
Embedded Host
Serial
Develop--Debug PC USB
Test Host
Transfers
Add-on board
contains USB host
plus 4-port hub
Full-speed USB
Development Board