Can't flash ESP32-S2 via USB-DFU: LIBUSB_ERROR_TIMEOUT

Malman
Posts: 3
Joined: Wed Jul 12, 2023 8:49 am

Can't flash ESP32-S2 via USB-DFU: LIBUSB_ERROR_TIMEOUT

Postby Malman » Wed Jul 12, 2023 9:06 am

I have an ESP32-S2-SOLO module on a custom PCB, with my USB data lines connected directly to the ESP32-S2 D+ and D- pins.

I can see the ESP32-S2 in the Device Manager (and its associated COM port) when the chip is booted in download mode, and I have the drivers installed (Windows 11). I can compile the code just fine using VS Code with ESP IDF (just the blink test program for now).

When I try to flash the chip via DFU, dfu-util seems to be able to detect and communicate with the device, but the download never goes past 0%, and then I get an error:

Code: Select all

Error during download get_status (LIBUSB_ERROR_TIMEOUT)
The full output is:

Code: Select all

PS C:\Users\Malman\Desktop> dfu-util -d 303a:2 -D c:\Users\Malman\Documents\Electronics\clock_firmware_test\blink\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...
error detaching
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        [                         ]   0%            0 bytesError during download get_status (LIBUSB_ERROR_TIMEOUT)
dfu-util can detect the device and list it:

Code: Select all

PS C:\Users\Malman\Desktop> dfu-util -l
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/

Found Runtime: [303a:0002] ver=0723, devnum=35, cfg=1, intf=2, path="2-3.1", alt=0, name="UNKNOWN", serial="0"
So I don't think it's a bad PCB or anything like that: voltages, continuity on the data lines and everything are all as you'd expect.

This is my first time using the built-in USB controller rather than a USB-UART bridge.

Has anyone faced this problem before or does anyone know how it might be solved?

ESP_Sprite
Posts: 9739
Joined: Thu Nov 26, 2015 4:08 am

Re: Can't flash ESP32-S2 via USB-DFU: LIBUSB_ERROR_TIMEOUT

Postby ESP_Sprite » Thu Jul 13, 2023 5:27 am

What happens if you start the S2 in download mode, that is, pull GPIO0 low on reset or power-on? Can you successfully upload then?

Malman
Posts: 3
Joined: Wed Jul 12, 2023 8:49 am

Re: Can't flash ESP32-S2 via USB-DFU: LIBUSB_ERROR_TIMEOUT

Postby Malman » Thu Jul 13, 2023 5:39 am

This is all happening when the S2 is booted into download mode.

When not booted into download mode, the device is not detected as a USB device at all, does not appear in Device Manager, does not appear when using dfu-util -l, etc.

ESP_Sprite
Posts: 9739
Joined: Thu Nov 26, 2015 4:08 am

Re: Can't flash ESP32-S2 via USB-DFU: LIBUSB_ERROR_TIMEOUT

Postby ESP_Sprite » Thu Jul 13, 2023 5:44 am

I see. Well, in that case it looks like something is going wrong with the communication to the internal flash. Do you happen to have GPIO45 connected to something that makes that pin high on startup? Also, what is the power supply situation like, as in, what are the current capabilities on your 3.3V rail?

Malman
Posts: 3
Joined: Wed Jul 12, 2023 8:49 am

Re: Can't flash ESP32-S2 via USB-DFU: LIBUSB_ERROR_TIMEOUT

Postby Malman » Thu Jul 13, 2023 7:21 am

D'oh!

GPIO45 was pulled up.

Removing the pullup made flashing work as expected.

Thank you very much for the help - I knew it was something an expert would spot instantly but I was baffled.

Adding that pullup was my last design change and I think when checking before fabrication I read GPIO45 as GPIO46 which I carefully left unconnected, not thinking about GPIO45 at all.

ESP_Sprite
Posts: 9739
Joined: Thu Nov 26, 2015 4:08 am

Re: Can't flash ESP32-S2 via USB-DFU: LIBUSB_ERROR_TIMEOUT

Postby ESP_Sprite » Fri Jul 14, 2023 5:18 am

That happens sometimes; glad the problem is solved!

Who is online

Users browsing this forum: No registered users and 98 guests