Over 10 years we help companies reach their financial and branding goals. Engitech is a values-driven technology agency dedicated.



411 University St, Seattle, USA


+1 -800-456-478-23

Automotive Automotive Protocols Consumer electronics consumer electronics protocols Industries Tech

What is USB Technology?

What is USB Technology

  • USB is a technology which standardize the connection of peripherals to personal computers.
  • It has largely replaced interfaces such as PS/2 connector (used for keyboard), ADB Connector (used for mouse), Parallel Ports (used for printers) and Game ports (used for video game consoles) which are used to connect different devices to computers.
  • USB technology made it possible to connect all such different devices to computer via single port USB port.
How Does USB does that: 
  1. USB is a bus protocol in which our computer is USB MASTER and devices connected to it are termed as USB DEVICES.
  2. USB DEVICES Can be anything: keyboard, mouse, flash drives, hard disk, Audio Devices, Card Readers and all devices you can think of which are connected to USB.
  3. Now in USB protocol there is the concept of USB descriptor via whichUSB host that is computer can determine which USB device is connected and correspondingly detect which electronic device is it.
  4. The USB is specified to be an industry-standard extension to the PC architecture with a focus on PC peripherals that enable consumer and business applications.
    USB performance

What is USB technology Architecture?

  1. USB hosts are also known as master devices, and they initiate all the communication that occurs over the USB bus. Typically, a computer or other controller is considered to be the master, only responding to other devices if requesting certain information.
  2. The peripheral device(USB Device), or the slave device, is connected to the host device, and is programmed to provide the host device with the information it needs to operate. Typically, peripheral devices include USB flash drives, computer mice and keyboards, cameras, and other such devices.
  3. There can be multiple USB devices but only one USB master would be there. The USB system uses the tiered star topology, in which 127 different USB slaves can be connected on the same USB bus. 

What Are USB Packets?

The amount of data transmitted in USB is called ‘packet’. The data transfer that can occur within the USB protocol is discussed below. The data of the USB protocol is transmitted within packets LSB first.

  • There are mainly four types of USB packets: 
  1. Token packet 
  2. Data packet
  3. Handshake packet 
  4. Start of the Frame packet

  • Data exchange between the host and device is known as USB transactions. One can think of USB transactions as complete data exchange that occurs between a host and device where all necessary packets are transmitted.
  • Each USB transaction is composed of either 2 or 3 packets, depending on the transfer type being used.
  • Each USB packet is designed from various fields like a Sync field, a Packet ID (PID) field, ADDR (Address) field, ENDP (Endpoint) field, CRC (cyclic redundancy check) field, and EOP (end of packet) field. 
    USB Packet Description

USB Packet Field Description

  • Sync (8 or 32 bits): In USB protocol, every USB packet will begin with a SYNC field which is normally utilized to synchronize the transmitter & the receiver to transmit the data precisely. This field is long with 8 bits at high & low speed otherwise 32-bits long for maximum speed & it is utilized to synchronize the CLOCK of the transmitter & receiver. The final 2-bits will indicate wherever the PID field begins.
  • PID(8 bits): The packer identifier field within the USB protocol is mainly used to recognize the packet type that is being transmitted. The length of this field is 8 bits long where the upper 4- bits recognize the kind of packet & lower 4- bits are the bitwise complement of the upper 4- bits.

The resulting format of the PID(Packet identifier field) is shown below → 

Packet Identifier Field

→ The PID Value: Indicates the type of packet/group( out of 4 one) and the format of the packet and the type of error detection applied to the packet. 

→ PIDs are divided into four coding groups: token, data, handshake, and special, with the first two transmitted PID bits (PID<0:1>) indicating which group.

  • Address field(7 bits): The address field of the USB protocol indicates which packet device is mainly designated for. The 7-bits length simply allows support of 127 devices. The ADDR field is specified for IN, SETUP, and OUT tokens and the PING and SPLIT special token. The address (ADDR) field specifies the address, that is either the source or destination of a data packet, depending on the value of the token PID.
ADDR Field
  • Endpoint Field(4 bits):An additional four-bit endpoint (ENDP) field, shown in Figure 8-3, permits more flexible addressing of functions in which more than one endpoint is required. The endpoint field is defined for IN, SETUP, and OUT tokens and the PING special token.
    Endpoint Field

  • Cyclic Redundancy Checks: Cyclic redundancy checks (CRCs) are used to protect all non-PID fields in token and data packets. In this context, these fields are considered to be protected fields.All CRCs are generated over their respective fields in the transmitter before bit stuffing is performed. Similarly, CRCs are decoded in the receiver after stuffed bits have been removed.

  • Data Field: The data field may range from zero to 1,024 bytes and must be an integral number of bytes. Figure 8-4 shows the format for multiple bytes. Data packet size varies with the transfer type.
Data Field Format

Types of USB Packets

1. Token Packet:

A token consists of a PID, specifying either IN, OUT, or SETUP packet type and ADDR and ENDP fields. The PING special token packet also has the same fields as a token packet.

  • Token Packet  is initiated by the host and determines if the host will send or receive data.
Token Packet
    • For OUT and SETUP transactions, the address and endpoint fields uniquely identify the endpoint that will receive the subsequent Data packet. 
    • Setup – Used to begin control transfers. 
    • Out – Informs the USB device that the host wishes to send information.
    •  For IN transactions, these fields uniquely identify which endpoint should transmit a Data packet.
    • For PING transactions, these fields uniquely identify which endpoint will respond with a handshake packet.
    • An IN PID defines a Data transaction from a device to the host. OUT and SETUP PIDs define Data transactions from the host to a device. A PING PID defines a handshake transaction from the device to the host
    • Token packets have a five-bit CRC that covers the address and endpoint fields as shown above.
    • Token and SOF packets are delimited by an EOP after three bytes of packet field data.

2. Data Packet

A data packet consists of a PID, a data field containing zero or more bytes of data, and a CRC as shown.

Data Packet
    • Data must always be sent in integral numbers of bytes. The data CRC is computed over only the data field in the packet and does not include the PID, which has its own check field.
    • The maximum data payload size allowed for low-speed devices is 8 bytes. The maximum data payload size for full-speed devices is 1023. The maximum data payload size for high-speed devices is 1024 bytes.
  • There are four types of data packets, identified by differing PIDs: DATA0, DATA1, DATA2 and MDATA.

3. Handshake Packets:

  • Handshake packets, as shown in Fig, consist of only a PID.
Handshake Packet
  • Handshake packets are used to report the status of a data transaction and can return values indicating successful reception of data, command acceptance or rejection, flow control, and halt conditions.
  • Only transaction types that support flow control can return handshakes. Handshakes are always returned in the handshake phase of a transaction and may be returned, instead of data, in the data phase.
    • Different statuses of data transaction:
    1. ACK indicates that the data packet was received without bit stuff or CRC errors over the data field and that the data PID was received correctly.
    2.  NAK indicates that a device was unable to accept data from the host (OUT) or that a function has no data to transmit to the host (IN).Also used during interrupt transactions to inform the host there is no data to send.
    3. STALL is returned by a device in response to an IN token or after the data phase of an OUT or in response to a PING transaction.

What is a USB Device Class?

A USB device may be divided into three layers:

  • The bottom layer is a bus interface that transmits and receives packets.
  • The middle layer handles routing data between the bus interface and various endpoints on the device.
  • The top layer is the functionality provided by the serial bus device, for instance, a mouse.

The functionality of a USB device is defined by a class code sent to a USB host. This allows the host to load software modules for the device and to support new devices from different manufacturers.

USB Device List
  1. Serial port in the Communications Device Class (CDC) is legacy USB device class.
  2. HID – Human Interface Device: The Human Interface Device (HID) was originally used for USB mice and keyboards; however, it can be used to interface to any I/O device. For an embedded system the HID driver can be used to pass control and configuration information between a host client and the application.
  3. MSC – Mass Storage Class: Allows an external device to connect to the USB host and appear as a storage device, it is ideal for data aquisition and storage applications. The USB device driver also provides all the necessary class support to link a host file system to the Flash file system via USB.
  4. ADC – Audio Device Class
    Allows you to stream audio data between the USB Host and the device as Isochronous packets. Like the Mass Storage and HID classes, the Audio Class communicates with a standard driver within Windows.
  5. CDC – Communications Device Class
    This class implements a virtual serial port over USB, it is mainly used for modems, plain telephony applications, and can provide an interface for transmitting Ethernet or ATM frames.
  6. Composite Device Class
    Multi-function or compositie devices are easily supported by including the drivers for each of the required classes.


What are USB Device Requests?

  • All USB devices respond to requests from the host on the device’s Default Control Pipe. These requests are made using control transfers. The request and the request’s parameters are sent to the device in the Setup packet.
Setup Packet for USB device request & response
Standard USB Device Requests

What is USB Data Transfer?

The packets that comprise a transaction varies depending on the endpoint type. There are 4 endpoint types: bulk, control, interrupt and isochronous.

  • Control transfer: a low throughput endpoint for control information. It is used for querying device information and configuring the device.Control Transfers are bi-directional transfers reserved for the host to send and request configuration information to and from the device using the IN and OUT Endpoint 0.Control transfer uses Token, data and Handshake packets. Collectively these packets in control transfer are called as Setup packet.
  • Bulk transfer: Endpoint for transferring large amounts of data. It has low priority but can achieve high throughput by using all the bandwidth not needed for other types. It is used for serial data connection, data transfer for mass storage devices etc.
  • Interrupt transfer: a low throughput endpoint with high priority for status updates. It is used for notifying about keystrokes on a keyboard, mouse movements etc.
  • Isochronous transfer: a high priority, fixed bandwidth endpoint. It is used for transferring real-time data such as real-time audio.

Most functions will have a series of buffers, typically 8 bytes long. Each buffer will belong to an endpoint – EP0 IN, EP0 OUT etc. Say for example, the host sends a device descriptor request. The function hardware will read the setup packet and determine from the address field whether the packet is for itself, and if so will copy the payload of the following data packet to the appropriate endpoint buffer dictated by the value in the endpoint field of the setup token. It will then send a handshake packet to acknowledge the reception of the byte and generate an internal interrupt within the semiconductor/micro-controller for the appropriate endpoint signifying it has received a packet. This is typically all done in hardware.

  • The software now gets an interrupt, and should read the contents of the endpoint buffer and parse the device descriptor request.

What are USB Descriptors?

  • USB devices report their attributes using descriptors, a descriptor is a data structure with a defined format. Each Descriptor begins with a byte-wide field that contains the total number of bytes in the descriptor followed by a byte -wide field that identifies the descriptor type.
  • As described above, when a device is connected to a USB host, the device gives information to the host about its capabilities and power requirements.
  • The device typically gives this information through a descriptor table that is part of its internal registers. A descriptor table is a structured sequence of values that describe the device; these values are defined by the developer. All descriptor tables have a standard set of information that describes the device attributes and power requirements.
There are 5 types of USB descriptors:
  1. Device Descriptor: The device descriptor provides the basic information about the device. It represents the entire USB device. It is the first descriptor read by the host. The host receives this descriptor after sending a Get_Descriptor request.
    USB Device Descriptor


  2. Device Qualifier: USB Devices that support both full and high-speed modes must have a device_qualifier Descriptor. When the USB device switches its speed mode, values in some fields get changed in device descriptor. The device_qualifier descriptor provides information only about those field values that get changed when device switches to an alternate speed mode. This descriptor contains following fields out of which first two are common while other changes specific to the device.
USB Device Qualifiers

3. Configuration Descriptor: A USB device can have one or more configurations. Most devices only have one configuration. The configuration provides information related to power source, power consumption, and number of interfaces.

The bNumConfigurations in device descriptor tells the host about the number of possible configurations. The host uses Set_Configuration request to select a configuration and Get_Configuration request to read the currently selected configuration.

Configuration Descriptor

4. Interface Descriptor:

A configuration can have one or more interfaces that can be taken as features or functions implemented by the device. The interface descriptor provides information related to particular features of the device like class, subclass, protocol and number of endpoints interface uses.

Interface Descriptor

5. Enpoint Descriptor: The Endpoint Descriptor describes the endpoints associated with an interface. There is no descriptor for default endpoint zero. The endpoint zero is control endpoint and is configured even before the request of any descriptor. The information contained in this descriptor is used to determine the bandwidth required by the USB bus.

Endpoint Descriptor

6. String Descriptor: String descriptors contain human readable texts. They are generally used to provide information. Other descriptors contain index value that points to strings containing information for manufacturer, product, serial number, configuration, interface. Other descriptors like Class and Vendor Specific can contain indexes to string descriptors.

The Strings are encoded in Unicode format and multiple languages are supported. The host can get the list of supported languages using Get_Descriptor request with 0 in wIndex field. The device returns the String descriptor containing codes for different languages. The first 2 fields are mandatory fields and other fields contain language codes.

String Descriptor

What are USB Endpoints?

  • USB devices have a concept of Endpoints to receive and send data. It is kind of source or destination buffer that must be implemented on the device side. Each amount of data that is received from or sent to the host will be placed into an endpoint. Each endpoint is uniquely characterized by a number and direction.
  • Data transfers with the USB device is done using these endpoints only and endpoint can be configured to support 4 transfer types:

So, there are 4 types of data transfer:

  1. Control Transfer: are typically used to setup an USB device, they always use IN/OUT Endpoint.
  2. Bulk Transfer: can be used to send data where timing is not important.
  3. Interrupt Transfer: can be used where data is sent regularly for example for status updates.
  4. Isochronous transfer: transmit real time data such as audio and video. They have a guaranteed fixed bandwidth but no error detection.

A USB Host’s send data to Endpoint 1 for example. Coming from the USB Host, the data will be sent to the OUT Endpoint 1. The program on the microcontroller will then read the data as soon as it is ready to do so. Returning data has to be written to the IN Endpoint 1, as the program cannot access the USB bus freely. OUT always refers to the direction pointing from the host to the device. IN always refers to the direction pointing towards the host.


  • A device can have up to 16 OUT and 16 IN endpoints.
  • Each endpoint can have only one transfer direction.

Endpoint 0 is used for control transfers only and can not be assigned to any other function.

What are USB features?

  • It supports hot switching and Plug/Play.
  • Each specification subversion supports different maximum signaling rates from 1.5 Mbit/s in USB 1.0 to 80 Gbit/s in USB4
  • The USB interface is self-configuring, eliminating the need for the user to adjust the device’s settings for speed or data format, or configure interrupts, input/output addresses, or direct memory access channels.
  • Small devices can be powered directly from the USB interface, eliminating the need for additional power supply cables.
  • The USB standard eliminates the requirement to develop proprietary interfaces to new peripherals.
  • USB has a strict tree network topology and master/slave protocol for addressing peripheral devices; those devices cannot interact with one another except via the host, and two hosts cannot communicate over their USB ports directly.
  • For a product developer, using USB requires the implementation of a complex protocol and implies an “intelligent” controller in the peripheral device. Developers of USB devices intended for public sale generally must obtain a USB ID, which requires that they pay a fee to the USB Implementers Forum (USB-IF). Developers of products that use the USB specification must sign an agreement with the USB-IF. Use of the USB logos on the product requires annual fees and membership in the organization.
  • In USB terminology, the endpoint direction is named from the host’s perspective. Thus, IN always refers to transfers from a device to the host and OUT always refers to transfers from the host to a device.
IN and OUT direction

What are Applications of USB?

It has become commonplace on a wide range of devices, such as keyboards, mice, cameras, printers, scanners, flash drives, smartphones, game consoles, and power banks

Comparison with other connection method

  1. FireWire
  2. Ethernet
  3. MIDI
  4. eSATA/eSATAp
  5. Thunderbolt

USB Connectors

  • USB connector interfaces are classified into three types: A (host), B (peripheral), and C (2014, replaces A and B).
  • The A and B types know different sizes: Standard, Mini, and Micro. The standard size is the largest and is mainly used for desktop and larger peripheral equipment. The mini size was introduced for mobile devices, but it was replaced by the thinner micro size. The micro size is nowadays the most common for smartphones and tablets.

What are USB standard/types

 As of 2023, there are 4 USB standards:

  • USB1

→ Released in January 1996, USB 1.0 specified signaling rates of 1.5 Mbit/s (Low Bandwidth or Low Speed) and 12 Mbit/s (Full Speed)

→ USB devices made it to the market until USB 1.1 was released in August 1998. USB 1.1 was the earliest revision that was widely adopted. 

  • USB2

→ USB 2.0 was released in April 2000, adding a higher maximum signaling rate of 480 Mbit/s (maximum theoretical data throughput 53 MByte/s)

  • USB3( The USB 3.0 specification defined a new architecture and protocol, named SuperSpeed )

→ The USB 3.0 specification was released on 12 November 2008.

→ USB 3.0 adds a SuperSpeed operation mode, with associated backward-compatible plugs, receptacles, and cables. SuperSpeed plugs and receptacles are identified with a distinct logo and blue inserts in standard format receptacles.

  • USB4( It has support of tunneling architecture)

The USB4 specification was released on 29 August 2019 by the USB Implementers Forum.

USB4 is based on the Thunderbolt 3 protocol. It supports 40 Gbit/s throughput, is compatible with Thunderbolt 3, and backward compatible with USB 3.2 and USB 2.0. The architecture defines a method to share a single high-speed link with multiple end device types dynamically that best serves the transfer of data by type and application.

→ During CES 2020, USB-IF and Intel stated their intention to allow USB4 products that support all the optional functionality as Thunderbolt 4 products. The first products compatible with USB4 are expected to be Intel’s Tiger Lake series and AMD’s Zen 3 series of CPU, released in 2020.



Leave a comment

Stay Updated With Us

Error: Contact form not found.