cancel
Showing results for 
Search instead for 
Did you mean: 

Resetting the IWDG on wakeup using HAL STM32L011K4T

LMill.2
Associate

Hi all,

I believe I am having a problem with the IWDG in my project. What's happening is that immediately after entering sleep mode the device wakes up again.

From the research I have done, it looks like this is inevitable, and in order to deal with it I need to check the wakeup state at the start of my code, and put it back to sleep if it was woken up by the watchdog instead of the WKUP pin being pulled high.

I am struggling to figure out how to do this within the HAL, I know it can be done, I have seen it in projects at work, but I am not a FW engineer, and that code was written with custom libraries.

Any help would be appreciated.

Cheers,

Luke

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

Check, then clear, the values of RCC->CSR. If IWDG flag was set, go back into low power mode.

int iwdg_reset = RCC->CSR & LL_RCC_CSR_IWDGRSTF;

...

if (iwdg_reset) {

// go to sleep)

}

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

2 REPLIES 2
TDK
Guru

Check, then clear, the values of RCC->CSR. If IWDG flag was set, go back into low power mode.

int iwdg_reset = RCC->CSR & LL_RCC_CSR_IWDGRSTF;

...

if (iwdg_reset) {

// go to sleep)

}

If you feel a post has answered your question, please click "Accept as Solution".
Piranha
Chief II