mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'doc/update_usj_docs' into 'master'
docs: update usb_serial_jtag documents Closes IDF-3202 and DOC-2301 See merge request espressif/esp-idf!15922
This commit is contained in:
commit
fc14d3f9aa
@ -4,23 +4,26 @@ USB Serial/JTAG Controller Console
|
|||||||
|
|
||||||
On chips with an integrated USB Serial/JTAG Controller, it is possible to use the part of this controller that implements a serial port (CDC) to implement the serial console, instead of using UART with an external USB-UART bridge chip. {IDF_TARGET_NAME} contains this controller, providing the following functions:
|
On chips with an integrated USB Serial/JTAG Controller, it is possible to use the part of this controller that implements a serial port (CDC) to implement the serial console, instead of using UART with an external USB-UART bridge chip. {IDF_TARGET_NAME} contains this controller, providing the following functions:
|
||||||
|
|
||||||
* Bidirectional serial console, which can be used with :doc:`IDF Monitor <tools/idf-monitor>` or another serial monitor
|
* Bidirectional serial console, which can be used with :doc:`IDF Monitor <tools/idf-monitor>` or another serial monitor.
|
||||||
* Flashing using ``esptool.py`` and ``idf.py flash``.
|
* Flashing using ``esptool.py`` and ``idf.py flash``.
|
||||||
* JTAG debugging using e.g. OpenOCD, simultaneous with serial operations
|
* JTAG debugging using e.g. OpenOCD, simultaneous with serial operations.
|
||||||
|
|
||||||
Note that, in contrast with the USB OTG peripheral found in some Espressif chips, the USB Serial/JTAG Controller is a fixed function device, implemented entirely in hardware. This means it cannot be reconfigured to perform any function other than to provide a serial channel and JTAG debugging functionality.
|
Note that, in contrast with the USB OTG peripheral in some Espressif chips, the USB Serial/JTAG Controller is a fixed function device, implemented entirely in hardware. This means it cannot be reconfigured to perform any function other than to provide a serial channel and JTAG debugging functionality.
|
||||||
|
|
||||||
Hardware Requirements
|
Hardware Requirements
|
||||||
=====================
|
=====================
|
||||||
|
|
||||||
|
{IDF_TARGET_USB_DP_GPIO:default="Not Updated!",esp32c3="18",esp32s3="19"}
|
||||||
|
{IDF_TARGET_USB_DM_GPIO:default="Not Updated!",esp32c3="19",esp32s3="20"}
|
||||||
|
|
||||||
Connect {IDF_TARGET_NAME} to the USB port as follows:
|
Connect {IDF_TARGET_NAME} to the USB port as follows:
|
||||||
|
|
||||||
+------+-------------+
|
+------+-------------+
|
||||||
| GPIO | USB |
|
| GPIO | USB |
|
||||||
+======+=============+
|
+======+=============+
|
||||||
| 19 | D+ (green) |
|
| {IDF_TARGET_USB_DP_GPIO} | D+ (green) |
|
||||||
+------+-------------+
|
+------+-------------+
|
||||||
| 18 | D- (white) |
|
| {IDF_TARGET_USB_DM_GPIO} | D- (white) |
|
||||||
+------+-------------+
|
+------+-------------+
|
||||||
| GND | GND (black) |
|
| GND | GND (black) |
|
||||||
+------+-------------+
|
+------+-------------+
|
||||||
@ -36,6 +39,12 @@ USB console feature can be enabled using ``CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG``
|
|||||||
|
|
||||||
Once the option is enabled, build the project as usual.
|
Once the option is enabled, build the project as usual.
|
||||||
|
|
||||||
|
Alternatively, you can access the output through usb_serial_jtag port but make sure the option ``CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG`` in choice ``ESP_CONSOLE_SECONDARY`` is selected.
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
|
||||||
|
Besides output, if you also want to input or use REPL with console, please select ``CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG``.
|
||||||
|
|
||||||
Uploading the Application
|
Uploading the Application
|
||||||
=========================
|
=========================
|
||||||
|
|
||||||
@ -52,5 +61,5 @@ There are several limitations to the USB console feature. These may or may not b
|
|||||||
|
|
||||||
2. If the application enters light sleep (including automatic light sleep) or deep sleep mode, USB CDC device will disappear from the system.
|
2. If the application enters light sleep (including automatic light sleep) or deep sleep mode, USB CDC device will disappear from the system.
|
||||||
|
|
||||||
3. The behaviour between an actual USB-to-serial bridge chip and the USB Serial/JTAG Controller is slightly different if the ESP-IDF application does not listen for incoming bytes. An USB-to-serial bridge chip will just send the bytes to a (not listening) chip, while the USB Serial/JTAG Controller will block until the application reads the bytes. This can lead to a non-responsive looking terminal program.
|
3. The behavior between an actual USB-to-serial bridge chip and the USB Serial/JTAG Controller is slightly different if the ESP-IDF application does not listen for incoming bytes. An USB-to-serial bridge chip will just send the bytes to a (not listening) chip, while the USB Serial/JTAG Controller will block until the application reads the bytes. This can lead to a non-responsive looking terminal program.
|
||||||
|
|
||||||
|
@ -172,6 +172,9 @@ In a typical application, you only need to call :cpp:func:`esp_console_new_repl_
|
|||||||
|
|
||||||
After that, you can register your own commands with :cpp:func:`esp_console_cmd_register`. The REPL environment keeps in init state until you call :cpp:func:`esp_console_start_repl`.
|
After that, you can register your own commands with :cpp:func:`esp_console_cmd_register`. The REPL environment keeps in init state until you call :cpp:func:`esp_console_start_repl`.
|
||||||
|
|
||||||
|
.. only:: SOC_USB_SERIAL_JTAG_SUPPORTED
|
||||||
|
|
||||||
|
Likewise, if your REPL environment is based on USB_SERIAL_JTAG device, you only need to call :cpp:func:`esp_console_new_repl_usb_serial_jtag` at first step. And call other functions as usual.
|
||||||
|
|
||||||
Application Example
|
Application Example
|
||||||
-------------------
|
-------------------
|
||||||
|
@ -170,8 +170,11 @@ Linenoise 库不需要显式地初始化,但是在调用行编辑函数之前
|
|||||||
|
|
||||||
在一个典型的 console 应用中,你只需要调用 :cpp:func:`esp_console_new_repl_uart`,它会为你初始化好构建在 UART 基础上的 REPL 环境,其中包括安装 UART 驱动,基本的 console 配置,创建一个新的线程来执行 REPL 任务,注册一些基本的命令(比如 `help` 命令)。
|
在一个典型的 console 应用中,你只需要调用 :cpp:func:`esp_console_new_repl_uart`,它会为你初始化好构建在 UART 基础上的 REPL 环境,其中包括安装 UART 驱动,基本的 console 配置,创建一个新的线程来执行 REPL 任务,注册一些基本的命令(比如 `help` 命令)。
|
||||||
|
|
||||||
完了之后你可以使用 :cpp:func:`esp_console_cmd_register` 来注册其它命令。REPL 环境在初始化后需要再调用 :cpp:func:`esp_console_start_repl` 函数才能开始运行。
|
之后你可以使用 :cpp:func:`esp_console_cmd_register` 来注册其它命令。REPL 环境在初始化后需要再调用 :cpp:func:`esp_console_start_repl` 函数才能开始运行。
|
||||||
|
|
||||||
|
.. only:: SOC_USB_SERIAL_JTAG_SUPPORTED
|
||||||
|
|
||||||
|
同样,如果 REPL 环境是构建在 USB_SERIAL_JTAG 设备基础上,你只需要先调用 :cpp:func:`esp_console_new_repl_usb_serial_jtag` 函数进行初始化,然后再照常调用其它函数。
|
||||||
|
|
||||||
应用程序示例
|
应用程序示例
|
||||||
------------
|
------------
|
||||||
|
Loading…
Reference in New Issue
Block a user