STM32F072 firmware download is very slow.
Multiplatform USB DFU host utility
Brought to you by:
tormod
The firmware download on my STM32F072 is very slow. This was observed with 0.8, but is still present in the current git version. Downloading 70kbytes of firmware takes: (still waiting...) 3:18.
I remember it being a lot faster in the past.
Anonymous
Thanks for the report. Please attach a log made with -d -d -d. In particular I would like to know if the reported bwPollTimeout values are correct.
I'm running with -v -v -v because specifying the USB VID:PID multiple times does not make sense....
Last edit: Roger Wolff 2015-08-25
image for alternate setting 0, (1 elements, total size = 70036)
parsing element 1, address = 0x08000000, size = 70028
Download [=========================] 100% 70028 bytes
Download done.
done parsing DfuSe file
0.036u 0.092s 2:47.29 0.0% 0+0k 0+0io 0pf+0w
Download of 70k took almost 3 minutes. 419 bytes per second.
Oh... by the way... Hardware has something to do with this. I didn't have this problem on my laptop last week when I was on vacation....
Yeah, -v -v -v is better :)
It looks like the bPollTimeout values are sane. They will alone accumulate to 39 seconds but not 3 minutes.
Since you saw this on some hardware and on some not, I wonder if this is a libusb issue. Which version are you using? Can you please try latest git on https://github.com/libusb/libusb which is 1.0.20-rc1+?
Tested on my workstation at work: fast. (It's the one at home that was slow).
Without further information, I would assume this is a hardware or hardware driver problem.
Can I close this? It happened once on one specific computer. Let's forget about it.
OK. starting a project again, and the time to download an image (ten minutes) is enough to search for the sources, recompile the wrong sources, find the right sources, update them from git, recompile them, restart the download, search for the home page, find the bug tracker edit another bug, then search for this one and start typing.....
It is still the same machine having this problem. but I did upgrade the OS from 16.04 to 18.04, so I'm likely running a newer libusb now. Anything I can do to debug this?
Ubuntu 18.04 should have libusb 1.0.21 which is newer than the 1.0.20 in 16.04. However there is now libusb 1.0.23 RC available, maybe you can try to compile it. What would have been useful is if the debug output from libusb could include timestamps, so we could see where things are held up. You can also try using strace, its -ttt option gives wonderful timestamps on the system calls done by libusb but it can be a challenge to combine the information.
This is still only seen on one single computer, right?
Does it change anything to have a USB hub between computer and device?
I see the same slowdown when I use dfu-util on an STM32F042 that's hooked to a USB3.0 port. If I move it to a USB2.0 port on the same machine then it runs quickly.
OK. I have USB3 ports on my system. I checked and it was in an USB2 port I moved it over to the USB 3 port and... still slow.
Technically, the USB3 port consist of two ports to the system, sharing a single connector. Like those phones that have USB but multiplex "headphone out" on the same connector.
So it could be that your USB3 port and my USB3 AND USB2 port all use the same USB2 chip/hardware/whatever.
A hint: When I run with strace AND -v -v -v, the process doesn't finish at all. (I stopped it at 10 minutes).
This is the strace with -v-v-v. You can see the debug prints in here too.
So that there is annotated with the debug info writes, but I think it is easier to read without them:
Here we see three complete cycles, about 40ms apart: everything is quick except for the 40ms sleep that is in there.
The 40ms timeout changes to 72 after a while:
That was for the succesful run without -v -v -v, near the end. Apparently by the end it was still doing those 72ms waits.
The unsuccesful run stopped doing the 72ms sleeps after a while.
Attached is the run from with the USB3 port that took about 49 seconds to load my 18k DFU file. ...
(the notifications from here go into my spambox, and I haven't cleaned that out in quite a while)
I have some information to add - I found this article due to my VNA taking hours to update, and I will provide the info I can to see if it helps. My laptop is a Dell G7. When I tried using any of the ports on tha laptop, the update took hours. I purchased a Startech ST4200MINI2 USB adapter and tried it with the firmware update, and it completed in 10 seconds. It's definitely something to do with the USB. At least adding an adapter works as a work-around until it is fixed. If you need any additional info, email me at greatoutdoors1985 at gmail and I will help what I can. - Shannon