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 at 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 Into 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

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
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.