diff --git a/docs/docs_not_updated/esp32p4.txt b/docs/docs_not_updated/esp32p4.txt index 510e7391c1..3a616e8140 100644 --- a/docs/docs_not_updated/esp32p4.txt +++ b/docs/docs_not_updated/esp32p4.txt @@ -11,7 +11,6 @@ api-guides/wifi-security.rst api-reference/peripherals/adc_continuous.rst api-reference/peripherals/adc_oneshot.rst api-reference/peripherals/usb_host.rst -api-reference/peripherals/usb_device.rst api-reference/peripherals/touch_element.rst api-reference/peripherals/touch_pad.rst api-reference/peripherals/adc_calibration.rst diff --git a/docs/en/api-reference/peripherals/usb_device.rst b/docs/en/api-reference/peripherals/usb_device.rst index a41e85ffa8..696ae83509 100644 --- a/docs/en/api-reference/peripherals/usb_device.rst +++ b/docs/en/api-reference/peripherals/usb_device.rst @@ -5,9 +5,9 @@ USB Device Stack {IDF_TARGET_USB_DP_GPIO_NUM:default="20"} {IDF_TARGET_USB_DM_GPIO_NUM:default="19"} -{IDF_TARGET_USB_EP_NUM:default="6"} -{IDF_TARGET_USB_EP_NUM_INOUT:default="5"} -{IDF_TARGET_USB_EP_NUM_IN:default="1"} +{IDF_TARGET_USB_EP_NUM: default="6", esp32p4="15"} +{IDF_TARGET_USB_EP_NUM_INOUT:default="5", esp32p4="8"} +{IDF_TARGET_USB_EP_NUM_IN:default="1", esp32p4="7"} Overview -------- @@ -34,16 +34,24 @@ Features Hardware Connection ------------------- -The {IDF_TARGET_NAME} routes the USB D+ and D- signals to GPIOs {IDF_TARGET_USB_DP_GPIO_NUM} and {IDF_TARGET_USB_DM_GPIO_NUM} respectively. For USB device functionality, these GPIOs should be connected to the bus in some way (e.g., via a Micro-B port, USB-C port, or directly to standard-A plug). +.. only:: esp32s2 or esp32s3 + + The {IDF_TARGET_NAME} routes the USB D+ and D- signals to GPIOs {IDF_TARGET_USB_DP_GPIO_NUM} and {IDF_TARGET_USB_DM_GPIO_NUM} respectively. For USB device functionality, these GPIOs should be connected to the bus in some way (e.g., via a Micro-B port, USB-C port, or directly to standard-A plug). + +.. only:: esp32p4 + + The {IDF_TARGET_NAME} routes the USB D+ and D- signals to their dedicated pins. For USB device functionality, these pins should be connected to the bus in some way (e.g., via a Micro-B port, USB-C port, or directly to standard-A plug). .. figure:: ../../../_static/usb-board-connection.png :align: center :alt: Connection of an USB GPIOs directly to a USB standard-A plug :figclass: align-center -.. note:: +.. only:: esp32s2 or esp32s3 - If you are using an {IDF_TARGET_NAME} development board with two USB ports, the port labeled "USB" will already be connected to the D+ and D- GPIOs. + .. note:: + + If you are using an {IDF_TARGET_NAME} development board with two USB ports, the port labeled "USB" will already be connected to the D+ and D- GPIOs. .. note:: @@ -95,15 +103,17 @@ Full-speed devices should initialize the following field to provide their config - :cpp:member:`configuration_descriptor` -High-speed devices should initialize the following fields to provide configuration descriptors at each speed: +.. only:: esp32p4 -- :cpp:member:`fs_configuration_descriptor` -- :cpp:member:`hs_configuration_descriptor` -- :cpp:member:`qualifier_descriptor` + High-speed devices should initialize the following fields to provide configuration descriptors at each speed: -.. note:: + - :cpp:member:`fs_configuration_descriptor` + - :cpp:member:`hs_configuration_descriptor` + - :cpp:member:`qualifier_descriptor` - When Device Stack supports high-speed, both :cpp:member:`fs_configuration_descriptor` and :cpp:member:`hs_configuration_descriptor` should be present to comply with usb2.0 specification. + .. note:: + + Both :cpp:member:`fs_configuration_descriptor` and :cpp:member:`hs_configuration_descriptor` must be present to comply with USB 2.0 specification. The Device Stack will instantiate a USB device based on the descriptors provided in the fields described above when :cpp:func:`tinyusb_driver_install` is called. diff --git a/docs/zh_CN/api-reference/peripherals/usb_device.rst b/docs/zh_CN/api-reference/peripherals/usb_device.rst index 90cd258352..0498e5637a 100644 --- a/docs/zh_CN/api-reference/peripherals/usb_device.rst +++ b/docs/zh_CN/api-reference/peripherals/usb_device.rst @@ -5,9 +5,9 @@ USB 设备栈 {IDF_TARGET_USB_DP_GPIO_NUM:default="20"} {IDF_TARGET_USB_DM_GPIO_NUM:default="19"} -{IDF_TARGET_USB_EP_NUM:default="6"} -{IDF_TARGET_USB_EP_NUM_INOUT:default="5"} -{IDF_TARGET_USB_EP_NUM_IN:default="1"} +{IDF_TARGET_USB_EP_NUM: default="6", esp32p4="15"} +{IDF_TARGET_USB_EP_NUM_INOUT:default="5", esp32p4="8"} +{IDF_TARGET_USB_EP_NUM_IN:default="1", esp32p4="7"} 概述 -------- @@ -34,16 +34,24 @@ USB 设备栈(以下简称设备栈)支持在 {IDF_TARGET_NAME} 上启用 US 硬件连接 -------- -{IDF_TARGET_NAME} 将 USB D+ 和 D- 信号分别路由到 GPIO {IDF_TARGET_USB_DP_GPIO_NUM} 和 {IDF_TARGET_USB_DM_GPIO_NUM}。为了实现 USB 设备功能,这些 GPIO 应通过某种方式连接到总线上(例如,通过 Micro-B 端口、USB-C 端口或直接连接到标准-A 插头)。 +.. only:: esp32s2 or esp32s3 + + {IDF_TARGET_NAME} 将 USB D+ 和 D- 信号分别路由到 GPIO {IDF_TARGET_USB_DP_GPIO_NUM} 和 {IDF_TARGET_USB_DM_GPIO_NUM}。为了实现 USB 设备功能,这些 GPIO 应通过某种方式连接到总线(例如,通过 Micro-B 端口、USB-C 端口或直接连接到标准-A 插头)。 + +.. only:: esp32p4 + + {IDF_TARGET_NAME} 将 USB D+ 和 D- 信号路由到其专用引脚。为了实现 USB 设备功能,这些引脚应通过某种方式连接到总线(例如,通过 Micro-B 端口、USB-C 端口或直接连接到标准-A 插头)。 .. figure:: ../../../_static/usb-board-connection.png :align: center :alt: 将 USB GPIO 直接接连至 USB 标准-A 插头 :figclass: align-center -.. note:: +.. only:: esp32s2 or esp32s3 - 如果你使用带有两个 USB 端口的 {IDF_TARGET_NAME} 开发板,标有 "USB" 的端口已经连接到 D+ 和 D- GPIO。 + .. note:: + + 如果你使用带有两个 USB 端口的 {IDF_TARGET_NAME} 开发板,标有 "USB" 的端口已经连接到 D+ 和 D- GPIO。 .. note:: @@ -90,6 +98,22 @@ USB 设备栈(以下简称设备栈)支持在 {IDF_TARGET_NAME} 上启用 US - :cpp:member:`configuration_descriptor` - :cpp:member:`string_descriptor` +全速 USB 设备应初始化以下字段,以提供相应的配置描述符: + +- :cpp:member:`configuration_descriptor` + +.. only:: esp32p4 + + 高速 USB 设备应初始化以下字段,以提供不同速度下的配置描述符: + + - :cpp:member:`fs_configuration_descriptor` + - :cpp:member:`hs_configuration_descriptor` + - :cpp:member:`qualifier_descriptor` + + .. note:: + + 为符合 USB 2.0 协议规范,需同时初始化 :cpp:member:`fs_configuration_descriptor` 和 :cpp:member:`hs_configuration_descriptor`。 + 调用 :cpp:func:`tinyusb_driver_install` 时,设备栈将基于上述字段中提供的描述符实现 USB 设备。 设备栈还提供了默认描述符,将 :cpp:func:`tinyusb_driver_install` 中的相应字段设置为 ``NULL`` 即可安装。默认描述符包括: