dfu-util fails to upload firmware to STM32L43x devices
Multiplatform USB DFU host utility
Brought to you by:
tormod
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 " Downloading to address = 0x08000000, size = 133392 Download [== ] 9% 12288 bytesdfu-util: Error during special command "ERASE_PAGE" get_status
This appears to be due to the same issue experienced by dfuse-tool. The kernel is returning EPIPE when the bus stalls.
libusb: debug [libusb_alloc_transfer] transfer 0x560f17d7abc8 libusb: debug [libusb_submit_transfer] transfer 0x560f17d7abc8 libusb: debug [add_to_flying_list] arm timerfd for timeout in 5000ms (first in line) libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling libusb: debug [handle_events] poll() 3 fds with timeout in 60000ms libusb: debug [handle_events] poll() returned 1 ----- libusb: debug [reap_for_handle] urb type=2 status=-32 transferred=0 libusb: debug [handle_control_completion] handling completion status -32 libusb: debug [handle_control_completion] unsupported control request ----- libusb: debug [disarm_timerfd] libusb: debug [usbi_handle_transfer_completion] transfer 0x560f17d7abc8 has callback 0x7f3078d2fe40 libusb: debug [sync_transfer_cb] actual_length=0 libusb: debug [libusb_free_transfer] transfer 0x560f17d7abc8 dfu-util: Error during special command "ERASE_PAGE" get_status
The -32 return value is -EPIPE, which is returned when the bus is stalled. The STM32L43xx system USB DFU bootloader can stall the bus while doing an erase and while writing.
This is what usbmon shows
ffff9d2a0732a600 2731283048 S Co:3:041:0 s 21 01 0002 0000 0800 2048 = 40ea0300 21fa04f3 45ea0301 30bdc4f1 0c04c4f1 200220fa 02f001fa 04f340ea ffff9d2a0732a600 2731287168 C Co:3:041:0 0 2048 > ffff9d2a0732a600 2731287205 S Ci:3:041:0 s a1 03 0000 0000 0006 6 < ffff9d2a0732a600 2731287361 C Ci:3:041:0 0 6 = 00780000 0400 ffff9d2a0732a600 2731407497 S Ci:3:041:0 s a1 03 0000 0000 0006 6 < ffff9d2a0732a600 2731407626 C Ci:3:041:0 0 6 = 00780000 0500 ffff9d2a0732a600 2731527763 S Co:3:041:0 s 21 01 0000 0000 0005 5 = 41001000 08 ffff9d2a0732a600 2731527839 C Co:3:041:0 0 5 > ffff9d2a0732a600 2731527873 S Ci:3:041:0 s a1 03 0000 0000 0006 6 < ffff9d2a0732a600 2731527981 C Ci:3:041:0 0 6 = 000a0000 0400 ffff9d2a0732a600 2731538107 S Ci:3:041:0 s a1 03 0000 0000 0006 6 < ffff9d2a0732a600 2731550004 C Ci:3:041:0 -32 0
Note the last line.
Anonymous
Closing, it seems like this was fixed in 0.11. Thanks to everybody for testing and suggestions.
Terribly sorry, but I am still having this issue with 0.11. Appears to be the same anyway.
The download progress is pretty much random.
(I downloaded the 0.11 release binaries and replaced the three 0.9 binaries used in the
proffieboard
arduino tools folder.)Same anon as previous.
Finally got something to work. I applied the changes in
dfuse_dnload_chunk
from the patch in this comment: https://sourceforge.net/p/dfu-util/tickets/46/#1f97A little bit miffed the one using
goto
worked instead of any of the others, but desperate times call for desperate measures.I'd assume the same treatment that the similar loop in
dfuse_special_command
got needs to be applied todfuse_dnload_chunk
.Which chip is this?
STM32L433CCU6, on the v2.2 proffie.
This solution has continued to work consistently.
There is now in git master a new ":fast" mode for DfuSe downloading, please see https://sourceforge.net/p/dfu-util/tickets/195/
I am posting this here because the tweaks made to support this fast mode may also help for some of the issues reported in this thread.