2024-02-10 03:21 AM
Hello,
STM8S208RB microcontroller, Independent watchdog (IWDG). After starting the watchdog timer (command KEY_ENABLE value = 0xCC), I understand that the watchdog timer stops after resetting the microcontroller. The default register state is undefined (see figure below). Could it be that after resetting the microcontroller the watchdog timer will be turned on? How can a watchdog timer be stopped while a program is running on a microcontroller? The key register (IWDG_KR) does not have a watchdog stop command (see figure below).
2024-02-10 04:35 AM
Hi,
>The default register state is undefined (see figure below)
You misunderstanding : the register is "w" , write only - so you cannot read and this means "undefined".
Its only for write a command, like CC for enable.
>Could it be that after resetting the microcontroller the watchdog timer will be turned on?
no.
>How can a watchdog timer be stopped while a program is running
Usually not at all. Thats what the watchdog is for : unstoppable watch-clock, that resets the cpu in case of a "hanging" program.
If you want something to start and stop anytime, just use a timer.
2024-02-10 04:44 AM
Hello,
If I enabled the watchdog timer, then reset the microcontroller. After the reset, will the watchdog timer be enabled or disabled?
2024-02-10 05:05 AM
At /after reset we have a new program start and no watchdog running - you never could run a program, if always the watchdog resets it again and again - you never could stop this.
So dont ever start the watchdog, if you anyway want debug and build on your program;
the watchdog will be useful, if your program is almost finished and working as you want - and then you want some
added security , if something you didnt expect happens and your program "hang up" : after some time (you set the useful limit) the watchdog kicks in and restarts the cpu ...better luck this time . :)