cancel
Showing results for 
Search instead for 
Did you mean: 

How to close the IWDG when STM32L051 enter stop mode.

泽陶.1
Associate II

0693W000005AIl0QAG.pngwhen I use STM32L051, its iwdg and stop function ,after it enter stop mode ,the iwdg is also working,I want to close the iwdg when it's stopped,but I didn't find this bit of "IWDG_STOP" in FLASH_OPTR register ,so I don't know how to do ,because I use this function with STM8L051.

1 ACCEPTED SOLUTION

Accepted Solutions
泽陶.1
Associate II

@Imen DAHMEN​  I got a way to solve this problem, I set the rtc BKP1R register before entering the stop mode ,then it will be reset by iwdg ,before IWDG init,check the value of the rtc BKP1R register,then do not init IWDG and enter stop mode again. It seems work as expected.

Is this way effective or it's not a right way or there will be any other bugs exist I don't know.

View solution in original post

4 REPLIES 4
泽陶.1
Associate II

Is it right to set the soft iwdg , soft iwdg will be closed when it enter stop mode.

Imen.D
ST Employee

Hello @泽锋 陶​ ,

IWDG cannot be stopped once it has been started, except by reset.

According to the RM0377 reference manual: "Independent watchdog (IWDG): the IWDG is started by writing to its Key register or by hardware option. Once started it cannot be stopped except by a Reset. Refer to Section 20.3: IWDG functional description in Section 20: Independent watchdog (IWDG)."

So, in STOP mode, once the watchdog is enabled, then it can not disabled unless it goes again to reset if enabled by software and not by Hardware.

You just have to make sure that your application resets IWDG as well.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

Thanks for your support.

It means I also cannot disable the watchdog if I set the WDG_SW to zero,zero is soft ,yes?

So I should not enable it after the watchdog reset in stop mode, is it right?

泽陶.1
Associate II

@Imen DAHMEN​  I got a way to solve this problem, I set the rtc BKP1R register before entering the stop mode ,then it will be reset by iwdg ,before IWDG init,check the value of the rtc BKP1R register,then do not init IWDG and enter stop mode again. It seems work as expected.

Is this way effective or it's not a right way or there will be any other bugs exist I don't know.