cancel
Showing results for 
Search instead for 
Did you mean: 

Reset after firmware upgrade

lee
Associate II
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?

12 REPLIES 12
chen
Associate II
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!

lee
Associate II
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?

chen
Associate II
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?

lee
Associate II
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.

chen
Associate II
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

lee
Associate II
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.

chen
Associate II
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.

lee
Associate II
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.

chen
Associate II
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?