mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
7f09fe1b23
This commit updates the USB Host stack to use the USB PHY driver. The USB PHY and the OTG Controller should now both be setup/deleted using usb_new_phy() and usb_del_phy() respectively. - The hcd_install() now expects the USB PHY and OTG Contorller to be already setup before it is called - usb_host_install() now has an option to skip calling usb_del_phy() if the user wants to setup their own USB PHY (e.g., in the case of using and external PHY). - CDC-ACM and MSC examples/test updated to use internal PHY Closes https://github.com/espressif/esp-idf/issues/8061 |
||
---|---|---|
.. | ||
include/usb | ||
test | ||
cdc_acm_host.c | ||
CMakeLists.txt | ||
README.md |
USB Host CDC-ACM Class Driver
This directory contains an implementation of a USB CDC-ACM Host Class Driver that is implemented on top of the USB Host Library.
Supported Devices
The CDC-ACM Host driver supports the following types of CDC devices:
- CDC-ACM devices
- CDC-like vendor specific devices (usually found on USB to UART bridge devices)
CDC-ACM Devices
The CDC-ACM Class driver supports CDC-ACM devices that meet the following requirements:
- The device class code must be set to the CDC class
0x02
or implement Interface Association Descriptor (IAD) - The CDC-ACM must contain the following interfaces:
- A Communication Class Interface containing a management element (EP0) and may also contain a notification element (an interrupt endpoint). The driver will check this interface for CDC Functional Descriptors.
- A Data Class Interface with two BULK endpoints (IN and OUT). Other transfer types are not supported by the driver
CDC-Like Vendor Specific Devices
The CDC-ACM Class driver supports CDC-like devices that meet the following requirements:
- The device class code must be set to the vendor specific class code
0xFF
- The device needs to provide and interface containing the following endpoints:
- (Mandatory) Two Bulk endpoints (IN and OUT) for data
- (Optional) An interrupt endpoint (IN) for the notification element
For CDC-like devices, users are responsible for ensuring that they only call APIs (e.g., cdc_acm_host_send_break()
) that are supported by the target device.
Usage
The following steps outline the typical API call pattern of the CDC-ACM Class Driver
- Install the USB Host Library via
usb_host_install()
- Install the CDC-ACM driver via
cdc_acm_host_install()
- Call
cdc_acm_host_open()
/cdc_acm_host_open_vendor_specific()
to open a target CDC-ACM/CDC-like device. These functions will block until the target device is connected - To transmit data, call
cdc_acm_host_data_tx_blocking()
- When data is received, the driver will automatically run the receive data callback
- An opened device can be closed via
cdc_acm_host_close()
- The CDC-ACM driver can be uninstalled via
cdc_acm_host_uninstall()
Examples
- For an example with a CDC-ACM device, refer to cdc_acm_host
- For an example with a CDC-like device, refer to cdc_acm_host_bg96