Skip to content

dfu #5117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: next
Choose a base branch
from
Open

dfu #5117

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions components/dfu.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
DFU Component
=============

The ``dfu`` component enables automatic entry into **DFU (Device Firmware Update)** mode by monitoring
the USB CDC serial connection. When a host opens the port at **1200 baud**, the component triggers
a reset via a GPIO pin to put the device into DFU mode.

ESPHome uses this component internally when uploading firmware via:

.. code-block:: bash

esphome upload d.yaml

If ``dfu`` is configured, ESPHome will open the USB CDC port at 1200 baud to initiate DFU mode before uploading.

Example Configuration
---------------------

.. code-block:: yaml

dfu:
reset_output: reset_gpio

output:
- platform: gpio
pin:
number: 14
inverted: true
mode:
output: true
id: rest_gpio

Configuration variables:
------------------------

- **reset_output** (**Required**, :ref:`config-id`): The id of the
:ref:`output <output>` to use for trigger a hardware reset. This pin should be connected to the MCU's
reset line or to a circuit that causes the bootloader to enter DFU mode after reset.

Behavior:
---------

When the USB CDC serial port is opened at **1200 baud**, the component detects the event and toggles the
``reset_output`` pin to reset the device. This places the MCU into DFU mode, allowing firmware upload tools
(such as ESPHome or `dfu-util`) to perform updates.

This method provides a reliable, button-less way to trigger DFU mode programmatically.

Requirements:
-------------

- USB CDC must be enabled and supported on the platform.
- The device’s bootloader must support DFU mode triggered.

See Also:
---------

- :doc:`/components/output/gpio`
- :ghedit:`Edit`
1 change: 1 addition & 0 deletions components/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,7 @@ Miscellaneous Components
Status LED, components/status_led, led-on.svg, dark-invert
Sun, components/sun, weather-sunny.svg, dark-invert
Tuya MCU, components/tuya, tuya.png
DFU, components/dfu, system-update.svg, dark-invert

.. _cookbook:

Expand Down
Loading