cancel
Showing results for 
Search instead for 
Did you mean: 

What is the difference between IWDG->KR = IWDG_REFRESH; and IWDG->WINR = IWDG_RELOAD >> 1; ?

Carter Lee
Associate III
Posted on September 27, 2017 at 09:43

Hi,

I came across IWDG function from Reference Document,

but I can't understand the difference between A15.1 and A15.2.

Would you please help me to understand it ?

what kind situation which example do I need it?

A.15 IWDG(Independent watchdog

) code example

A.15.1 IWDG configuration code example

/* (1) Activate IWDG (not needed if done in option bytes) */

/* (2) Enable write access to IWDG registers */

/* (3) Set prescaler by 8 */

/* (4) Set reload value to have a rollover each 100ms */

/* (5) Check if flags are reset */

/* (6) Refresh counter */

IWDG->KR = IWDG_START;

/* (1) */

IWDG->KR = IWDG_WRITE_ACCESS;

/* (2) */

IWDG->PR = IWDG_PR_PR_0;

/* (3) */

IWDG->RLR = IWDG_RELOAD;

/* (4) */

while

(IWDG->SR)

/* (5) */

{

     

/* add time out here for a robust application */

}

IWDG->KR = IWDG_REFRESH;

/* (6) */

 

A.15.2 IWDG configuration with window code example

/* (1) Activate IWDG (not needed if done in option bytes) */

/* (2) Enable write access to IWDG registers */

/* (3) Set prescaler by 8 */

/* (4) Set reload value to have a rollover each 100ms */

/* (5) Check if flags are reset */

/* (6) Set a 50ms window, this will refresh the IWDG */

IWDG->KR = IWDG_START;

/* (1) */

IWDG->KR = IWDG_WRITE_ACCESS;

/* (2) */

IWDG->PR = IWDG_PR_PR_0;

/* (3) */

IWDG->RLR = IWDG_RELOAD;

/* (4) */

while

(IWDG->SR)

/* (5) */

{

     

/* add time out here for a robust application */

}

IWDG->WINR = IWDG_RELOAD >> 1;

/* (6) */

0 REPLIES 0