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

prueba2
Associate II
Posted on November 10, 2016 at 19:29

Hi everybody.

It is a little late but here is my contribution.

Before that you  call the function to jump to bootloader from your code, you need to enable the reset by wachtdog. When the your firmware is update send the command ''Leave DFU mode'' after 3~5 seg the system will be reboot.

I'm using F07CB.

I put the code to call the bootloader before that the HAL_Init();

IWDG->KR = 0x0000CCCC; // (1)

IWDG->KR = 0x00005555; // (2)

IWDG->PR = IWDG_PR_PR_1; // (3)

IWDG->RLR = 1000; // (4)

while (IWDG->SR) // (5)

{

// add time out here for a robust application

}

BootLoaderInit();

My function BootLoadInit() is:

void BootLoaderInit(void){

SysMemBootJump = (void (*)(void)) (*((u32 *)  0x1fffc804));

RCC->CSR |= RCC_CSR_RMVF;

RCC->APB2ENR = RCC_APB2ENR_SYSCFGCOMPEN;

SYSCFG->CFGR1 |= SYSCFG_CFGR1_MEM_MODE_0;

__set_MSP(*bootloader_msp);

SysMemBootJump();

while(1);

}

Do not forget declarate the proptotype of the function:

#define BOOTLOADER_START 0x1fffc800

static uint32_t *bootloader_msp = (void *)BOOTLOADER_START;

I hope this information is useful.

Thanks.

ST AME Support NF
ST Employee

Hello,

Did you find a solution ? I am also looking for a way to detect when the firmware update is complete for me to swap Banks so a little bit like what you are looking for.

Did you find any solutions?

Thanks.

Nico.