From bildr

Jump to: navigation, search
Intel Corporation. Usb Connection Types.

Universal Serial Bus is a common serial bus standard for connectivity between devices and a host controller, usually a computer. It is frequently used with digital cameras, printers, external hard drives etc.


Hooking It Up

USB cable wiring layout
Pin # Name Cable color Description
1 VCC Red +5V
2 D− White Data −
3 D+ Green Data +
4 GND Black Ground

USB 1.x/2.0 Mini/Micro pinning Pin

PinNameCable colorDescription
1VCCRed+5 V
2D−WhiteData −
3D+GreenData +
4IDnonepermits distinction of A plug from B plug
* A plug: connected to Signal Ground
* B plug: not connected
5GNDBlackSignal Ground

USB 3 Pins

PinColorSignal name
('A' connector)
Signal name
('B' connector)

Data Packets

All USB packets are composed of 8-bits (1-byte), with the least significant bit transferred first. The first byte will be the packet identifier byte (PID), consisting of 4-bits with its bitwise complement for verification of data integrity. The PID bytes are as follows:

USB PID bytes

TypePID value
Transmitted byte
Reserved00000000 1111
Token10000001 1110SPLITHigh-bandwidth (USB 2.0) split transaction
01000010 1101PINGCheck if endpoint can accept data (USB 2.0)
Special11000011 1100PRELow-bandwidth USB preamble
HandshakeERRSplit transaction error (USB 2.0)
00100100 1011ACKData packet accepted
10100101 1010NAKData packet not accepted; please retransmit
01100110 1001NYETData not ready yet (USB 2.0)
11100111 1000STALLTransfer impossible; do error recovery
Token00011000 0111OUTAddress for host-to-device transfer
10011001 0110INAddress for device-to-host transfer
01011010 0101SOFStart of frame marker (sent each ms)
11011011 0100SETUPAddress for host-to-device control transfer
Data00111100 0011DATA0Even-numbered data packet
10111101 0010DATA1Odd-numbered data packet
01111110 0001DATA2Data packet for high-bandwidth isochronous transfer (USB 2.0)
11111111 0000MDATAData packet for high-bandwidth isochronous transfer (USB 2.0)

Packets come in 3 disserent types, with an extra potential special type.

1. Handshake Packet

Handshake packets are a PID byte, and are typically sent as ACK (data recieved), NAK (data cannot be accepted), and STALL (error has occurred). USB 2.0 has extra packets in the form of NYET (split transaction is not done/buffer is full, will PING until an ACK is received and then resumes transfer) and ERR (split transaction failed).

2. Token Packet

A Token Packet is a PID byte with 2 payload bytes, having an 11-bit address and a 5-bit CRC. The main packets are IN and OUT, consisting of a 7-bit device number and a 4-bit function number and tell a device to transmit or recieve DATAx packets respectively. IN expects a device response, being NAK or STALL, or DATAx with a possible ACK handshake. OUT follws by sending a corresponding DATAx packet, and may receive ACK, NAK, NYET, or STALL. SETUP is a special case; essentially an OUT token, but only used for device setup, and is followed by a DATA0 packet.

Each millisecond (1200 bit times at full-bandwidth), and SOF (start of frame) token is transmitted to synchronize isochronous data flow. SOF is an 11-bit address that increments each time to act as a frame of reference.

USB 2.0 has a few extra features. SOF is sent an extra 7 times per millisecond, each marked with a "microframe" bit. USE 2.0 also has a PING function to check for a ready device, and a 3-byte SPLIT function (7-bit hub number, 12 control bits, 5-bit CRC) to preform split transaction. The type of data packet used alternated between DATA0 and DATA1 to prevent duplicated. the special case SETUP required a DATA0 packet to follow. USB2.0 also adds the data packets DATA2 and MDATA for high-speed transfer.

3. Data Packet

A Data Packet is a PID followed by up to 1024 bits of data in high-bandwidth mode and 8 bytes at low bandwidthm with a 16-bit CRC. USB 1.0 contains DATA0 and DATA1 packets (address token, optional handshake, 1-bit sequence number), and waits for a handshake response.

ex. PRE Packet

Low-bandwidth devices use a special PID value called PRE. PRE is used to denote a packet that is low bandwidth. Only hubs use the PRE packet as refrence. Other devices ignore it.



This page is an Article on bildr. Articles are pages that define or explain a concept, method, or generic item.

NOTE: All information contained within this article is pure opinion. Although this article is intended to help people, it may contain faulty or misleading information. This article is not to be considered professional opinion or advice, and is in no way a replacement for reading all safety/instructional documentation. Always remember to protect yourself when handling/using hazardous materials, as well as test new techniques before using them on projects/work intended to be handed in or used.

bildr and its contributers take NO responsibility for the information contained within.