How to solve Watchdog issues
In this topic:
•How to find out if you have Watchdog issue?
•Detecting Watchdog via winIDEA
•Checking for reset messages via logging
•Solution: Disabling External Watchdog on your Target
•Solution: Disabling External via scripts
•Solution: Disabling Internal Watchdog at initialization via winIDEA
Active Watchdog issue is one of the most common issues you experience when trying to debug.
Main function of a Watchdog (WDOG) or a Watchdog Timer (WDT) is to detect if something went wrong and recover from software malfunctions by resetting the chip.
It is a timer that starts counting from 0 and when it reaches a certain value, it performs an action (e.g. reset), which is specified by the developer. To prevent this the Watchdog has to be periodically fed or kicked - that means you have to reset the counter and set it to 0 so it doesn't reach a timeout and reset the chip.
•Finished application - Active Watchdog prevents any faulty states or malfunctions.
•Start of a development - You don’t want Watchdog resetting your chip all the time, because you’re actively trying to write and debug the application. Constant resets can slow you down or even prevent you from downloading the application to the chip.
•Internal Watchdog - Implemented on the chip and internal to the MCU; it can be easily disabled by a simple write to a register.
•External Watchdog / System Basis Chip (SBC) - Implemented separately as a separate chip or board and it can reset MCU or even cut power; harder to disable, because it’s independent from the CPU.
You first notice the following issues in winIDEA:
•You can’t perform a Download
•Your application doesn’t run as expected
•winIDEA displays error messages:
oUMI error
oFailed to initialize the debug session
oError 258
oChip in reset
oCannot stop the CPU
oError programming
oExternal reset detected - possible watchdog activity
Watchdog detection is checked only after Reset / Program / Attach is performed from a disconnected debugger and not on every Reset / Program / Attach. The detection feature is disabled by default.
Open Hardware | CPU Options | Reset. |
Check Detect watchdog option and define the desired time in ms. |
You can specify the time period (in milliseconds) for checking the target's reset.
The Progress window will display the results., e.g. Detecting watchdog activity for 10000 milliseconds. Reset asserted, probably watchdog activity.
Power-cycle the BlueBox or select Debug | End Session. |
This way you will ensure the log file will start with a connection to the BlueBox. Status shown in winIDEA must be OFFLINE.
Configure settings in Hardware | CPU Options | Reset. |
1.Enable option Latch target RESET.
2.Disable Stop after target RESET.
Create a log file via Help | Support | Log. |
1. Check options 0, 1, 3, 4, 6, 28, 33. To avoid too much information in the log files don't enable too many options if it's not required.
2. Select Debug level and Absolute time.
3. Press the Clear button and copy the Log file path to open it later in the text editor.
Execute CPU Reset and open the log file. |
The first reset is issued by the BlueBox. If several TRESET or Target RESET strings are found in the log file this indicates a watchdog reset (periodic reset) or other external source are resetting the CPU.
winIDEA offers various solutions to disable internal or / and external watchdog.
Beside the solutions listed below, there is also an option that you have the watchdog enabled in your code.
If you get periodic resets measured on your target, disable the External Watchdog on your Target.
Make sure you are not using any external watchdog chip. |
For example Infineon TLE9278QX, TLE7368, TLF35584, NXP UJA113X.
Use a pull-up resistor instead of a pull-down resistor. |
Chip has an input TM (Test Mode) where this operation can be disabled.
BlueBox signal PORST’ is an open drain with 1K Ohm pull-up resistor which can be pulled down by the External Watchdog chip. CPU behaves as a multiple output system power supply and when the watchdog is enabled, this chip expects that it is disabled in ~600ms after power on reset. If it is not disabled, it resets the chip. After that multiple output system power supply is turned off and hence cuts the power to the chip.
If you get periodic resets measured on your target, disable the External Watchdog via scripts.
Open Hardware | CPU Options | Reset. |
Select a script from the SFR folder via Initialization before Programming | Initialize. |
For example, select TC3X9_TLF35584_disable_stepA.ini to disable External Watchdog on the TLF chip (see Target folder).
Some external watchdogs require the script to be executed before 600ms expires (that is time after target power on and not after reset). It initializes SPI in the chip and via SPI communication disables watchdog in the TLF chip. |
The option is available in Hardware | CPU Options | Reset and it's checked by default on devices which have an Internal Watchdog.
If Internal Watchdog is not supported, this option is greyed out.
If the Initialization is set to Disabled, the watchdog is not disabled.