Does ESP32-S2 DFU support automatic detach / reset?
Posted: Mon Aug 09, 2021 8:31 pm
I'm bringing up a new board with an ESP32-S2F4. I'm able to program the board successfully with DFU if I manually enter the bootloader by holding GPIO0 low during reset, however:
1. After DFU programming, the part seems to stick in bootloader mode, and doesn't run the newly flashed application firmware. Manually resetting the board starts the firmware as expected. Is automatic reset supposed to work?
Manually invoking dfu-util with the -R flag doesn't work either:
2. If I configure the application firmware to use ESP_CONSOLE_USB_CDC, dfu-util is able to see the DFU runtime descriptor, however it fails to automatically get it into rom bootloader mode. Is the DFU runtime supposed to be able to transition automatically to full bootloader mode?
I'm testing this on an x86 laptop running Ubuntu, and get the same behavior with ESP-IDF versions v4.3 and master, using the 'hello world' example. edit: using the 'wifi/getting_started/station' example, 'hello world' works after retesting.
The USB traces on my board are routed as a 90 ohm differential pair, however I don't have filter caps or resistors on them.
1. After DFU programming, the part seems to stick in bootloader mode, and doesn't run the newly flashed application firmware. Manually resetting the board starts the firmware as expected. Is automatic reset supposed to work?
Code: Select all
matt@huginn:~/Blinkinlabs-Repos/iced_espresso/examples/CM-2$ idf.py dfu-flash
Executing action: dfu-flash
Running make in directory /home/matt/Blinkinlabs-Repos/iced_espresso/examples/CM-2/build
Executing "make -j 6 dfu-flash"...
Command list: dfu-util;-d;303a:2;-D;/home/matt/Blinkinlabs-Repos/iced_espresso/examples/CM-2/build/dfu.bin
dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 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...
ID 303a:0002
Run-time device DFU version 0110
Claiming USB DFU Runtime Interface...
Determining device status: state = appIDLE, status = 0
Device really in Runtime Mode, send DFU detach request...
Device will detach and reattach...
dfu-util: error detaching
Opening DFU USB Device...
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 64
Copying data from PC to DFU device
Download [=========================] 100% 860160 bytes
Download done.
state(2) = dfuIDLE, status(0) = No error condition is present
Done!
Built target dfu-flash
Done
Code: Select all
matt@huginn:~/Blinkinlabs-Repos/iced_espresso/examples/CM-2$ dfu-util -d 303a:2 -R -D /home/matt/Blinkinlabs-Repos/iced_espresso/examples/CM-2/build/dfu.bin
dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 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...
ID 303a:0002
Run-time device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 64
Copying data from PC to DFU device
Download [=========================] 100% 860160 bytes
Download done.
state(2) = dfuIDLE, status(0) = No error condition is present
Done!
dfu-util: can't detach
Resetting USB to switch back to runtime mode
Code: Select all
idf.py dfu-flash
Executing action: dfu-flash
Running make in directory /home/matt/Blinkinlabs-Repos/iced_espresso/examples/CM-2/build
Executing "make -j 6 dfu-flash"...
Command list: dfu-util;-d;303a:2;-D;/home/matt/Blinkinlabs-Repos/iced_espresso/examples/CM-2/build/dfu.bin
dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 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...
ID 303a:0002
Run-time device DFU version 0110
Claiming USB DFU Runtime Interface...
Determining device status: state = appIDLE, status = 0
Device really in Runtime Mode, send DFU detach request...
dfu-util: error detaching
Device will detach and reattach...
dfu-util: Lost device after RESET?
CMake Error at /home/matt/esp/esp-idf-v4.3/tools/cmake/run_dfu_util.cmake:27 (message):
dfu-util failed
make[3]: *** [CMakeFiles/dfu-flash.dir/build.make:57: CMakeFiles/dfu-flash] Error 1
make[2]: *** [CMakeFiles/Makefile2:2419: CMakeFiles/dfu-flash.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:2426: CMakeFiles/dfu-flash.dir/rule] Error 2
make: *** [Makefile:359: dfu-flash] Error 2
Please have a look at the "Device Firmware Upgrade through USB" chapter in API Guides of the ESP-IDF documentation for solving common dfu-util issues.
make failed with exit code 2
The USB traces on my board are routed as a 90 ohm differential pair, however I don't have filter caps or resistors on them.