7.8.5.3 Hardware watchdog
The hardware watchdog of a STM32 device can be enabled by programming the
option bytes. If the hardware watchdog is enabled the device is reset periodically if
the watchdog timer is not refreshed and reaches 0. If the hardware watchdog is
enabled by an application which is located in flash and which does not refresh the
watchdog timer, the device can not be debugged anymore.
Disabling the hardware watchdog
In order to disable the hardware watchdog the option bytes have to be re-pro-
grammed. SEGGER offers a free command line tool which reprograms the option
bytes in order to disable the hardware watchdog. For more information about the
STM32 commander, please refer to J-Link STM32 Commander (Command line tool)
on page 83.
Note:
In order to re-program the option bytes they have to be erased first. Eras-
ing the option bytes will read-protect the flash of the STM32. The STM32 commander
will also override the read-protection of the STM32 device after disabling the watch-
dog. Please also note that unsecuring a read-protected device will cause a mass
erase of the flash memory.
7.8.5.4 Watchdog usage on STM32F devices
On the STM32F devices the watchdog is disabled after reset, by default. If you enable
the watchdog (independed watchdog / window watchdog) in your target application
and still want to debug it, you should make sure that the watchdog does not keep
running while the CPU is in debug mode (e.g. halted by J-Link). This can be config-
ured via the DBGMCU_CR register of the STM32F devices. To configure the watchdog
timers to stop while the CPU is in debug mode, bits 8 and 9 of the DBGMCU_CR have
to be set:
*((volatile int *)(0x40040520)) = (1 << 8) | (1 << 9);
J-Link / J-Trace (UM08001)
© 2004-2011 SEGGER Microcontroller GmbH & Co. KG
171
Need help?
Do you have a question about the J-Link and is the answer not in the manual?
Questions and answers