290 likes | 351 Views
Explore the essential elements of USB communication layers, protocols, and transfer types. Learn about USB system software, logical device enumeration, and endpoint communication. Discover the protocols and packet formats involved in USB data transfer.
E N D
USB USB RECAP USB COMMUNICATION ELEMENTS USB COMMUNICATION LAYERS PHYISICAL LAYER PROTOCOL ENGINE LAYER APPLICATION LAYER USB PROTOCOL TRANSFER TYPE PACKET FORMAT
RECAP…. • USB – automatic attachment, configuration and detachment • Speed – low, high and full speed • Transfer type • Isochronous – Bandwidth guaranteed • Asynchronous – Bulk Transfer • USB protocol • Error detection and Recovery mechanism (low BER)
USB communication elements • Host – controls all activities in the bus • HUB – star topology • Attachment.detachment • Power management • Derror detection and correction • Full- low speed device connection • Device - not HOST!
USB communication layers contd.. • Physical layer • 4 wire cable (+d, -D, +v, GND) • Signalling – Little Endian • RESET • SUSPEND • RESUME • EOP • NRZ I Coding and Bit stuffing
Phsical layer contd. • Serial Interface Engine (SIE) • Part of both Host and device • Encoding (NRZ I), bit stuffing and vice versa • CRC • Detects PID, SOP, EOP, RESET and RESUME
Host Controller • Frame generation • Data Processing (request and response) • Protocol engine (HOST USB protocol interface) • Error handling
2.The protocol engine layer • Translates data between the application layer and function on device using USB transaction protocol • USB HOST – USB System software • USB device – USB logical device USB system software: • Host software: bandwidth allocation, bus enable, power mangaement
USB software system • Host control driver (HCD) • Interface to the Host controller • USB driver (USBD) • Send the IPRs to the Host software • Send the device description to the client software • Enumeration
USB Logical Device • Collection of End points • Each endpoint have unique address • Each device unique address after enumeration • End point Unidirectional • USB logical device address + End point number + direction IN/OUT = unique Endpoint • Enumeration default pipe + endpoint ‘0’ Control type
3. Application Layer • Client Software • Transfer data from buffer to endpoint associated with appropriate interface • Function • collection of interfaces
USB Protocol • USB Transaction • Token Phase – future transaction type • Data Phase – data transmission as indicated in the previous token • Handshake Phase – send Handshake packet – success or failure of the transaction • USB - polling Protocol • Handshake Mechanism , timeout rules ,CRC – low BER (10 -10)
Transfer types • Isochronous – Bandwidth gauranteed • Bulk – Bandwidth varies with the system resource • Interrupt – short term – interupts • Control – Enumeration Process
Packet field Formats • SYNC field • Start of each packet • Idle followed “KJKJKJKK” – NRZ I Encoding • K - ‘0’ / ‘1’ > 20 ms (Full speed/ High speed) • J – ‘1’ – one bit time • Synchronize the internal clock in the Device
PID (Packet Identifier) • Actual PID – 4 bits • I’s complement - 4 bits – error detection • PID groups • Token – IN, OUT, SOF SETUP • Data - data0 or data1 • Handshake – ACK, NAK, STALL
Address field • 7 bits • 127 device address • 0 reserved address
Frame, Data fields • Frame field • 11 bits only in SOF token • Indicates the number of the current frame • Data field • up to 1024 bytes
CRC field • Protect all fields • Absent in the PID • Token – 5 bits • Data – 16 bits
Packet formats • Token Packet • Start Of Frame Packet
Packet Formats Contd.. • Data Packets • Handshake Packets
Transaction Format • Control Transfer • SET_ADDRESS : setting a permanent address to a function. • GET_DEVICE_DESCRIPTOR: the host wishes to get the device descriptor, which contains details concerning the device - how many configurations, interfaces it has, is the device is self/ bus powered etc. • GET_CONFIGURATION_DESCRIPTOR: the host wishes to learn about a specific configuration of a device. • GET_CONFIGURATION: the host detects which configuration is active at the moment in the device. • SET_CONFIGURATION: the host sets a specific configuration on the device.
Bulk Transfer • IN transfer - in which the host asks for data from the device - data flow direction is from the device into the host. • OUT transfer - in which the host whishes to send data to the device - data flows from the host out to the device.
Reference • USB Explained by Steven McDowell & Martin D.Seyer 1999. • Universal Serial Bus Specification Revision 1.1 Sep 1998 (Compac, Intel, Microsoft, NEC)