Skip to content

Commit

Permalink
Merge branch 'doc/usb' into 'master'
Browse files Browse the repository at this point in the history
usb translated(English) docs

See merge request ae_group/esp-iot-solution!892
  • Loading branch information
leeebo committed Nov 24, 2023
2 parents cecd288 + 09a33fe commit 0e4d536
Show file tree
Hide file tree
Showing 20 changed files with 397 additions and 380 deletions.
5 changes: 4 additions & 1 deletion docs/conf_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,7 @@

# The name of an image file (relative to this directory) to place at the top of
# the title page.
latex_logo = "../_static/espressif2.pdf"
latex_logo = "../_static/espressif2.pdf"

# add Tracking ID for Google Analytics
google_analytics_id = 'G-YK0H573CWX'
4 changes: 2 additions & 2 deletions docs/en/usb/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ USB Host & Device
:link_to_translation:`zh_CN:[中文]`

.. toctree::
:maxdepth: 1
:maxdepth: 2

USB Overview <usb_overview>
USB OTG <usb_otg>
Expand All @@ -16,4 +16,4 @@ USB Host & Device
USB Device Solution <usb_device_solutions>
USB Self Power Device <usb_device_self_power>
USB Device Set Const COM <usb_device_const_COM>
USB Stream <usb_stream>
usb_driver_index
28 changes: 14 additions & 14 deletions docs/en/usb/usb_device_const_COM.rst
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

阻止 Windows 依据 USB 设备序列号递增 COM 编号
---------------------------------------------
Prevent Windows from incrementing COM numbers based on USB device serial number
--------------------------------------------------------------------------------

由于任何连接到 Windows PC 的设备都通过其 VIDPID Serial 号进行识别。如果这 3 个参数中的任何一个发生了变化,那么 PC 将检测到新的硬件,并与该设备关联一个不同的 COM 端口,详情请参考 `Windows USB device registry entries <https://learn.microsoft.com/en-us/windows-hardware/drivers/usbcon/usb-device-specific-registry-settings>`_\
Due to the fact that any device connected to a Windows PC is identified by its VID (Vendor ID), PID (Product ID), and Serial number. If any of these three parameters undergo a change, the PC will detect new hardware and assigns it to a different COM port. For more details, please refer to the `Windows USB device registry entries <https://learn.microsoft.com/en-us/windows-hardware/drivers/usbcon/usb-device-specific-registry-settings>`_.

ESP ROM Code 中对 USB 描述符配置如下:
In the ESP ROM Code, the configuration of USB descriptors is as follows:

.. list-table::
:header-rows: 1

* -
* -
- ESP32S2
- ESP32S3
- ESP32C3
Expand All @@ -23,21 +23,21 @@ ESP ROM Code 中对 USB 描述符配置如下:
- 0x1001
* - **Serial**
- 0
- MAC 地址字符串
- MAC 地址字符串
- MAC address
- MAC address

* ESP32S2usb-otgSerial 为常量 0,每个设备相同,COM 号一致
* ESP32S3usb-serial-jtag)、ESP32C3usb-serial-jtagSerial 为设备 MAC 地址,每个设备均不同,COM 号默认递增
* For ESP32S2 with USB On-The-Go (usb-otg), the Serial is a constant 0, and it remains the same for every device, resulting in consistent COM port numbers.
* For ESP32S3 (usb-serial-jtag) and ESP32C3 (usb-serial-jtag), the Serial is set to the device MAC address. Each device has a unique MAC address, leading to different COM port numbers by default with incremental assignment.

递增 COM 编号,为量产烧录带来额外工作。对于需要使用 USB 进行固件下载的客户,建议修改 Windows 的递增 COM 编号的规则,阻止依据 Serial 号递增编号。
Incrementing COM numbers pose additional challenges for mass production programming. For customers requiring firmware downloads via USB, it is recommended to modify the Windows rules for incrementing the COM number to prevent incrementing the number based on the Serial number.

解决方案
--------
Solution
^^^^^^^^^^^^^

**管理员方式打开** ``Windows CMD`` , 执行以下指令。该指令将添加注册表项,阻止依据 Serial 号递增编号,\ **设置完成后请重启电脑使能修改**\
**Open Command Prompt in Administrator Mode** ``on Windows``, and execute the following command. This will add a registry entry to prevent incremental numbering based on the Serial number. **After completing the setup, please restart your computer to apply the changes**.

.. code-block:: shell
REG ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\usbflags\303A10010101 /V IgnoreHWSerNum /t REG_BINARY /d 01
用户也可下载 :download:`ignore_hwserial_esp32s3c3.bat <../../_static/ignore_hwserial_esp32s3c3.bat>` 脚本,右键选择管理员方式运行。
Users have the option to download the script :download:`ignore_hwserial_esp32s3c3.bat <../../_static/ignore_hwserial_esp32s3c3.bat>` , then run it with administrative privileges by right-clicking and selecting **Run as Administrator**.
32 changes: 16 additions & 16 deletions docs/en/usb/usb_device_self_power.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@

自供电 USB 设备解决方案
-----------------------
Self-Powered USB Device Solutions
----------------------------------

按照 USB 协议要求,USB 自供电设备必须通过检测 5V VBUS 电压来判断设备是否拔出,进而实现热插拔。对于主机供电设备,由于主机 VBUS 断电之后,设备直接掉电关机,无需实现该逻辑。
According to the USB protocol requirements, self-powered USB devices must detect the 5V VBUS voltage to determine if the device is unplugged, thereby enabling hot-plugging. For host-powered devices, since the device shuts down immediately when the host VBUS is disconnected, there is no need to implement this logic.

USB 设备 VBUS 检测方法一般有两种方法:由 USB PHY 硬件检测,或\ **借助 ADC/GPIO 由软件检测**\
There are generally two methods for USB device VBUS detection: detection by USB PHY hardware, or \ **detection by software with the help of ADC/GPIO**\.

由于 ESP32S2/S3 内部 USB PHY 不支持硬件检测逻辑,该功能需要借助 ADC/GPIO 由软件实现,其中使用 GPIO 检测方法最为简便,实现方法如下:
The internal USB PHY of ESP32S2/S3 does not support hardware detection logic, this function needs to be implemented by software with the help of ADC/GPIO. Among them, using the GPIO detection method is the simplest. The implementation is as follows:

**对于 ESP-IDF 4.4 及更早版本:**
**For ESP-IDF 4.4 and earlier versions:**


#. 硬件上,需要额外占用一个 IO(任意指定,特殊引脚除外),通过两个电阻分压(例如两个 100KΩ )与 ESP32S2/S3 相连 (ESP32S2/S3 IO 最大可输入电压为 3.3v);
#. ``tinyusb_driver_install`` 之后,需要调用 ``usbd_vbus_detect_gpio_enable`` 函数使能 VBUS 检测,该函数实现代码如下,请直接复制到需要调用的位置:
#. On the hardware side, you need to allocate an additional I/O (except for special pins) connected to ESP32S2/S3 through a voltage divider with two resistors (e.g., two 100KΩ). (Note: ESP32S2/S3 I/O maximum input voltage is 3.3v.)
#. After the ``tinyusb_driver_install``, it is necessary to call the ``usbd_vbus_detect_gpio_enable`` function to enable VBUS detection. The implementation code for this function is as follows. Please copy it to the required location for invocation:

.. code-block:: C
Expand All @@ -29,7 +29,7 @@ USB 设备 VBUS 检测方法一般有两种方法:由 USB PHY 硬件检测,
* └───────────────
* The API Must be Called after tinyusb_driver_install to overwrite the default config.
* @param gpio_num, The gpio number used for vbus detect
*
*
*/
static void usbd_vbus_detect_gpio_enable(int gpio_num)
{
Expand All @@ -42,17 +42,17 @@ USB 设备 VBUS 检测方法一般有两种方法:由 USB PHY 硬件检测,
.pull_down_en = 0,
};
gpio_config(&io_conf);
esp_rom_gpio_connect_in_signal(gpio_num, USB_OTG_VBUSVALID_IN_IDX, 0);
esp_rom_gpio_connect_in_signal(gpio_num, USB_SRP_BVALID_IN_IDX, 0);
esp_rom_gpio_connect_in_signal(gpio_num, USB_SRP_SESSEND_IN_IDX, 1);
esp_rom_gpio_connect_in_signal(gpio_num, USB_OTG_VBUSVALID_IN_IDX, 0);
esp_rom_gpio_connect_in_signal(gpio_num, USB_SRP_BVALID_IN_IDX, 0);
esp_rom_gpio_connect_in_signal(gpio_num, USB_SRP_SESSEND_IN_IDX, 1);
return;
}
**对于 ESP-IDF 5.0 及以上版本:**
**For ESP-IDF 5.0 and later versions:**

#. 同上,硬件上需要额外占用一个 IO(任意指定,特殊引脚除外),通过两个电阻分压(例如两个 100KΩ )与 ESP32S2/S3 相连;
#. 将用于检测 VBUS 的 IO 初始化为 GPIO 输入模式;
#. 直接将 IO 配置到 ``tinyusb_config_t`` 中(\ `详情可参考 <https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/peripherals/usb_device.html#self-powered-device>`_\ ):
#. Same as above, the hardware needs to occupy an additional IO (arbitrarily specified, except for special pins), which is connected to ESP32S2/S3 through two resistor voltage dividers (for example, two 100KΩ);
#. Initialize the IO used to detect VBUS to GPIO input mode;
#. Configure IO directly into ``tinyusb_config_t`` (\ `For details, please refer to <https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/peripherals/usb_device. html#self-powered-device>`_\ ):

.. code-block:: C
Expand Down
4 changes: 2 additions & 2 deletions docs/en/usb/usb_device_solutions.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

USB Device 方案
---------------
USB Device Solution
--------------------
9 changes: 9 additions & 0 deletions docs/en/usb/usb_driver_index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
USB Class Drivers
*********************

:link_to_translation:`zh_CN:[中文]`

.. toctree::
:maxdepth: 1

USB Host UVC/UAC <usb_stream>
194 changes: 97 additions & 97 deletions docs/en/usb/usb_host_solutions.rst
Original file line number Diff line number Diff line change
@@ -1,135 +1,135 @@

USB Host 方案
-------------
USB Host Solution
------------------

ESP32-S2/S3 等芯片内置 USB-OTG 外设,支持通过 USB 接口连接多种多样的 USB 设备。以下介绍了 ESP32-S2/S3 芯片支持的 USB Host 解决方案。
ESP32-S2/S3 and similar chips come with built-in USB-OTG peripherals, supporting the connection of various type of USB devices through the USB interface. The following provides an overview of the USB Host solutions supported by the ESP32-S2/S3 chips.

ESP USB Camera 视频方案
^^^^^^^^^^^^^^^^^^^^^^^
ESP USB Camera Video Solution
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

支持通过 USB 接口连接摄像头模组,实现 MJPEG 格式视频流获取和传输,最高可支持 480*800@15fps。适用于猫眼门铃、智能门锁、内窥镜、倒车影像等场景。
Supports the connection of a camera module through the USB interface, enabling the acquisition and transmission of MJPEG format video streams, with a maximum resolution of 480*800@15fps. Ideal for applications such as cat's eye doorbells, smart door locks, endoscopes, rearview cameras, and other scenarios.

特性:
~~~~~
Features:
~~~~~~~~~~


* 快速启动
* 支持热插拔
* 支持 UVC1.1/1.5 规范的摄像头
* 支持自动解析描述符
* 支持动态配置分辨率
* 支持 MJPEG 视频流传输
* 支持批量和同步两种传输模式
* Quick Start
* Hot Plug Support
* Cameras that support UVC1.1/1.5 Specifications
* Automatic Descriptor Parsing
* Dynamic Resolution Configuration
* MJPEG Video Stream Transmission
* Bulk or Isochronous Transfer Modes

硬件:
~~~~~
Hardware:
~~~~~~~~~~


* 芯片: ESP32-S2ESP32-S3
* 外设:USB-OTG
* USB 摄像头:支持 MJPEG 格式,批量传输模式下 800*480@15fps,同步传输模式下 480*320@15fps,摄像头限制详见 `usb_stream API 说明 <https://docs.espressif.com/projects/esp-iot-solution/zh_CN/latest/usb/usb_stream.html>`_
* Chips: ESP32-S2, ESP32-S3
* Peripherals: USB-OTG
* USB Camera: Supports MJPEG format, with a bulk transfer mode of 800*480@15fps, or an isochronous transfer mode of 480*320@15fps. For camera limitations, refer to the `usb_stream API documentation <https://docs.espressif.com/projects/esp-iot-solution/en/latest/usb/usb_stream.html>`_.

链接:
~~~~~
links:
~~~~~~~

* `usb_stream 组件 <https://components.espressif.com/components/espressif/usb_stream>`_
* `usb_stream API 说明 <https://docs.espressif.com/projects/esp-iot-solution/zh_CN/latest/usb/usb_stream.html>`_
* `USB Camera Demo 视频 <https://www.bilibili.com/video/BV18841137qT>`_
* 示例代码: USB 摄像头 + WiFi 图传 :example:`usb/host/usb_camera_mic_spk`
* 示例代码: USB 摄像头 + LCD 本地刷屏 :example:`usb/host/usb_camera_lcd_display`
* `usb_stream component <https://components.espressif.com/components/espressif/usb_stream>`_
* `usb_stream API reference <https://docs.espressif.com/projects/esp-iot-solution/en/latest/usb/usb_stream.html>`_
* `USB Camera Demo video <https://www.bilibili.com/video/BV18841137qT>`_
* Example Code: USB Camera + WiFi Image Transmission: :example:`usb/host/usb_camera_mic_spk`
* Example Code: USB Camera + Local Screen Display with LCD: :example:`usb/host/usb_camera_lcd_display`


ESP USB Audio 音频方案
^^^^^^^^^^^^^^^^^^^^^^
ESP USB Audio Solution
^^^^^^^^^^^^^^^^^^^^^^^^

支持通过 USB 接口连接 USB 音频设备,实现 PCM 格式音频流获取和传输,可同时支持多路 48KHz 16bit 扬声器和多路 48KHz 16bit 马克风。支持 Type-C 接口耳机,适用于音频播放器等场景。支持和 UVC 同时工作,适用于门铃对讲等场景。
Supports connecting USB audio devices through the USB interface, enabling PCM format audio stream acquisition and transmission. It can simultaneously support multiple channels of 48KHz 16bit speakers and multiple channels of 48KHz 16bit microphones. Also supports Type-C interface headphones, suitable for audio playback scenarios. It can operate simultaneously with UVC, making it suitable for scenarios such as doorbell intercoms.

特性:
~~~~~
Features:
~~~~~~~~~~


* 快速启动
* 支持热插拔
* 支持自动解析描述符
* 支持 PCM 音频流传输
* 支持动态修改采样率
* 支持多通道扬声器
* 支持多通道麦克风
* 支持音量、静音控制
* 支持和 USB Camera 同时工作
* Quick Start
* Hot Swap
* Automatic Parsing Descriptors
* PCM Audio Format
* Dynamic Modification of Sampling Rate
* Multi-Channel Speakers
* Multi-Channel Microphone
* Support Volume and Mute Control
* Support Simultaneous Work with USB Camera

硬件:
~~~~~
Hardware:
~~~~~~~~~~

* 芯片: ESP32-S2ESP32-S3
* 外设:USB-OTG
* USB 音频设备:支持 PCM 格式
* Chips: ESP32-S2, ESP32-S3
* Peripherals: USB-OTG
* USB Audio Devices: Supports PCM format

链接:
~~~~~
Links:
~~~~~~~~

* `usb_stream 组件 <https://components.espressif.com/components/espressif/usb_stream>`_
* `usb_stream API 说明 <https://docs.espressif.com/projects/esp-iot-solution/zh_CN/latest/usb/usb_stream.html>`_
* `USB Audio Demo 视频 <https://www.bilibili.com/video/BV1LP411975W>`_
* 示例代码: MP3 音乐播放器 + USB 耳机 :example:`usb/host/usb_audio_player`
* `usb_stream components <https://components.espressif.com/components/espressif/usb_stream>`_
* `usb_stream API reference <https://docs.espressif.com/projects/esp-iot-solution/en/latest/usb/usb_stream.html>`_
* `USB Audio Demo video <https://www.bilibili.com/video/BV1LP411975W>`_
* Example Code: MP3 Music Player + USB Headphones: :example:`usb/host/usb_audio_player`

ESP USB 4G 联网方案
^^^^^^^^^^^^^^^^^^^
ESP USB 4G Networking Solutions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

支持通过 USB 接口连接 4G Cat.1Cat.4 模组,实现 PPP 拨号上网。支持通过 Wi-Fi SoftAP 热点共享互联网给其它设备。适用于物联网网关、MiFi 移动热点、智慧储能、广告灯箱等场景。
Supports connecting 4G Cat.1 or Cat.4 modules via the USB interface, enabling PPP dial-up for internet access. It also supports sharing the internet via Wi-Fi SoftAP hotspot for other devices. Suitable for IoT gateways, MiFi mobile hotspots, smart energy storage, advertising lightboxes, and other scenarios.

特性:
~~~~~
Features:
~~~~~~~~~~

* 快速启动
* 支持热插拔
* 支持 Modem+AT 双接口(需要模组支持)
* 支持 PPP 标准协议 (大部分 4G 模组均支持)
* 支持 4G Wi-Fi 热点
* 支持 NAPT 网络地址转换
* 支持电源管理
* 支持网络自动恢复
* 支持卡检测、信号质量检测
* 支持网页配置界面
* Quick Start
* Hot Plug
* Modem+AT Dual Interface
* PPP Standard Protocol
* 4G to Wi-Fi Hotspot Support
* NAPT (Network Address and Port Translation) Support
* Power Management Support
* Automatic Network Recovery
* SIM Card Detection and Signal Quality Monitoring
* Web-based Configuration Interface

硬件:
~~~~~
Hardware:
~~~~~~~~~~

* 芯片: ESP32-S2ESP32-S3
* 外设:USB-OTG
* 4G 模组:支持 Cat.1 Cat.4 等网络制式 4G 模组,需要模组支持 PPP 协议
* Chips: ESP32-S2, ESP32-S3
* Peripherals: USB-OTG
* 4G Modules: Supports Cat.1, Cat.4, and other network standard 4G modules, requiring module support for the PPP protocol.

链接:
~~~~~
Links:
~~~~~~~

* `USB 4G Demo 视频 <https://www.bilibili.com/video/BV1fj411K7bW>`_
* `iot_usbh_modem 组件 <https://components.espressif.com/components/espressif/iot_usbh_modem>`_
* 示例代码: 4G Wi-Fi 路由器 :example:`usb/host/usb_cdc_4g_module`
* `USB 4G Demo video <https://www.bilibili.com/video/BV1fj411K7bW>`_
* `iot_usbh_modem component <https://components.espressif.com/components/espressif/iot_usbh_modem>`_
* Example Code: 4G Wi-Fi Router: :example:`usb/host/usb_cdc_4g_module`

ESP USB 存储方案
^^^^^^^^^^^^^^^^
ESP USB Storage Solution
^^^^^^^^^^^^^^^^^^^^^^^^^

支持通过 USB 接口连接标准 U 盘设备(兼容 USB3.1/3.0/2.0 协议 U 盘),支持将 U 盘挂载到 FatFS 文件系统,实现文件的读写。适用于户外广告灯牌、考勤机、移动音响、记录仪等应用场景。
Supports connecting standard USB flash drives via the USB interface (compatible with USB 3.1/3.0/2.0 protocols), and can mount the USB flash drive to the FatFS file system for file read and write operations. Suitable for outdoor advertising billboards, attendance machines, mobile speakers, recorders, and other application scenarios.

特性:
~~~~~
Features:
~~~~~~~~~~

* 兼容 USB3.1/3.0/2.0 U 盘
* 默认支持最大 32G
* 支持热插拔
* 支持 Fat32/exFat 格式
* 支持文件系统读写
* 支持 U 盘 OTA
* Compatible with USB 3.1/3.0/2.0 Flash Drives
* Default Support for Up to 32GB
* Hot Plug
* Support for Fat32/exFAT Formats
* File System Read and Write
* USB Flash Drive Over-The-Air (OTA) Update

硬件:
~~~~~
Hardware:
~~~~~~~~~~

* 芯片: ESP32-S2ESP32-S3
* 外设:USB-OTG
* U 盘:格式化为 Fat32 格式,默认支持 32GB 以内 U 盘。大于 32GB 需要在文件系统开启 exFat
* Chips: ESP32-S2, ESP32-S3
* Peripherals: USB-OTG
* USB Flash Drive: Formatted as Fat32 by default, with support for USB drives up to 32GB. Drives larger than 32GB require exFAT file system support.

链接:
~~~~~
Links:
~~~~~~~

* `usb_host_msc 组件 <https://components.espressif.com/components/espressif/usb_host_msc>`_
* `示例代码: 挂载 U 盘 + 文件系统访问 <https://github.com/espressif/esp-idf/tree/master/examples/peripherals/usb/host/msc>`_
* `usb_host_msc component <https://components.espressif.com/components/espressif/usb_host_msc>`_
* Example Code: Mounting USB Flash Drive + File System Access `here <https://github.com/espressif/esp-idf/tree/master/examples/peripherals/usb/host/msc>`_
Loading

0 comments on commit 0e4d536

Please sign in to comment.