ITEC 352 Lecture 33 USB (2)
Review Intro to USB –History –Rationale –Competitors –Serial versus parallel –Topology
USB (2) Objectives Types of transfer modes Pins Encoding electricity into 0’s and 1’s Packets
USB (2) Transfer modes Isochronous transfers –Guaranteed rate but possible data loss Interrupt transfers –Quick response transfer Bulk transfers –Uses all available bandwidth –No guarantee on timing or latency Control transfers –Tell the device what to do
USB (2) Connector Pin Layout (1-4) –Vcc +5V (Why is this important?) –Data- –Data+ –Ground Why so simple?
USB (2) Why 2 wires? Why do you think 2 data wires is important? –Twice the capacity (parallel)? –Error detection? –Host to Client, Client to Host? –Others?
USB (2) Electricity Sends a signal across a wire Note: How clean is this signal? What can we do to with this level of signal strength?
USB (2) Brainstorm Develop a system for sending 0s and 1s across an electrical wire in a safe manner Tools –Clock pulses
USB (2) NRZI Encoding Start at 1 or 0 At the next clock edge –If value changes it is a 1 –If it stays the same it is a 0 –Or vice versa (USB uses same as 1, change is 0)
USB (2) Circuitry thought Have to have some way to accumulate the bits Start with 32 bits of 0 –Shift bits right –Insert bit from wire into accumulator –Sound familiar to P1? Binary adders + Flip flops –5 bits of memory (2^5 = 32) –Add 1 to it each time –When overflow happens, data is ready Note: not exactly what is used, but close
USB (2) Process A protocol (what is it in your own words?) –Which ones do you know of? Handshaking –Series of known 0s and 1s Timing –Devices run at different speeds –Have to figure out their transmission speed –Handshake allows you to figure out the timing
USB (2) Packets Group of 0’s and 1’s put together Agreed upon method of communication Preamble (timing) = Ping = Response –ACK = –NAK… –Stall…
USB (2) How it works Once you identify yourself –Certain number of bits read in based on command Data transfer basics –Send data command from computer –Data sent from device –Ack from computer saying it got data –If Ack not there, data resent –Also have to verify data is ok and not corrupt
USB (2) Data safety How can you verify that a series of 0’s and 1’s are transferred correctly? Ideas?
USB (2) Software Read X bits into an array == Packet! Handling each bit… –Not very desirable Libraries to handle this for us –Next time!
USB (2) Summary USB Electrical and Next time –Code / libraries