Skip to main content
Explorer
November 12, 2024
Question

DFU leave issue on STM32G0B1

  • November 12, 2024
  • 3 replies
  • 1192 views

Using STM32G0B1 device, DFU FW update is working as expected
Including leave request, wich results in expected device leave and start at requested address
But `dfu-util` returns error status due to get_status error after leave request

As stated in "AN3156 : USB DFU protocol used in the STM32 bootloader" documentation,
Once file download is complete, host submits leave request
And expects the device to return OK from following get_status
But STM32G0B1 returns `LIBUSB_ERROR_PIPE (-9)` before leaving

Same issue using `STM32CubeProgrammer`, either from CLI or GUI
Need to increase verbosity level for the error log to show up

`dfu-util` and `STM32CubeProgrammer` logs attached

Do I miss something ?
Feel free to ask for any additional information

    This topic has been closed for replies.

    3 replies

    Technical Moderator
    November 12, 2024

    Dear @eraquin ,

    The protocol implementation is described here : https://www.st.com/resource/en/application_note/an3156-usb-dfu-protocol-used-in-the-stm32-bootloader-stmicroelectronics.pdf

    see Figure 5 ans Figure 6 , Once the DOWNLOAD Command is sent with 0 Data the device trig a reset and enumeration, then the Host is not expected to send a Get_Status as in this case it will be stalled and so as seen in the Logs . May be to see the Manifest bit if set correctly at descriptor level . 

    I would not expect any error after this operations as the device already left USB and is jumping to its final application. 

    Hope it helps ,

    STOne-32

    eraquinAuthor
    Explorer
    November 13, 2024

    Thanks a lot for your quick reply

    > The protocol implementation is described here
    Thanks for confirmation, this is the application note I was looking at

    > Once the DOWNLOAD Command is sent with 0 Data the device trig a reset and enumeration,
    > then the Host is not expected to send a Get_Status
    This is not what I got from the specification
    As per the "5.5 Leave DFU mode" section :
    > The operation is effectively executed only when a DFU_GETSTATUS request is issued by the host
    So from my current understanding, after initiating the leave (download without data),
    It is expected for the host to send a get_status status request, to actually trigger the leave
    I think I'm able to confirm that this get_status is mandatory
    As a host leave request without any following get_status doesn't result in any leave/reset on device side

    Still from "5.5 Leave DFU mode" section :
    > If the status returned by the device is not dfuMANIFEST, an error has occurred
    And here is my concern, as returned status isn't the expected one

    Technical Moderator
    November 13, 2024

    Dear @eraquin 

    Very clear,  let's focus on this at the end indeed.  we will try to see if other MCUs behaving on same way ? or this is particular to this device .  I assume all is running embedded ROM Bootloader ?   as we have the Source sode of DFU implementation and we can run it from user flash as well.  @FBL  your help is appreciated.

    Still from "5.5 Leave DFU mode" section :
    > If the status returned by the device is not dfuMANIFEST, an error has occurred
    And here is my concern, as returned status isn't the expected one

    Ciao

    STOne-32.

    eraquinAuthor
    Explorer
    November 13, 2024

    Thanks for quick reply

    > other MCUs behaving on same way ?
    I can tell that some STM32 devices are not behaving this way
    For instance, no issue with STM32F7x3IxK, which is used on a former product on our side

    > I assume all is running embedded ROM Bootloader ?
    Yes, DFU running from ROM, on both STM32G0B1 and STM32F7x3IxK