Hi!
I was trying to use the dfu-util to flash an ESP32-S2 chip, which was working fine with the ESPeasy image, but not with Tasmota. Where could be the problem?
$ dfu-suffix -c tasmota32s2.factory.bin
dfu-suffix (dfu-util) 0.11
Copyright 2011-2012 Stefan Schmidt, 2013-2020 Tormod Volden
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
dfu-suffix: Invalid DFU suffix signature
dfu-suffix: Valid DFU suffix needed
$ dfu-suffix -c bin/ESP_Easy_mega_20230623_normal_ESP32s2_4M316k_CDC.bin
dfu-suffix (dfu-util) 0.11
Copyright 2011-2012 Stefan Schmidt, 2013-2020 Tormod Volden
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
dfu-suffix: Invalid DFU suffix signature
dfu-suffix: Valid DFU suffix needed
Thanks
Anonymous
What is exactly the problem? I don't see any dfu-util command line and command output. Is it difficult to follow the instructions on https://sourceforge.net/p/dfu-util/tickets/new/ ? And does the manufacturer say that their device bootloader support the DFU protocol? Maybe you should ask the manufacturer or those who deliver the Tasmota firmware.
The uploaded image is not usable at the device, which is an ESP32-S2.
According to the manufacturer the dfu protocol is supported:
https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-guides/dfu.html
The upload, read and all those stuffs are working, however the image contains some corrupt data. The guys at Tasmota said, I need to use the recommended way to upload the image.
$ sudo dfu-util -D tasmota32s2cdc.factory.bin -d 303a:0002 -v
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/
libusb version 1.0.26 (11724)
dfu-util: Warning: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release
Opening DFU capable USB device...
Device ID 303a:0002
Run-Time device DFU version 0110
DFU attributes: (0x0f) bitCanDnload bitCanUpload bitManifestationTolerant bitWillDetach
Detach timeout 700 ms
Claiming USB DFU Interface...
Setting Alternate Interface #0 ...
Determining device status...
DFU state(5) = dfuDNLOAD-IDLE, status(0) = No error condition is present
Aborting previous incomplete transfer
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% 2744160 bytes
Download done.
Sent a total of 2744160 bytes
DFU state(2) = dfuIDLE, status(0) = No error condition is present
Done!
sudo dfu-util -U tasmota32s2cdc.factory.bak1 -d 303a:0002 -v
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/
libusb version 1.0.26 (11724)
Opening DFU capable USB device...
Device ID 303a:0002
Run-Time device DFU version 0110
DFU attributes: (0x0f) bitCanDnload bitCanUpload bitManifestationTolerant bitWillDetach
Detach timeout 700 ms
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 DFU device to PC
Upload [=========================] 100% 4194304 bytes
Upload done.
Received a total of 4194304 bytes
I compared the binaries and the content was pretty much identical until 2MBs, but after that the downloaded and uploaded content is different. No reset has happen during the write and the read.
The dfu-util output shows no error so it looks like the download was successful. The bootloader didn't report any error. So maybe there is a bug in the bootloader? Are you sure images larger than 2MB are supported?
The ESP DFU guide that you linked to says that the DFU images must be built with "idf.py dfu". Is your Tasmota image built that way? Maybe the bootloader processes the image differently than just writing it byte-to-byte to flash memory, and the image needs special formatting.
OTOH Tasmota apparently use their own flashing tools: https://tasmota.github.io/docs/ESP32/#flashing