160 likes | 466 Views
ITEC 352. Lecture 33 USB (2). Review. Intro to USB History Rationale Competitors Serial versus parallel Topology. Objectives. Types of transfer modes Pins Encoding electricity into 0’s and 1’s Packets. Transfer modes. Isochronous transfers Guaranteed rate but possible data loss
E N D
ITEC 352 Lecture 33 USB (2)
Review • Intro to USB • History • Rationale • Competitors • Serial versus parallel • Topology
Objectives • Types of transfer modes • Pins • Encoding electricity into 0’s and 1’s • Packets
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
Connector • Pin Layout (1-4) • Vcc +5V (Why is this important?) • Data- • Data+ • Ground • Why so simple?
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?
Electricity • Sends a signal across a wire Note: How clean is this signal? What can we do to with this level of signal strength?
Brainstorm • Develop a system for sending 0s and 1s across an electrical wire in a safe manner • Tools • Clock pulses
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)
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
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
Packets • Group of 0’s and 1’s put together • Agreed upon method of communication • Preamble (timing) = 1100 0011 1100 • Ping = 0100 0010 1101 • Response • ACK = 0010 0100 1011 • NAK… • Stall…
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
Data safety • How can you verify that a series of 0’s and 1’s are transferred correctly? • Ideas?
Software • Read X bits into an array == Packet! • Handling each bit… • Not very desirable • Libraries to handle this for us • Next time!
Summary • USB • Electrical and • Next time • Code / libraries