esp_hal

Module otg_fs

Source
Available on crate feature unstable only.
Expand description

§USB On-The-Go (USB OTG)

§Overview

The USB OTG Full-speed (FS) peripheral allows communication with USB devices using either blocking (usb-device) or asynchronous (embassy-usb) APIs.

It can operate as either a USB Host or Device, and supports full-speed (FS) and low-speed (LS) data rates of the USB 2.0 specification.

The blocking driver uses the esp_synopsys_usb_otg crate, which provides the USB bus implementation and USB peripheral traits.

The asynchronous driver uses the embassy_usb_synopsys_otg crate, which provides the USB bus and USB device implementations.

The module also relies on other peripheral modules, such as GPIO, system, and clock control, to configure and enable the USB peripheral.

§Configuration

To use the USB OTG Full-speed peripheral driver, you need to initialize the peripheral and configure its settings. The Usb struct represents the USB peripheral and requires the GPIO pins that implement [UsbDp], and [UsbDm], which define the specific types used for USB pin selection.

The returned Usb instance can be used with the usb-device crate, or it can be further configured with asynch::Driver to be used with the embassy-usb crate.

§Examples

Visit the USB Serial example for an example of using the USB OTG peripheral.

§Implementation State

  • Low-speed (LS) is not supported.

Modules§

Structs§

  • USB peripheral.
  • USB peripheral driver for STM32 microcontrollers.