Seed bootloader + dfu-util

Hi all,

Since I ran out of code space, I went for installing the bootloader and executing from sram. Things worked for a while but lately dfu-util fails to erase qspi flash when programming. An excerpt follows:

Device returned transfer size 4096
Warning: Overriding device-reported transfer size
DfuSe interface name: "Flash "
Downloading element to address = 0x90040000, size = 299848
Erase   	[                         ]   0%            0 bytesdfu-util: Error during special command "ERASE_PAGE" get_status

Sometimes erasing works for a bit (say 20%) and then it breaks as above. The curious thing is that once in say 20 times, works. The even more curious thing is that the online daisy programmer manages to erase and program the same firmware with a success rate of 100%. The problem however with this approach is that I cannot run it as part of my build/program automation script.

I am really curious what the differences between dfu-util and the online programmer are. Do you guys have any alternative tool for dfu downloading? I am using dfu-util 0.11 on ubuntu 22.04.

Thanks!

I managed to make it work by patching dfu-util and increase the timeout used by dfu_get_status(). But it still shows a problem with the bootloader. What is the bootloader actually doing?

Hi Adrian!

I just want to clarify the issue that you’re encountering.
The main problem was not being able to erase qspi flash 100% of the time, but now you are able to with the workaround of increasing the timeout used by dfu_get_status().
Could you tell me more detail about the problem with the Daisy bootloader that you’re still seeing? Thanks!

Hi Takumi,

The problem with the bootloader that I’m still seeing is that while erasing, it fails to respond in a timely manner to get dfu status requests and since dfu-util has a hardcoded timeout of 5 seconds, it means others will run into this issue as well when executing from SRAM.

So, even though I patched dfu-util and got things working, the original problem with the bootloader remains.

P.S: why not make the bootloader sources open? I’m sure many would like to participate in improving or fixing bugs.

Hope that helps,
Adrian

I think there’s a chance this may be a versioning issue. Are you able to try with dfu-util v0.9 or v0.10? The bootloader was developed specifically with v0.9. Since the bootloader erases in blocks of 4096 bytes, the process should not take more than a few hundred milliseconds at most (unless there’s something wrong with the QSPI chip), so it’s not a fundamental limitation.