esp-idf Cannot open DFU device WEMOS LOLIN S2 mini

MKontrol
Posts: 3
Joined: Mon Jan 16, 2023 5:41 am

esp-idf Cannot open DFU device WEMOS LOLIN S2 mini

Postby MKontrol » Mon Jan 16, 2023 1:08 pm

hello,
I'm trying to load the default Hello_world example from esp-idf into a WEMOS LOLIN S2 mini board.
The device is connected and put into DFU mode.

Code: Select all

E:\_esp-idf\hello_world>idf.py  --version
ESP-IDF v5.0
E:\_esp-idf\hello_world>idf.py build
E:\_esp-idf\hello_world>idf.py dfu 
E:\_esp-idf\hello_world>idf.py dfu-flash
The last command prints an error:

Code: Select all

E:\_esp-idf\hello_world>idf.py dfu-flash
...
Command list: dfu-util;-d;303a:2;-D;E:/Documents/Arduino/_esp-idf/hello_world/build/dfu.bin
dfu-util 0.9
Cannot open DFU device 303a:0002
No DFU capable USB device available
CMake Error at E:/Espressif/frameworks/esp-idf-v5.0/tools/cmake/run_dfu_util.cmake:27 (message):
  dfu-util failed
The dfu-list command also throws an error:

Code: Select all

E:\_esp-idf\hello_world>idf.py dfu-list
Cannot open DFU device 303a:0002
Done
In the Arduino IDE and under VS Code with the Platformio extension, the module, switched to the bootloader mode with the buttons, flashing and works correctly.

Please tell me how to get esp-idf to work properly.
Thank you!

MKontrol
Posts: 3
Joined: Mon Jan 16, 2023 5:41 am

Re: esp-idf Cannot open DFU device WEMOS LOLIN S2 mini (IDFGH-9162)

Postby MKontrol » Tue Jan 17, 2023 11:07 am

Part of the problem was solved by upgrading the dfu-util version to 0.11
and installing the libusbK driver using the Zadig program.
Now the output when running the utilities looks like this:

Code: Select all

E:\Documents\Arduino\_esp-idf\hello_world>idf.py dfu-list
Executing action: dfu-list
Running ninja in directory e:\documents\arduino\_esp-idf\hello_world\build
Executing "ninja dfu-list"...
[0/1] cmd.exe /C "cd /D E:\Documents\Arduino\_esp-idf\hello_world\build && E:\Espressif\tools\cmake\3.24.0\bin\cmake.exe -D ESP_DFU_LIST="1" -P E:/Espressif/frameworks/esp-idf-v5.0/tools/cmake/run_dfu_util.cmake"
Command list: dfu-util;--list
dfu-util 0.11
[...]
Found Runtime: [303a:0002] ver=0723, devnum=37, cfg=1, intf=2, path="1-8", alt=0, name="UNKNOWN", serial="0"
Done

Code: Select all

E:\Documents\Arduino\_esp-idf\hello_world>idf.py dfu
Adding "dfu"'s dependency "all" to list of commands with default set of options.
Executing action: all (aliases: build)
Running ninja in directory e:\documents\arduino\_esp-idf\hello_world\build
Executing "ninja all"...
[1/4] cmd.exe /C "cd /D E:\Documents\Arduino\_esp-idf\hell...uments/Arduino/_esp-idf/hello_world/build/hello_world.bin"hello_world.bin binary size 0x271f0 bytes. Smallest app partition is 0x100000 bytes. 0xd8e10 bytes (85%) free.
[1/1] cmd.exe /C "cd /D E:\Documents\Arduino\_esp-idf\hell...uino/_esp-idf/hello_world/build/bootloader/bootloader.bin"Bootloader binary size 0x5420 bytes. 0x1be0 bytes (25%) free.
Executing action: dfu
Running ninja in directory e:\documents\arduino\_esp-idf\hello_world\build
Executing "ninja dfu"...
[1/4] Performing build step for 'bootloader'
[1/1] cmd.exe /C "cd /D E:\Documents\Arduino\_esp-idf\hello_world\build\bootloader\esp-idf\esptool_py && E:\Espressif\python_env\idf5.0_py3.8_env\Scripts\python.exe E:/Espressif/frameworks/esp-idf-v5.0/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x1000 E:/Documents/Arduino/_esp-idf/hello_world/build/bootloader/bootloader.bin"
Bootloader binary size 0x5420 bytes. 0x1be0 bytes (25%) free.
[1/2] cmd.exe /C "cd /D E:\Documents\Arduino\_esp-idf\hello_world\build && E:\Espressif\python_env\idf5.0_py3.8_env\Scripts\python.exe E:/Espressif/frameworks/esp-idf-v5.0/tools/mkdfu.py write -o E:/Documents/Arduino/_esp-idf/hello_world/build/dfu.bin --json E:/Documents/Arduino/_esp-idf/hello_world/build/flasher_args.json --pid 2 --flash-size 4MB"
Adding flash chip parameters file with flash_size = 4MB
Adding bootloader\bootloader.bin at 0x1000
Adding partition_table\partition-table.bin at 0x8000
Adding hello_world.bin at 0x10000
"E:/Documents/Arduino/_esp-idf/hello_world/build/dfu.bin" has been written. You may proceed with DFU flashing.
Done

Code: Select all

E:\Documents\Arduino\_esp-idf\hello_world>idf.py dfu-flash
Executing action: dfu-flash
Running ninja in directory e:\documents\arduino\_esp-idf\hello_world\build
Executing "ninja dfu-flash"...
[0/1] cmd.exe /C "cd /D E:\Documents\Arduino\_esp-idf\hello_world\build && E:\Espressif\tools\cmake\3.24.0\bin\cmake.exe -D ESP_DFU_BIN="E:/Documents/Arduino/_esp-idf/hello_world/build/dfu.bin" -D ESP_DFU_PID="2" -P E:/Espressif/frameworks/esp-idf-v5.0/tools/cmake/run_dfu_util.cmake"
Command list: dfu-util;-d;303a:2;-D;E:/Documents/Arduino/_esp-idf/hello_world/build/dfu.bin
dfu-util 0.11

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Opening DFU capable USB device...
Device ID 303a:0002
Run-Time device DFU version 0110
Claiming USB DFU (Run-Time) Interface...
Setting Alternate Interface zero...
Determining device status...
DFU state(0) = appIDLE, status(0) = No error condition is present
Device really in Run-Time Mode, send DFU detach request...
Device will detach and reattach...
Opening DFU USB Device...
Claiming USB DFU Interface...
Setting Alternate Interface #0 ...
Determining device status...
DFU state(2) = dfuIDLE, status(0) = No error condition is present
DFU mode device DFU version 0110
Device returned transfer size 64
Copying data from PC to DFU device
Download        [=========================] 100%       194560 bytes
Download done.
DFU state(2) = dfuIDLE, status(0) = No error condition is present
Done!
error detaching
Done
But after resetting the device, a new COM-port does not appear in the system, that is, the downloaded firmware does not work.
Any ideas?

Who is online

Users browsing this forum: No registered users and 122 guests