mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-07 20:00:53 +00:00
Merge branch 'feat/dfu_p4' into 'master'
feat(dfu): Enable DFU on ESP32-P4 Closes IDF-7757 See merge request espressif/esp-idf!35539
This commit is contained in:
@@ -3,9 +3,21 @@ Device Firmware Upgrade via USB
|
||||
|
||||
:link_to_translation:`zh_CN:[中文]`
|
||||
|
||||
Typically, the firmware of the {IDF_TARGET_NAME} is flashed via the chip's serial port. However, flashing via the serial port requires a USB to serial converter chip (e.g., CP210x or FTDI) to be connected to the {IDF_TARGET_NAME} (see :doc:`Establish Serial Connection with {IDF_TARGET_NAME} <../get-started/establish-serial-connection>` for more details). The {IDF_TARGET_NAME} contains a USB OTG peripheral making it possible to connect the {IDF_TARGET_NAME} to the host directly via USB (thus not requiring a USB to serial converter chip).
|
||||
.. only:: not SOC_USB_SERIAL_JTAG_SUPPORTED
|
||||
|
||||
Device Firmware Upgrade (DFU) is a mechanism for upgrading the firmware of the {IDF_TARGET_NAME} directly via the Universal Serial Bus (USB). However, enabling Secure Boot or flash encryption disables the USB-OTG USB stack in the ROM, disallowing updates via the serial emulation or DFU on that port.
|
||||
Typically, the firmware of {IDF_TARGET_NAME} is flashed via the chip's serial port. However, flashing via the serial port requires a USB to serial converter chip (e.g., CP210x or FTDI) to be connected to {IDF_TARGET_NAME}. Please see :doc:`Establish Serial Connection with {IDF_TARGET_NAME} <../get-started/establish-serial-connection>` for more details. {IDF_TARGET_NAME} contains a USB OTG peripheral, making it possible to connect {IDF_TARGET_NAME} to the host directly via USB (thus not requiring a USB to serial converter chip).
|
||||
|
||||
.. only:: SOC_USB_SERIAL_JTAG_SUPPORTED
|
||||
|
||||
Typically, the firmware of {IDF_TARGET_NAME} is flashed via the chip's serial port or USB_SERIAL_JTAG (see :doc:`Establish Serial Connection with {IDF_TARGET_NAME} <../get-started/establish-serial-connection>` for more details). {IDF_TARGET_NAME} also contains a USB OTG peripheral making it possible to connect {IDF_TARGET_NAME} to the host directly via USB Device Firmware Upgrade.
|
||||
|
||||
.. only:: esp32s3
|
||||
|
||||
By default, the :doc:`USB_SERIAL_JTAG <usb-serial-jtag-console>` module is connected to {IDF_TARGET_NAME}'s internal USB PHY, while the USB OTG peripheral can be used only if an external USB PHY is connected. Since DFU is provided via the USB OTG peripheral, it cannot be used through the internal PHY in this configuration.
|
||||
|
||||
However, you can permanently switch the internal USB PHY to work with USB OTG peripheral instead of USB_SERIAL_JTAG by burning the ``USB_PHY_SEL`` eFuse. See *{IDF_TARGET_NAME} Technical Reference Manual* [`PDF <{IDF_TARGET_TRM_EN_URL}>`__] for more details about USB_SERIAL_JTAG and USB OTG.
|
||||
|
||||
Device Firmware Upgrade (DFU) is a mechanism for upgrading the firmware of {IDF_TARGET_NAME} directly via the Universal Serial Bus (USB). However, enabling Secure Boot or flash encryption disables the USB-OTG USB stack in the ROM, disallowing updates via the serial emulation or DFU on that port.
|
||||
|
||||
- :ref:`get-started-get-prerequisites` of the Getting Started Guide introduces the software requirements of DFU.
|
||||
- Section :ref:`api_guide_dfu_build` describes how to build firmware for DFU with ESP-IDF.
|
||||
@@ -15,40 +27,40 @@ Device Firmware Upgrade (DFU) is a mechanism for upgrading the firmware of the {
|
||||
USB Connection
|
||||
--------------
|
||||
|
||||
The necessary connections for the {IDF_TARGET_NAME}'s internal USB PHY (transceiver) are shown in the following table:
|
||||
.. only:: esp32p4
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
:widths: 25 20
|
||||
{IDF_TARGET_NAME} routes the USB D+ and D- signals to their dedicated pins. For USB device functionality, these pins must be connected to the USB bus (e.g., via a Micro-B port, USB-C port, or directly to standard-A plug).
|
||||
|
||||
* - GPIO
|
||||
- USB
|
||||
.. only:: esp32s2 or esp32s3
|
||||
|
||||
* - 20
|
||||
- D+ (green)
|
||||
The necessary connections for {IDF_TARGET_NAME}'s internal USB PHY (transceiver) are shown in the following table:
|
||||
|
||||
* - 19
|
||||
- D- (white)
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
:widths: 25 20
|
||||
|
||||
* - GND
|
||||
- GND (black)
|
||||
* - GPIO
|
||||
- USB
|
||||
|
||||
* - +5V
|
||||
- +5V (red)
|
||||
* - 20
|
||||
- D+ (green)
|
||||
|
||||
* - 19
|
||||
- D- (white)
|
||||
|
||||
* - GND
|
||||
- GND (black)
|
||||
|
||||
* - +5V
|
||||
- +5V (red)
|
||||
|
||||
.. warning::
|
||||
|
||||
Some cables are wired up with non-standard colors and some drivers are able to work with swapped D+ and D- connections. Please try to swap the cables connecting to D+ and D- if your device is not detected.
|
||||
|
||||
.. only:: esp32s3
|
||||
|
||||
By default, the :doc:`USB_SERIAL_JTAG <usb-serial-jtag-console>` module is connected to the {IDF_TARGET_NAME}'s internal USB PHY, while the USB OTG peripheral can be used only if an external USB PHY is connected. Since DFU is provided via the USB OTG peripheral, it cannot be used through the internal PHY in this configuration.
|
||||
|
||||
However, users can permanently switch the internal USB PHY to work with USB OTG peripheral instead of USB_SERIAL_JTAG by burning the ``USB_PHY_SEL`` eFuse. See *{IDF_TARGET_NAME} Technical Reference Manual* [`PDF <{IDF_TARGET_TRM_EN_URL}>`__] for more details about USB_SERIAL_JTAG and USB OTG.
|
||||
|
||||
.. note::
|
||||
|
||||
The {IDF_TARGET_NAME} chip needs to be in bootloader mode before it can be detected as a DFU device and flash. This can be achieved by pulling GPIO0 down (e.g., pressing the BOOT button), pulling RESET down for a moment, and releasing GPIO0.
|
||||
{IDF_TARGET_NAME} chip needs to be in bootloader mode before it can be detected as a DFU device and flash. Please refer to `Boot Mode Selection <https://docs.espressif.com/projects/esptool/en/latest/{IDF_TARGET_PATH_NAME}/advanced-topics/boot-mode-selection.html#select-bootloader-mode>`_ for more information about how to enter bootloader mode.
|
||||
|
||||
|
||||
.. _api_guide_dfu_build:
|
||||
@@ -70,7 +82,7 @@ The command below will create a DFU image named ``dfu.bin`` that is placed in th
|
||||
Flashing the DFU Image
|
||||
----------------------
|
||||
|
||||
The command below will download the DFU image into the {IDF_TARGET_NAME}::
|
||||
The command below will download the DFU image into {IDF_TARGET_NAME}::
|
||||
|
||||
idf.py dfu-flash
|
||||
|
||||
@@ -98,7 +110,7 @@ See :ref:`api_guide_dfu_flash_errors` and their solutions.
|
||||
Udev Rule (Linux Only)
|
||||
----------------------
|
||||
|
||||
Udev is a device manager for the Linux kernel. It allows us to run ``dfu-util`` (and ``idf.py dfu-flash``) without ``sudo`` for gaining access to the chip.
|
||||
Udev is a device manager for the Linux kernel. It allows running ``dfu-util`` (and ``idf.py dfu-flash``) without ``sudo`` for gaining access to the chip.
|
||||
|
||||
Create file ``/etc/udev/rules.d/40-dfuse.rules`` with the following content::
|
||||
|
||||
@@ -106,7 +118,7 @@ Create file ``/etc/udev/rules.d/40-dfuse.rules`` with the following content::
|
||||
|
||||
.. note::
|
||||
|
||||
Please check the output of the command ``groups``. The user has to be a member of the `GROUP` specified above. You may use some other existing groups for this purpose (e.g., `uucp` on some systems instead of `plugdev`) or create a new group for this purpose.
|
||||
Please check the output of the command ``groups``. You need to be a member of the `GROUP` specified above. You may use some other existing groups for this purpose (e.g., `uucp` on some systems instead of `plugdev`) or create a new group for this purpose.
|
||||
|
||||
Restart your computer so the previous setting could take into affect or run ``sudo udevadm trigger`` to force manually udev to trigger your new rule.
|
||||
|
||||
|
@@ -19,7 +19,7 @@ API Guides
|
||||
core_dump
|
||||
current-consumption-measurement-modules
|
||||
:ESP_ROM_SUPPORT_DEEP_SLEEP_WAKEUP_STUB: deep-sleep-stub
|
||||
:SOC_USB_OTG_SUPPORTED and not esp32p4: dfu
|
||||
:SOC_USB_OTG_SUPPORTED: dfu
|
||||
error-handling
|
||||
:SOC_WIFI_MESH_SUPPORT: esp-wifi-mesh
|
||||
:SOC_SPIRAM_SUPPORTED: external-ram
|
||||
|
Reference in New Issue
Block a user