How USB Communicates

All USB data transfers are initiated by the USB Host. The Host controls communication timing by maintaining time intervals called frames. The Host issues a Start of Frame (SOF) sequence on the USB data lines at the beginning of each frame.

The time interval of each frame is determined by the specified USB speed. One requirement of USB compliance certification is the ability of a HOST to accurately issue SOFs.

The USB Hosts conducts communication transactions with the Devices during the Frame.

The mechanism of transferring data involves the Host reading and writing to a set of memory locations located on each Device. These memory locations are called Endpoints. Endpoints are essentially in and out baskets. The size of an endpoint ( i.e. amount of data in an endpoint) can vary significantly between different Devices.

Device endpoints are found in numbered pairs. Endpoint numbers start with 0 and can be as high as 32. Each endpoint number has an IN and an OUT endpoint. OUT endpoints carry data coming out of the Host, while IN endpoints contain data being sent In to the Host. For example, Endpoint 1 is two endpoints; endpoint 1 IN ( EP1IN) and Endpoint 1 OUT ( EP1OUT).

Writing to a USB Device

When the host wishes to send a message to a Device, the message is placed in an OUT endpoint on the Device through the use of a WRITE transaction. The Device’s application code monitors the OUT endpoints to determine if any messages have been received from the Host. After detecting the presence of a message from the Host, the Device will copy the message from the OUT endpoint.

Sending Data to the Host

If a device’s application wishes to communicate with the host, a message is placed in an IN endpoint. The message will remain in the IN endpoint until the Host issues a READ transaction. A READ transaction caused the contents of an IN endpoint to be sent to the host.

Communication Parameters

The data throughput of USB communications to an endpoint depends upon three items:

  1. The signaling rate of the frame, determined by the specified USB speed.
  2. The size of the endpoint (how much data each transaction moves)
  3. The frequency in which the host issues transactions to the endpoint. This can vary from several transactions per frame to multiple frames between endpoint transactions.

Information on all endpoint parameters and communication requirements are defined by the Device and given to the Host when the Device is plugged into the Host and successfully enumerated. The enumeration process informs the host which transfer type to use when communicating with a Device’s endpoints.

Control and Configuration

Each USB Device reserves Endpoint 0 as a unique endpoint called the Control Endpoint. EP0 IN contains a description of the USB Device which is read by the Host during enumeration. EP0 OUT provides the Host the ability to send configuration commands to the Device.

 Learn More

 
USB Enumeration
Learn more >
 
Transfer Types and Device Classes
Learn more >
 
Developing USB Applications
Learn more >

20th Annual
Microchip MASTERs Conference 2016
Register now - Deadline: July 29

JW Marriott Desert Ridge Resort-Phoenix, AZ

© 2016 Microchip Technology, Inc.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.