Page 1 of 3
Setting efuse to ESP32-S3 to enable DFU on boot press.
Posted: Fri Mar 18, 2022 5:06 pm
by darkgiuseppe
When I was using the STM32F4, it was handy to have it enter DFU mode when pressing the boot0 (on power up or reset) on a dev board. From what I researched, the ESP32-S3 can do the same thing which is super cool. Naively, I tried to hold down the boot button on ESP32-S3-DEVKITC and pulsed the reset button, but it did not show as a DFU device. It did show as a Composite device, I guess for debugging code through the USB port (which is also pretty cool).
Doing some research I found this link:
https://docs.espressif.com/projects/esp ... s/dfu.html
Which said this:
By default, USB_SERIAL_JTAG module is connected to the internal PHY of the ESP32-S3, while USB_OTG peripheral can be used only if the external USB PHY is connected. Since DFU mode is provided via USB_OTG peripheral, it cannot be used through the internal PHY in this configuration.
You can permanently switch the internal USB PHY to work with USB_OTG peripheral instead of USB_SERIAL_JTAG by burning USB_PHY_SEL eFuse. See ESP32-S3 Technical Reference Manual for more details about USB_SERIAL_JTAG and USB_OTG.
Okay so I need to burn the proper fuse so it can act like a DFU device instead. So I found this link:
https://docs.espressif.com/projects/esp ... index.html
Seems like this is the place I want to be. Now before I go ahead and mess around with this, since it is a permanent change by burning the efuse, does all what I said make sense? At least this is how I interpret from the documentation. End goal would be to test out a built DFU file to load using this tool:
https://devanlai.github.io/webdfu/dfu-util/
Found through this forum post:
viewtopic.php?t=15981
Any hints or confirmation would be ideal. Thank you for reading this!
Re: Setting efuse to ESP32-S3 to enable DFU on boot press.
Posted: Sat Mar 19, 2022 3:00 am
by darkgiuseppe
OK I actually found another forum post that confirms my thinking was indeed correct:
viewtopic.php?t=25974
Here is what I did (I am using the idf, not Arduino):
Code: Select all
esp_efuse_desc_t settings;
const esp_efuse_desc_t * p_efuse;
const esp_efuse_desc_t ** pp_efuse;
settings.bit_count = 1;
settings.bit_start = 121;
settings.efuse_block = EFUSE_BLK0;
p_efuse = &settings;
pp_efuse = &p_efuse;
ESP_LOGI("EFUSE", "%d", (uint8_t)esp_efuse_read_field_bit(pp_efuse));
esp_efuse_write_field_bit(pp_efuse);
ESP_LOGI("EFUSE", "%d", (uint8_t)esp_efuse_read_field_bit(pp_efuse));
Confirmed that it was a 0 and now it is a 1 after burning the fuse. When I plug into the USB port without pressing the boot, the USB-serial-JTAG device no longer shows up on my PC, so far so good. But when I hold the boot pin down and pulse reset, and then let go of the boot pin, I am not getting into DFU mode.
Is there one last step I need to do in order to get it to be in DFU?
ADDENDUM: I measured the IO0 pin and it indeed goes from HIGH to LOW as expected with the BOOT button, so it doesn't seem to be an electrical issue on that end.
Re: Setting efuse to ESP32-S3 to enable DFU on boot press.
Posted: Sat Mar 19, 2022 4:02 pm
by darkgiuseppe
Okay some news, I inspected the schematic on the devkitc and there is no pullup resistor on either the D+ or D- lines to signal to the PC that a USB device is connected, at least on the PCB. I would have to dig through the ESP32-S3 datasheet to see there is a pull-up internally set. I went ahead and placed a pullup (1k) on the D+ line to signal to the PC that this is a Full Speed device. I am aware the it should be 1.5k to be USB compliant, but this is what I have for now. It seems like I am getting closer because now the PC recognizes that something is at least connected though it says "USB device not recognized".
Maybe I will figure this issue out before the work week when support comes in to offer me some hints.
Re: Setting efuse to ESP32-S3 to enable DFU on boot press.
Posted: Mon Mar 21, 2022 1:21 am
by ESP_Sprite
An external pullup is not needed and adding one does not lead to progress here, as simply putting the resistor on the D+ without the ESP32S3 connected would lead to the same result. What fuses did you try to burn exactly? Can you give an output of espefuse.py?
Re: Setting efuse to ESP32-S3 to enable DFU on boot press.
Posted: Mon Mar 21, 2022 2:01 am
by darkgiuseppe
ESP_Sprite wrote: ↑Mon Mar 21, 2022 1:21 am
An external pullup is not needed and adding one does not lead to progress here, as simply putting the resistor on the D+ without the ESP32S3 connected would lead to the same result. What fuses did you try to burn exactly? Can you give an output of espefuse.py?
I burned the USB_PHY_SEL fuse per the instructions on this page:
https://docs.espressif.com/projects/esp ... s/dfu.html
Ok output attached.
fuse_output.png
Re: Setting efuse to ESP32-S3 to enable DFU on boot press.
Posted: Mon Mar 21, 2022 2:07 am
by ESP_Sprite
That indeed seems correct. One more thing: are you checking the DFU mode specifically when in download mode (IO0 low when chip is reset)? The existence of DFU when the chip is running depends on the user code programmed into flash, but DFU should always be available in download mode.
Re: Setting efuse to ESP32-S3 to enable DFU on boot press.
Posted: Mon Mar 21, 2022 12:45 pm
by darkgiuseppe
Yes when I press the boot pin on the devkit board, IO0 does indeed go low. Same with reset. I hold down boot, then press reset, let go of reset, and let go of boot. The PC does not react at all. I feel like there is a step missing somewhere in the instructions we are overlooking. Do you have a brand new devkit on your end to try this out on? I just tried it with another one, and I have the same results. Is the DFU somehow missing in download mode? Do I need to install some soft of software for detection? I would think not since USB is supposed to get around that kind of thing.
Re: Setting efuse to ESP32-S3 to enable DFU on boot press.
Posted: Mon Mar 21, 2022 1:28 pm
by chegewara
On windows you have to use "zadig" to install espressif VID/PID as WinUSB, before it can be recognized.
Also this website will not work to DFU esp32 Sx, because it can detect only preconfigured VID/PID, but there is few other websites that would work:
https://devanlai.github.io/webdfu/dfu-util/
Re: Setting efuse to ESP32-S3 to enable DFU on boot press.
Posted: Mon Mar 21, 2022 1:59 pm
by darkgiuseppe
chegewara wrote: ↑Mon Mar 21, 2022 1:28 pm
On windows you have to use "zadig" to install espressif VID/PID as WinUSB, before it can be recognized.
Also this website will not work to DFU esp32 Sx, because it can detect only preconfigured VID/PID, but there is few other websites that would work:
https://devanlai.github.io/webdfu/dfu-util/
Oh interesting! I will try this tonight. Thank you.
Re: Setting efuse to ESP32-S3 to enable DFU on boot press.
Posted: Tue Mar 22, 2022 1:26 am
by darkgiuseppe
chegewara wrote: ↑Mon Mar 21, 2022 1:28 pm
On windows you have to use "zadig" to install espressif VID/PID as WinUSB, before it can be recognized.
Also this website will not work to DFU esp32 Sx, because it can detect only preconfigured VID/PID, but there is few other websites that would work:
https://devanlai.github.io/webdfu/dfu-util/
Ok so I downloaded the Zadig tool but I am not quite sure how to use it. I tried to search around for instructions as it applies for the ESP32-S3 but I couldn't find anything. I am not very familiar with this program.