AnsweredAssumed Answered

IWDG and System Memory Bootloader

Question asked by Zhitai Liu on Jul 27, 2017

Hi, everyone, I have a strange phenomena concerning IWDG in system memory bootloader.

(I'm using STM32F030F4P6)

In my project, I can jump to system memory bootloader using software in application,

it works fine with ST's Flash Loader demonstrator.


Then I add IWDG in my project,  with a period of 1 sec, for the moment.

After reset, my code would check if RCC_FLAG_IWDGRST is set .

If so, then a Led would blink few times. 

This also works fine, for I try to refresh the iwdg not within 1 sec, I can see my blinking led.

Also, if I refresh IWDG in my main loop, I'd never seen blinking led.


In my project, when the program starts,  

it would wait few seconds and check if jump to bootloader command is arrived through UART.

Only after that, IWDG would be init and start.



BUT............ I just found that I mistakenly init the IWDG in the waiting for jump to bootloader state!

Strange things happened here:

   once the program jump to System Memory Bootloader, the IWDG never reset my core!

   (for my flash loader demonstrator software can works with this mcu for more than 30 mins,

    I did something like keep reading the memory)


My question is simply:

   In System Memory Bootloader, is IWDG somehow stopped??!!



Below is my code jump to system memory, 

void JumpToBootloader(void)

   void (*SysMemBootJump)(void);
   volatile uint32_t addr = 0x1FFFEC00;         //stm32F030 System memory address


   //set rcc to default setting.


   // Disable systick timer
   SysTick->CTRL = 0;
   SysTick->LOAD = 0;
   SysTick->VAL = 0;

   //Disable all interrupts

   //Remap system memory to address 0x0000 0000 in address space
   __HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH(); //Call HAL macro to do this for you


   //Set Jump Location

   SysMemBootJump = (void (*)(void)) (*((uint32_t *)(addr + 4)));

   //Set main stack pointer.
   __set_MSP(*(uint32_t *)addr);

   //jump to set location



I've checked that in HAL_RCC_DeInit(), LSI is unchanged. 


Thanks for reading this post, thank you anyway in advance.