Audio Processing #1: Basic Terminologies

EH#2 Understanding USB protocol and it's classes

         Usb flash drive | Premium AI-generated PSD

Introduction

The USB Implementers Forum (USB-IF) is a non-profit organization that promotes and maintains the Universal Serial Bus (USB). The USB-IF was founded in 1995 by companies that developed USB.
What the USB-IF does

    Develops USB compliance tests
    Promotes USB and its benefits
    Supports USB communities
    Develops marketing programs
    Holds developer conferences
    Maintains USB standards and specifications
    Certifies USB products
    Holds the trademarks for USB Type C

What USB-IF certification means

    USB-IF certification indicates that a product meets the USB-IF's quality, performance, and environmental standards
    USB-IF-certified products are compatible with various USB devices and hosts
    USB-IF-certified products can display the USB-IF logo on their packaging or products

USB Device Classes

USB-IF categorizes different types of USB devices into groups. This high level categorization is called USB Device Classes.

Each class is assigned a code in the Device or Interface Descriptor, which the USB host reads during the enumeration to identify the device.

The host uses this information to load the appropriate driver for the device.

Why does it matter?

This class thing enables plug-and-play functionality and ensures cross-platform compatibility and easy driver development.

Some of the class codes:

USB Sub-Class:

A USB sub-class is a more specific category within a device class. It refines the device's functionality for particular uses.

Example: 

For audio class: Audio Control, Audio Streaming and MIDI Streaming are the sub-classes.

For HID class: Boot Interface Devices and generic Devices are the sub-classes.

USB protocol:

A protocol defines the rules or the methods a device uses to communicate or transfer data. Protocols are typically defined for specific sub-classes.


Driver Support:

Common USB classes, such as HID, Audio, and Mass Storage, are natively supported by operating systems to enable plug-and-play functionality.

Some USB classes, such as vendor-specific or less common application-specific classes, often require devices manufacturers to provide dedicated drivers. Driver support may vary across OSes.

USB Port Types & Colors


Understanding USB Type-C

 Here is how type-C can acts as:

type-C pin details:

Type-C Plug and Receptacle:

Purpose of different lines in USB Type-C plug:

From the above figure we can see that Vconn and CC can connect to either CC1 and CC2 or CC2 and CC1. That means there are two possibilities for Vconn and CC. Let's understand this better...

Rp and Rd decides the power HOST port can deliver. Let's see some possible Rp and Rd values.

Want to deliver more power from HOST, use power delivery feature of USB Type-C. To achieve this, on both sides configuration channel controllers are introduced.






USB Enumeration

USB is a plug-and-play protocol, meaning the host has no prior knowledge about the device being attached. For instance, a computer/laptop does'nt know if the attached device is a pen-drive, a keyboard, or a mouse.

USB enumeration is the process where the host learns about the attached device to understand how to exchange data with it. 

Watch this video for more detail on "how enumeration works".

Enumeration Steps:

  1. Attachment detection
  2. supply 100mA current
  3. Speed detection
  4. USB device reset
  5. Get Descriptor ( at address-0, maximum packet size only)
  6. Set Address
  7. Get Descriptor ( At new address, full descriptor this time)
  8. Get configuration
  9. Set configuration

Understanding the USB Descriptors:

 

A descriptor is a data structure that contains specific details about the USB device. There are different types of data structures, each holding distinct information in an organized manner.

These descriptors are exchanged during the enumeration process to help the host configure and communicate effectively.

The list of descriptors includes the following:

  1. Device Descriptor
  2. Configuration Descriptor
  3. Interface Descriptor
  4. Endpoint Descriptor
  5. String Descriptor

For more detail watch this video "Descriptors". 

Hierarchy of descriptors of a USB device. A device has a single Device descriptor. The Device descriptor can have multiple Configuration descriptors, but only a single one can be active at a time. The Configuration descriptor can define one or more Interface descriptors. Each of the Interface descriptors can have one or more alternate settings, but only one setting can be active at a time. The Interface descriptor defines one or more Endpoints.

  • Device Descriptor: Each USB device can only have a single Device Descriptor. This descriptor contains information that applies globally to the device, such as serial number, vendor ID, product ID, etc. The device descriptor also has information about the device class. The host PC can use this information to help determine what driver to load for the device.

  • Configuration Descriptor: A device descriptor can have one or more configuration descriptors. Each of these descriptors defines how the device is powered (e.g. bus powered or self powered), the maximum power consumption, and what interfaces are available in this particular setup. The host can choose whether to read just the configuration descriptor or the entire hierarchy (configuration, interfaces, and alternate interfaces) at once.

  • Interface Descriptor: A configuration descriptor defines one or more interface descriptors. Each interface number can be subdivided into multiple alternate interfaces that help more finely modify the characteristics of a device. The host PC selects particular alternate interface depending on what functions it wishes to access. The interface also has class information which the host PC can use to determine what driver to use.

  • Endpoint Descriptor: An interface descriptor defines one or more endpoints. The endpoint descriptor is the last leaf in the configuration hierarchy and it defines the bandwidth requirements, transfer type, and transfer direction of an endpoint. For transfer direction, an endpoint is either a source (IN) or sink (OUT) of the USB device.

  • String Descriptor: Some of the configuration descriptors mentioned above can include a string descriptor index number. The host PC can then request the unicode encoded string for a specified index. This provides the host with human readable information about the device, including strings for manufacturer name, product name, and serial number.

Comments