Menu

#40 dfu-util fails to upload firmware to STM32L43x devices

0.12
closed
nobody
None
2024-04-16
2017-03-25
Rob Riggs
No
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.

Discussion

<< < 1 2 3 (Page 3 of 3)
  • Tormod Volden

    Tormod Volden - 2022-03-14

    Closing, it seems like this was fixed in 0.11. Thanks to everybody for testing and suggestions.

     
  • Anonymous

    Anonymous - 2022-03-16

    Terribly sorry, but I am still having this issue with 0.11. Appears to be the same anyway.

    /home/---/.arduino15/packages/proffieboard/hardware/stm32l4/3.6.0/tools/linux/stm32l4-upload 0x1209 0x6668 /tmp/arduino_build_615915/ProffieOS.ino.dfu 
    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/
    
    Opening DFU capable USB device...
    Device ID 0483:df11
    Device DFU version 011a
    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 011a
    Device returned transfer size 2048
    Warning: Overriding device-reported transfer size
    DfuSe interface name: "Internal Flash  "
    Downloading element to address = 0x08000000, size = 175768
    Erase       [=========================] 100%       175768 bytes
    Erase    done.
    Download    [========                 ]  32%        57344 bytesdfu-util: Error during download get_status
    OK
    

    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.)

     
  • Anonymous

    Anonymous - 2022-03-18

    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/#1f97

    A 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 to dfuse_dnload_chunk.

     
    • Tormod Volden

      Tormod Volden - 2022-03-20

      Which chip is this?

       
      • Anonymous

        Anonymous - 2022-03-25

        STM32L433CCU6, on the v2.2 proffie.

        This solution has continued to work consistently.

         
  • Tormod Volden

    Tormod Volden - 2024-04-16

    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.

     
<< < 1 2 3 (Page 3 of 3)

Anonymous
Anonymous

Add attachments
Cancel