DFU download bricking STM32F767 and mass-erase is failing
Multiplatform USB DFU host utility
Brought to you by:
tormod
Hi,
We have a STM32F767 that can't be flashed with dfu-util. The ECU does not boot once flashed with dfu-util. We tried 0.10 and 0.11 on Windows 11.
When we flash with CubeProgrammer it boots fine.
It seems the device likes (requires) a full erase before flashing (as CubeProgrammer) does but that fails on dfu-util.
The same command set works on STM32H743 and STM32F407.
Full command:
dfu-util -d0483:df11 -a0 -s 0x08000000:mass-erase:force -D rusefi.bin
Flashing C:\Users\ggurov\AppData\Local\Temp\epicEFI-dfu-update18060022641956708335\rusefi.snapshot.MEGA144F7\rusefi.bin
Rebooting ECU to DFU...
Erasing and updating firmware...
dfu-util 0.10-msvc
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2020 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/
Warning: Invalid DFU suffix signature
A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuERROR, status = 10
dfuERROR, clearing status
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
DfuSe interface name: "Internal Flash "
Performing mass erase, this can take a moment
Error during special command "MASS_ERASE" get_status
Process exited with code: 74
ECU update failed! See details.
Anonymous
Verbose logs might help, see https://sourceforge.net/p/dfu-util/tickets/new/
Please also use the latest version or latest git, because the diagnostics output has been improved.
If you are using latest git you can also try the new
:fastdfuse modifier.Hi,
Is there any possibility that you could build us a git msvc x64 binary? I dont have the toolchain set up as im on Mac.
Many thanks!
Ognjen
Windows git snapshot binaries can be found here: https://dfu-util.sourceforge.net/snapshots/
(2024-04-16 is practically latest git)
Here it is:
STM32F767:
STM32F407:
STM32H7:
Can you please format the STM32H7 output?
You can see in the STM32F407 output: "Setting timeout to 35 seconds". This is a quirk because we know some devices report wrong erase time. Maybe the F767 also reports wrong erase time. Please use
-v -vto see more debug information. You can also use-v -v -vbut that is so verbose you'd better attach the output as a file.Hi,
When you said it's verbose, you weren't kidding :^)
The full output is attached.
Many thanks!
Ognjen
Poll timeout 200 ms on command MASS_ERASE (state=dfuDNBUSY)The chip tells dfu-util to wait 200 ms before asking about status again, but that is probably too short and the chip is still busy erasing and not able to communicate so our get_status request times out.
Hi,
Should that be added to the 35 second quirk perhaps?
Br,
Ognjen
Then what if some other chip also reports 200 ms but doesn't need 35 seconds, maybe even correctly needs less than 200 ms? :)
How many seconds does the datasheet say?
Hi,
The F767 datasheet for this chip says 8 (in some crazy parallel mode) to 32 seconds.
Yeah if we force such a timeout, it would slow down the tool a lot for other, real chips (STM32F0 chips mass-erase in 30ms).
Maybe if we add up the flash size from the memory segments, and if they are "large" (1MB) and the controller lies, then set the large timeout?
Thanks!
Ognjen
...or, perhaps, to avoid hacks and stupid stuff just add a console switch to disable timeouts or raise them :^)