Skip to content

Commit bd83727

Browse files
authored
[DOCS] Added USB DFU and CDC tools guide (espressif#6756)
* USB CDC and DFU docs * Added DFU and CDC guide for flashing * Added tools menu reference guide * Deleted unrelated file to this PR The file was added by mistake. * Small fix in the Serial.begin mention * Added a not for USB CDC isntead of DFU * PR review changes
1 parent 3d2c056 commit bd83727

File tree

3 files changed

+122
-8
lines changed

3 files changed

+122
-8
lines changed

Diff for: docs/source/tutorials/cdc_dfu_flash.rst

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
########################
2+
USB CDC and DFU Flashing
3+
########################
4+
5+
Introduction
6+
------------
7+
8+
Since the ESP32-S2 introduction, Espressif has been working on USB peripheral support for some of the SoC families, including the ESP32-C3 and the ESP32-S3.
9+
10+
This new peripheral allows a lot of new possibilities, including flashing the firmware directly to the SoC without any external USB-to-Serial converter.
11+
12+
In this tutorial, you will be guided on how to use the embedded USB to flash the firmware.
13+
14+
**The current list of supported SoCs:**
15+
16+
========= =======================
17+
SoC USB Peripheral Support
18+
========= =======================
19+
ESP32-S2 CDC and DFU
20+
ESP32-C3 CDC only
21+
ESP32-S3 CDC and DFU
22+
========= =======================
23+
24+
It's important that your board includes the USB connector attached to the embedded USB from the SoC. If your board doesn't have the USB connector, you can attach an external one to the USB pins.
25+
26+
These instructions it will only work on the supported devices with the embedded USB peripheral. This tutorial will not work if you are using an external USB-to-serial converter like FTDI, CP2102, CH340, etc.
27+
28+
For a complete reference to the Arduino IDE tools menu, please see the `Tools Menus <../guides/tools_menu.html>`_ reference guide.
29+
30+
USB DFU
31+
-------
32+
33+
The USB DFU (Device Firmware Upgrade) is a class specification from the USB standard that adds the ability to upgrade the device firmware by the USB interface.
34+
35+
Flashing Using DFU
36+
******************
37+
38+
.. note::
39+
DFU is only supported by the ESP32-S2 and ESP32-S3. See the table of supported SoCs.
40+
41+
To use the USB DFU to flash the device, you will need to configure some settings in the Arduino IDE according to the following steps:
42+
43+
1. Enter into Download Mode manually
44+
45+
This step is done only for the first time you flash the firmware in this mode. To enter into the download mode, you need to press and hold BOOT button and press and release the RESET button.
46+
47+
To check if this procedure was done correctly, now you will see the new USB device listed in the available ports. Select this new device in the **Port** option.
48+
49+
2. Configure the USB DFU
50+
51+
In the next step you can set the USB DFU as default on BOOT and for flashing.
52+
53+
Go to the Tools menu in the Arduino IDE and set the following options:
54+
55+
**For ESP32-S2**
56+
57+
* USB DFU On Boot -> Enable
58+
59+
* Upload Mode -> Internal USB
60+
61+
**For ESP32-S3**
62+
63+
* USB Mode -> USB-OTG (TinyUSB)
64+
65+
* USB DFU On Boot -> Enabled
66+
67+
Setp 3 - Flash
68+
^^^^^^^^^^^^^^
69+
70+
Now you can upload your sketch to the device. After flashing, you need to manually reset the device.
71+
72+
.. note::
73+
On the USB DFU, you can't use the USB for the serial output for the logging, just for flashing. To enable the serial output, use the CDC option instead.
74+
If you want to use the USB DFU for just upgrading the firmware using the manual download mode, this will work just fine, however, for developing please consider using USB CDC.
75+
76+
77+
USB CDC
78+
-------
79+
80+
The USB CDC (Communications Device Class) allows you to communicate to the device like in a serial interface. This mode can be used on the supported targets to flash and monitor the device in a similar way on devices that uses the external serial interfaces.
81+
82+
To use the USB CDC, you need to configure your device in the Tools menu:
83+
84+
85+
1. Enter into Download Mode manually
86+
87+
Similar to the DFU mode, you will need to enter into download mode manually. To enter into the download mode, you need to press and hold BOOT button and press and release the RESET button.
88+
89+
To check if this procedure was done correctly, now you will see the new USB device listed in the available ports. Select this new device in the **Port** option.
90+
91+
2. Configure the USB CDC
92+
93+
**For ESP32-S2**
94+
95+
* USB CDC On Boot -> Enabled
96+
97+
* Upload Mode -> Internal USB
98+
99+
**For ESP32-C3**
100+
101+
* USB CDC On Boot -> Enabled
102+
103+
**For ESP32-S3**
104+
105+
* USB CDC On Boot -> Enabled
106+
107+
* Upload Mode -> UART0 / Hardware CDC
108+
109+
3. Flash and Monitor
110+
111+
You can now upload your sketch to the device. After flashing for the first time, you need to manually reset the device.
112+
113+
This procedure enables the flashing and monitoring thought the internal USB and does not requires you to manually enter into the download mode or to do the manual reset after flashing.
114+
115+
To monitor the device, you need to select the USB port and open the Monitor tool selecting the correct baud rate (usually 115200) according to the ``Serial.begin()`` defined in your code.
116+
117+
Hardware
118+
--------
119+
120+
If you are developing a custom hardware using the compatible SoC, and want to remove the external USB-to-Serial chip, this feature will complete substitute the needs of the external chip. See the SoC datasheet for more details about this peripheral.

Diff for: docs/source/tutorials/dfu.rst

-6
This file was deleted.

Diff for: docs/source/tutorials/io_mux.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ GPIO Matrix and Pin Mux
55
Introduction
66
------------
77

8-
This is a basic introduction on how the peripherals work in the ESP32. This tutorial can be used to understand
8+
This is a basic introduction to how the peripherals work in the ESP32. This tutorial can be used to understand
99
how to define the peripheral usage and its corresponding pins.
1010

1111
In some microcontrollers' architecture, the peripherals are attached to specific pins and cannot be redefined to another one.
1212

13-
For example.
13+
For example:
1414

1515
The *XYZ* MCU defines that the I2C peripheral SDA signal is the IO5 on the physical pin 10 and the SCL is on the IO6 and physical pin 11.
1616

0 commit comments

Comments
 (0)