AnsweredAssumed Answered

Question regarding reset condition with respect to IWDG

Question asked by vu.andy on Mar 29, 2018
Latest reply on Mar 30, 2018 by Andrew Neil

I have my program something like this below.

My question is under which condition (block 1) codes executed and (block 2) codes executed.

1. At board power up, (block 2) executed. (for sure).

2. If I erase the CPU, reprogram the CPU with the power still on, then which block will be executed, 1 or 2?

3. If I do hard reset on the CPU, which block will be executed?

 

Thanks.

 

main()

{

   //Init clock ...

   //Init IWDG

    if (__HAL_RCC_GET_FLAG(RCC_FLAG_IWDGRST) != RESET)

    {

       //block 1 codes executed.

    }

    else

    {

       //block 2 codes executed

    }

    while(1)

    {

       //some codes.

       HAL_IWDG_Refresh();

    }

 

}

Outcomes