Skip to main content
Visitor II
January 23, 2014
Question

Reset after firmware upgrade

  • January 23, 2014
  • 12 replies
  • 3325 views
Posted on January 23, 2014 at 12:00

I have used the STM32 USB-FS-Device development kit examples to implement the custom HID and the DFU. It all works OK and I can upgrade the custom HID application from the DFU application using DfuSeDemo.  The problem is that the DFU application does not reset when the upgrade is complete, I have to cycle the power. There is a system reset in the code but it isn’t called. Where do I need to do the system reset to force the DFU app to reset when the download is complete?

    This topic has been closed for replies.

    12 replies

    Visitor II
    January 23, 2014
    Posted on January 23, 2014 at 12:16

    Hi

    You have not said which device you are using!

    Have you read the reference manual?

    No - try reading the section titled ''Reset and clock control''

    Another interesting section titled ''Window Watchdog''

    And that is just from a quick search through the reference manual!

    leeAuthor
    Visitor II
    January 23, 2014
    Posted on January 23, 2014 at 12:44

    Sorry, forgot to say I am using the STM32L100.

    Of course I have read the manual!

    My question is not about HOW to reset the device, is it WHEN to do it. At what point in the code is the DFU complete so I know I can reset the device?

    Visitor II
    January 23, 2014
    Posted on January 23, 2014 at 12:55

    Hi

    Sorry, by ''

    Where do I need to do the system reset

    '' - I thought you meant which register. My missunderstanding, my bad.

    ''

    The problem is that the DFU application does not reset when the upgrade is complete, I have to cycle the power. There is a system reset in the code but it isn’t called. Where do I need to do the system reset to force the DFU app to reset when the download is complete?

    ''

    The DFU application - is that the PC side or are you talking about the built in DFU code that is entered by BOOT0? Or something else?

    leeAuthor
    Visitor II
    January 23, 2014
    Posted on January 23, 2014 at 13:50

    Something else. As I explained above I am using the Device Firmware Upgrade component of the STM32 USB-FS-Device development kit.

    Visitor II
    January 23, 2014
    Posted on January 23, 2014 at 13:57

    Hi

    OK - just googled USB DFU

    Found :

    AN3156 ( Doc ID 17068 Rev 3)

    ''It is possible to exit DFU mode (and bootloader) and jump to a loaded application (in the

    internal Flash or in the embedded RAM) using the DFU download request.

    The Host sends a DFU_DNLOAD request with 0 data length (no data stage after the

    request) in order to inform the device that

    it will have to exit DFU mode. The device

    acknowledges this request if the current state is dfuDNLOAD-IDLE or dfuIDLE.''

    http://www.st.com/st-web-ui/static/active/en/resource/technical/document/application_note/CD00264379.pdf

    There is also a generic USB DFU doc :

    http://www.usb.org/developers/devclass_docs/usbdfu10.pdf

    leeAuthor
    Visitor II
    January 23, 2014
    Posted on January 23, 2014 at 14:02

    I have read those. My question was specifically about the code example that implements the Device Firmware Upgrade component of the STM32 USB-FS-Device development kit. Thanks for your help.

    Visitor II
    January 23, 2014
    Posted on January 23, 2014 at 15:23

    Hi

    ''Thanks for your help.''

    No problem.

    '' My question was specifically about the code example that implements the Device Firmware Upgrade component of the STM32 USB-FS-Device development kit. ''

    ''

    I have used the STM32 USB-FS-Device development kit examples to implement the custom HID and the DFU.

    It all works OK and I can upgrade the custom HID application from the DFU application using DfuSeDemo.

    ''

    ''

    There is a system reset in the code but it isn’t called. Where do I need to do the system reset to force the DFU app to reset when the download is complete?

    ''

    ''The Host sends a DFU_DNLOAD request with 0 data length (no data stage after the

    request) in order to inform the device that it will have to exit DFU mode.''

    So either

    DfuSeDemo

    is not sending a DFU_DNLOAD request with 0 data length

    OR

    The implementation of DFU is not calling the system reset when it receives a DFU_DNLOAD request with 0 data length.

    leeAuthor
    Visitor II
    January 23, 2014
    Posted on January 23, 2014 at 15:38

    So either

    DfuSeDemo

    is not sending a DFU_DNLOAD request with 0 data length

    OR

    The implementation of DFU is not calling the system reset when it receives a DFU_DNLOAD request with 0 data length.

    Exactly right. As both of these are supplied by ST I was hoping that someone who has used them might have found a solution.

    Visitor II
    January 23, 2014
    Posted on January 23, 2014 at 15:47

    Hi

    ''

    I have used the STM32 USB-FS-Device development kit examples to implement the custom HID and the DFU.

    ''

    ....

    '' As both of these are supplied by ST''

    You should be able to debug which of the 2 the problem is.

    If the problem is in your implementation of the DFU - you should be able to fix it.

    However, if the problem is in

    DfuSeDemo

    then yes, it is somebody else problem.

    USB DFU is an 'industry standard' - are there any other host DFU programmers?

    leeAuthor
    Visitor II
    January 24, 2014
    Posted on January 24, 2014 at 10:31

    If the problem is in your implementation of the DFU - you should be able to fix it.

    Yes I should but I am asking the question in the hope that someone might have done this already and be willing to share their experience to enable me to reach a solution sooner.

    USB DFU is an 'industry standard' - are there any other host DFU programmers?

    The ST implementation is not the industry standard DFU and I hope that an application provided by ST would work on ST devices and ST example firmware.

    I wonder if anyone from ST can answer this as both the STM32 USB-FS-Device development kit examples and DfuSeDemo are supplied by ST. The code example calls a reset but this line is never reached. Perhaps someone from ST or who has developed with this code could tell me why this reset is never called, or where I could call a reset when the download is finished.