IWDG and SLEEP mode(s)

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: RoccoMarco, barthess

Tabulous
Posts: 509
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 17 times

IWDG and SLEEP mode(s)

Postby Tabulous » Tue Aug 01, 2017 11:59 am

Hi All
as you may know running IWDG and SLEEP mode together is not compatible i.e. you can never have IWDG when in SLEEP mode, if you do it will just reset you.

So IWDG can only protect against software issues whilst code is executing, as you have to reset it from the code.

You also cannot stop the IWDG prior to entering SLEEP mode, Once IWDG is started the only thing that will reset it is when it expires and resets the device.

So if you want to use IWDG and SLEEP, you have to work like this:-

Device starts up
Device checks a non-volatile setting to see what the state is
If the state is "normal", then the application starts as normal and enables the IWDG.
If the state is "sleep", then the application enters sleep mode, and no IWDG is started.

When running in "normal" if the application needs to enter "sleep" it writes to the non-volatile setting to set it to "sleep" and then lets the IWDG expire. This then resets the device and we start the loop again.

Now is it possible to do the checking of non-volatile setting and entering sleep in __early_init ?
Or does anyone else have any suggestion on this subject ?

Tabulous
Posts: 509
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 17 times

Re: IWDG and SLEEP mode(s)

Postby Tabulous » Wed Aug 02, 2017 8:48 am

decided to drop the IWDG and use the WWDG.

WWDG because it is run from APB bus when entering SLEEP one can disable the clock and thus pause it whist asleep.

Worth noting the new L4's and L1's have this ability with the IWDG, so ST must have thought it was a good idea to have.


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 18 guests