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
    November 10, 2016
    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 Employee
    August 21, 2024

    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.