Outline: - USB Overview - USB Hardware Controllers - Architecture of an Embedded USB Device - USB Device Driver Architecture - Case Study of a USB Device Driver - Testing Strategies - Issues to consider - Conclusions | Design of a USB Device Driver Joe Flynn Questra Corporation jflynn@ 716 381-0260 Questra i Outline USB Overview USB Hardware Controllers Architecture of an Embedded USB Device USB Device Driver Architecture Case Study of a USB Device Driver Testing Strategies Issues to consider Conclusions Questra 2 1 USB Overview ä w Hardware Overview -Topology Protocol Characteristics -Packet Types -USB Transactions Enumeration -Enumeration States Examples of USB devices Qufstra 3 Hardware Overview Kbd Monitor PC 1 1 1 J Pen Mouse Speaker Mic Phone Physical Hardware View PC Kbd Monitor Phone Mouse Speaker Mic Logical Hardware View Topology - Tiered Star Distributes Connectivity Points - 127 logical connections up to 5 meters per segment - Up to 6 tiers Bus transactions - Speed 12Mbps aggregate sub-channel - Isochronous and Asynchronous - Media access controlled by host Configuration - Dynamic insertion-removal - Autoconfiguration on change Physical Layer - 2-wire differential signaling NRZI coded with bit stuffing - 4 pin connector 4 wire cable - Supply Sourcing 5V 4 Quëstra 2 The Transaction Protocol is Host Based Host based token polling - Data from host-to-function and function-to-host - Host handles most of the protocol complexity - Peripheral design is simple and low-cost Robustness - Handshake to acknowledge data transfer and flow control - Very low raw physical bit error rate 10 -10 - CRC protection plus hardware retry option - Data Toggle Sequence bits Bounded transfer characteristics - Data transfer bandwidth and latency prenegotiated - Flow control for peripheral buffer management 5 Quëstrà Packet Types Token - OUT IN SOF SETUP -First packet in any transaction -Specifies function address endpoint -Specifies data direction Data - DATA0 DATAI -0 - 1023 bytes Handshake - ACK NAK STALL -Report status of data transaction -Flow control -Stall conditions Special - PRE -Enables Hub for low speed communications I -iA 6