USB Overview

Supported ICs[ RTL8721Dx ][ RTL8721F ]

USB (Universal Serial Bus) is a standard serial communication interface designed to interconnect host controllers and peripheral devices.

The complete USB specification suite, including electrical, mechanical, and protocol layer documentation, is accessible at http://www.usb.org/developers.

Note

Due to the incomplete official USB protocol stack of Zephyr, which only supports device mode. Therefore, we choose not to use the official source code, but instead provide the Realtek USB stack. This chapter briefly introduces the Realtek USB stack, and how to compile and run application examples.

Features

  • Supports USB2.0 high-speed (480 Mbps) and full-speed (12 Mbps) modes

  • Supports following USB IF standard device class drivers:

    • CDC ACM: Used for data transparent transmission or as a virtual serial port

    • HID: Used as USB keyboard, mouse and other devices to achieve human-computer interaction functions

    • MSC: Supports SD card or SRAM as storage medium for data storage

    • UAC: Used as USB audio device, it supports audio recording and playback

  • Supports following USB composite device class drivers:

    • CDC ACM + HID

    • CDC ACM + UAC

    • HID + UAC

  • Provides reference design for vendor-specific USB device drivers

  • Full descriptor customization:

    • VID and PID

    • String descriptors

    • Endpoint mapping

  • Configurable device core driver parameters

    • Speed mode

    • Data FIFO depth (only for dedicated FIFO mode)

    • Core ISR/thread priority

Hardware Features

  • Supports device mode

  • Supports USB 2.0 full-speed (12 Mbps) mode

  • Supports DMA mode

  • Endpoint configurations:

    • EP0: INOUT (for Control transfer only)

    • EP1: IN

    • EP2: OUT

    • EP3: IN

    • EP4: OUT

    • EP5: INOUT

Note

One and only one periodic IN endpoint is supported.

  • Shared FIFO with following configurations:

    • Total FIFO depth: 768 DWORD

    • Shared receive FIFO: 472 DWORD (max)

    • Shared non-periodic transmit FIFO: 32 DWORD (max)

    • Dedicated periodic transmit FIFO: 256 DWORD (max)

Note

8 DWORD FIFO shall be reserved for DMA registers in DMA mode.

Software Stack Overview

Software stack architecture

Where:

  • USB HAL driver: Implements SoC-specific hardware driver for power management and phy calibration, exposing unified HAL API to upper-layer core drivers.

  • USB device core drivers: Integrates USB IP-specific hardware driver, device controller driver, enumeration state machine and transfer scheduling algorithms, exposing unified core API for designers to develop classes and applications.

  • USB device class drivers: Delivers USB-IF class-compliant drivers via class-specific API, enabling rapid deployment of standard USB solutions.

  • USB device applications: Provides reference designs for USB solutions.

Zephyr USB API is consistent with FreeRTOS USB API. For details, see FreeRTOS USB API

File Organization

SDK/modules/hal/realtek
├── ameba/common/usb/source
│   ├── common
│   │   ├── usb_ch9.h
│   │   └── usb_os.h
│   └── device
│      ├── cdc_acm
│      ├── composite
│      ├── hid
│      ├── inic_dplus
│      ├── msc
│      ├── uac
│      ├── vendor
│      └── core
│          └── usbd.h
└── zephyr/blobs/amebadplus/lib
    └── lib_usbd.a

USB Certification

USB certification generally refers to USB-IF certification, i.e. USB-IF compliance testing, which validates devices against USB-IF electrical, protocol and functional requirements to ensure interoperability, security and reliability. Certified devices are authorized to use USB logos.

While USB-IF certification is not mandatory, it is required when:

  • Products intend to use USB logos

  • Marketing materials claim USB specification compliance or certification

For certification procedures and requirements, refer to https://www.usb.org documentation or contact USB-IF authorized test labs.

Additional Compliance Requirements for USB Devices:

  • FCC/CE: Mandatory for USB devices sold in EU/US markets

  • ISO 26262: Required for automotive USB devices (functional safety)

  • Windows Logo Program: Necessary for “Certified for Windows” branding

  • MFi: Mandatory for Apple-specific USB accessories