|
|
@@ -3,20 +3,187 @@
|
|
|
|
|
|
:link_to_translation:`en:[English]`
|
|
|
|
|
|
-本章节主要介绍如何创建 {IDF_TARGET_NAME} 和 PC 之间的串口连接。
|
|
|
+.. only:: not SOC_USB_OTG_SUPPORTED and not SOC_USB_SERIAL_JTAG_SUPPORTED
|
|
|
|
|
|
+ 可以使用 USB 至 UART 桥,与 {IDF_TARGET_NAME} 创建串口连接。
|
|
|
+
|
|
|
+.. only:: SOC_USB_OTG_SUPPORTED or SOC_USB_SERIAL_JTAG_SUPPORTED
|
|
|
+
|
|
|
+ 可以使用 USB 至 UART 桥或 {IDF_TARGET_NAME} 支持的 USB 外设,与 {IDF_TARGET_NAME} 创建串口连接。
|
|
|
+
|
|
|
+部分开发板中已经安装有 USB 至 UART 桥。如未安装,可使用外部桥。
|
|
|
+
|
|
|
+.. only:: SOC_USB_OTG_SUPPORTED or SOC_USB_SERIAL_JTAG_SUPPORTED
|
|
|
+
|
|
|
+ 支持的 USB 外设
|
|
|
+ ------------------------
|
|
|
+
|
|
|
+ {IDF_TARGET_NAME} 支持 USB 外设。无需 USB 至 UART 桥,便可直接烧录设备。
|
|
|
+
|
|
|
+ .. blockdiag::
|
|
|
+ :scale: 70%
|
|
|
+ :caption: 支持 USB 的 SoC
|
|
|
+ :align: center
|
|
|
+
|
|
|
+ blockdiag usb_capable_esp {
|
|
|
+
|
|
|
+ node_height = 80;
|
|
|
+ span_width = 160;
|
|
|
+ span_height = 140;
|
|
|
+ default_fontsize = 16
|
|
|
+
|
|
|
+ # labels of diagram nodes
|
|
|
+ PC [label="Personal\n Computer"];
|
|
|
+ CHIP [label="{IDF_TARGET_NAME}", width=120];
|
|
|
+ DUMMY [shape=none, width=1]
|
|
|
+
|
|
|
+
|
|
|
+ # node connections
|
|
|
+ PC <- DUMMY [label = "USB", fontsize=14];
|
|
|
+ DUMMY -> CHIP [fontsize=14];
|
|
|
+
|
|
|
+ group {
|
|
|
+ shape = line;
|
|
|
+ style = dotted;
|
|
|
+ color = "#FF0000";
|
|
|
+ label = "Development Board\n\n\n";
|
|
|
+ CHIP; DUMMY;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ 部分支持 USB 外设的开发板同时也包含 USB 至 UART 桥。
|
|
|
+
|
|
|
+安装有 USB 至 UART 桥的开发板
|
|
|
+---------------------------------------
|
|
|
+
|
|
|
+在安装有 USB 至 UART 桥的开发板中,PC 和桥之间通过 USB 连接,桥和 {IDF_TARGET_NAME} 之间通过 UART 连接。
|
|
|
+
|
|
|
+.. blockdiag::
|
|
|
+ :caption: 安装有 USB 至 UART 桥的开发板
|
|
|
+ :align: center
|
|
|
+
|
|
|
+ blockdiag esp_dev_board_with_usb_to_uart_bridge {
|
|
|
+
|
|
|
+ node_height = 80;
|
|
|
+ span_width = 160;
|
|
|
+ span_height = 140;
|
|
|
+ default_fontsize = 16
|
|
|
+
|
|
|
+ # labels of diagram nodes
|
|
|
+ PC [label="Personal\nComputer"];
|
|
|
+ BRIDGE [label="USB-to-UART\n Bridge"];
|
|
|
+ CHIP [label="{IDF_TARGET_NAME}", width=120];
|
|
|
+
|
|
|
+ # node connections
|
|
|
+ PC <-> BRIDGE [label = "USB", fontsize=14];
|
|
|
+ BRIDGE <-> CHIP [label = "UART", fontsize=14];
|
|
|
+
|
|
|
+ group {
|
|
|
+ shape = line;
|
|
|
+ style = dotted;
|
|
|
+ color = "#FF0000";
|
|
|
+ label = "Developmment Board\n\n\n";
|
|
|
+ BRIDGE; CHIP;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+外部 USB 至 UART 桥
|
|
|
+---------------------------
|
|
|
+
|
|
|
+部分开发板使用外部 USB 至 UART 桥。这种情况通常出现在需要控制空间和成本的产品中,例如一些小型开发板或成品。
|
|
|
+
|
|
|
+.. blockdiag::
|
|
|
+ :caption: 外部 USB 至 UART 桥
|
|
|
+ :align: center
|
|
|
+
|
|
|
+ blockdiag external_usb_to_uart_bridge_to_esp {
|
|
|
+
|
|
|
+ node_height = 80;
|
|
|
+ span_width = 160;
|
|
|
+ span_height = 140;
|
|
|
+ default_fontsize = 16
|
|
|
+
|
|
|
+ # labels of diagram nodes
|
|
|
+ PC [label="Personal\n Computer"];
|
|
|
+ BRIDGE [label="USB-to-UART\n Bridge", width=180];
|
|
|
+ CHIP [label="{IDF_TARGET_NAME}", width=120];
|
|
|
+ DUMMY [shape=none, width=1]
|
|
|
+
|
|
|
+
|
|
|
+ # node connections
|
|
|
+ PC <-> BRIDGE [label = "USB", fontsize=14];
|
|
|
+ BRIDGE <- DUMMY [label = "UART", fontsize=14];
|
|
|
+ DUMMY -> CHIP [fontsize=14];
|
|
|
+
|
|
|
+ group {
|
|
|
+ shape = line;
|
|
|
+ style = dotted;
|
|
|
+ color = "#FF0000";
|
|
|
+ label = "Programmmer Board\n\n\n";
|
|
|
+ BRIDGE
|
|
|
+ }
|
|
|
+ group {
|
|
|
+ shape = line;
|
|
|
+ style = dotted;
|
|
|
+ color = "#FF0000";
|
|
|
+ label = "Development Board\n\n\n";
|
|
|
+ CHIP; DUMMY;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+.. only:: SOC_USB_OTG_SUPPORTED or SOC_USB_SERIAL_JTAG_SUPPORTED
|
|
|
+
|
|
|
+ 使用 USB 进行烧录
|
|
|
+ ------------------
|
|
|
+
|
|
|
+ {IDF_TARGET_NAME} 支持 USB 外设,无需外部 USB 至 UART 桥,即可烧录二进制文件。
|
|
|
+
|
|
|
+ {IDF_TARGET_USB_PIN_DM:default="尚未更新!", esp32c3="GPIO18", esp32s3="GPIO19", esp32s2="GPIO19"}
|
|
|
+ {IDF_TARGET_USB_PIN_DP:default="尚未更新!", esp32c3="GPIO19", esp32s3="GPIO20", esp32s2="GPIO20"}
|
|
|
+
|
|
|
+ {IDF_TARGET_NAME} 上的 USB 使用 **{IDF_TARGET_USB_PIN_DP}** 作为 **D+**, **{IDF_TARGET_USB_PIN_DM}** 作为 **D-**。
|
|
|
+
|
|
|
+ .. only:: SOC_USB_SERIAL_JTAG_SUPPORTED
|
|
|
+
|
|
|
+ .. note:: {IDF_TARGET_NAME} 仅支持 *USB CDC and JTAG*。
|
|
|
+
|
|
|
+ 首次烧录需要手动设置 {IDF_TARGET_NAME} 进入下载模式。请按住 ``BOOT`` 按钮,同时按一下 ``RESET`` 按钮。之后,松开 ``BOOT`` 按钮。
|
|
|
+
|
|
|
+ .. only:: esp32s2
|
|
|
+
|
|
|
+ 二进制文件烧录完成后,需要手动进行复位。
|
|
|
+
|
|
|
+使用 UART 进行烧录
|
|
|
+---------------------
|
|
|
+
|
|
|
+本节描述如何使用 USB 至 UART 桥在 {IDF_TARGET_NAME} 和 PC 之间建立串行连接。板上桥与外部桥均适用。
|
|
|
|
|
|
连接 {IDF_TARGET_NAME} 和 PC
|
|
|
-------------------------------
|
|
|
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
-用 USB 线将 {IDF_TARGET_NAME} 开发板连接到 PC。如果设备驱动程序没有自动安装,请先确认 {IDF_TARGET_NAME} 开发板上的 USB 转串口芯片(或外部转串口适配器)型号,然后在网上搜索驱动程序,并进行手动安装。
|
|
|
+用 USB 线将 {IDF_TARGET_NAME} 开发板连接到 PC。如果设备驱动程序没有自动安装,请先确认 {IDF_TARGET_NAME} 开发板上的 USB 至 UART 桥(或外部转 UART 适配器)型号,然后在网上搜索驱动程序,并进行手动安装。
|
|
|
|
|
|
以下是乐鑫 {IDF_TARGET_NAME} 开发板驱动程序的链接:
|
|
|
|
|
|
* CP210x: `CP210x USB 至 UART 桥 VCP 驱动程序 <https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers>`_
|
|
|
* FTDI: `FTDI 虚拟 COM 端口驱动程序 <https://ftdichip.com/drivers/vcp-drivers/>`_
|
|
|
|
|
|
-以上驱动仅供参考,请参考开发板用户指南,查看开发板具体使用的 USB 转串口芯片。一般情况下,当 {IDF_TARGET_NAME} 开发板与 PC 连接时,对应驱动程序应该已经被打包在操作系统中,并已经自动安装。
|
|
|
+以上驱动仅供参考,请查看开发板用户指南,了解开发板具体使用的 USB 至 UART 桥芯片。一般情况下,当 {IDF_TARGET_NAME} 开发板与 PC 连接时,对应驱动程序应该已经被打包在操作系统中,并已经自动安装。
|
|
|
+
|
|
|
+对于使用 USB 至 UART 桥下载的设备,您可以运行以下命令,包括定义波特率的可选参数。
|
|
|
+
|
|
|
+.. code-block:: bash
|
|
|
+
|
|
|
+ idf.py -p PORT [-b BAUD] flash
|
|
|
+
|
|
|
+如需改变烧录器的波特率,请用需要的波特率代替 ``BAUD``。默认的波特率为 ``460800``。
|
|
|
+
|
|
|
+.. note::
|
|
|
+
|
|
|
+ 如果设备不支持自动下载模式,则需要手动进入下载模式。请按住 ``BOOT`` 按钮,同时按一下 ``RESET`` 按钮。之后,松开 ``BOOT`` 按钮。
|
|
|
|
|
|
在 Windows 上查看端口
|
|
|
---------------------
|
|
|
@@ -39,7 +206,6 @@
|
|
|
|
|
|
Windows 设备管理器中 ESP-WROVER-KIT 的两个 USB 串行端口
|
|
|
|
|
|
-
|
|
|
在 Linux 和 macOS 上查看端口
|
|
|
-----------------------------
|
|
|
|
|
|
@@ -57,7 +223,6 @@ macOS::
|
|
|
|
|
|
对于 macOS 用户:若没有看到串口,请检查是否安装 USB/串口驱动程序。具体应使用的驱动程序,见章节 `连接 {IDF_TARGET_NAME} 和 PC`_。对于 macOS High Sierra (10.13) 的用户,你可能还需要手动允许驱动程序的加载,具体可打开 ``系统偏好设置`` -> ``安全和隐私`` -> ``通用``,检查是否有信息显示:“来自开发人员的系统软件...”,其中开发人员的名称为 Silicon Labs 或 FTDI。
|
|
|
|
|
|
-
|
|
|
.. _linux-dialout-group:
|
|
|
|
|
|
在 Linux 中添加用户到 ``dialout``
|
|
|
@@ -73,7 +238,6 @@ macOS::
|
|
|
|
|
|
请重新登录,确保串口读写权限生效。
|
|
|
|
|
|
-
|
|
|
确认串口连接
|
|
|
------------------------
|
|
|
|
|
|
@@ -100,7 +264,6 @@ Windows 和 Linux 操作系统
|
|
|
|
|
|
在 Linux 操作系统中使用 PuTTY 设置串口通信参数
|
|
|
|
|
|
-
|
|
|
然后,请检查 {IDF_TARGET_NAME} 是否有打印日志。如有,请在终端打开串口进行查看。这里的日志内容取决于加载到 {IDF_TARGET_NAME} 的应用程序,请参考 `输出示例`_。
|
|
|
|
|
|
.. 注解::
|
|
|
@@ -132,7 +295,6 @@ macOS 提供了 **屏幕** 命令,因此您不用安装串口终端程序。
|
|
|
|
|
|
请在验证完串口通信正常后,关闭 **屏幕** 会话。如果直接关闭终端窗口而没有关闭 **屏幕**,之后上传固件时将无法访问串口。
|
|
|
|
|
|
-
|
|
|
输出示例
|
|
|
^^^^^^^^^^^
|
|
|
|
|
|
@@ -158,7 +320,6 @@ macOS 提供了 **屏幕** 命令,因此您不用安装串口终端程序。
|
|
|
entry 0x40080034
|
|
|
I (44) boot: ESP-IDF v2.0-rc1-401-gf9fba35 2nd stage bootloader
|
|
|
I (45) boot: compile time 18:48:10
|
|
|
-
|
|
|
...
|
|
|
|
|
|
如果打印出的日志是可读的(而不是乱码),则表示串口连接正常。此时,您可以继续进行安装,并最终将应用程序上载到 {IDF_TARGET_NAME}。
|