This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Watchdog behavior while debugging

Recently while debugging my application i noticed strange behavior: i set watchdog timer to restart application if my peripheral is not receiving any data for some time.

In normal way - it seems to work, but when debugger session is open it is not restarting my app.

Does watchdog work while debugging?

void wdt_init(void){
_timer = 0;

_connected = false;
_reload_enabled = true;

NRF_WDT->POWER = 1;
NRF_WDT->CONFIG = (WDT_CONFIG_HALT_Pause << WDT_CONFIG_HALT_Pos) | ( WDT_CONFIG_SLEEP_Run << WDT_CONFIG_SLEEP_Pos);
// Configure Watchdog.
//  a) Pause watchdog while the CPU is halted by the debugger.
//  b) Keep the watchdog running while the CPU is sleeping.

NRF_WDT->CRV = 10UL * 32768UL;      //ca 10 sek. timout
NRF_WDT->RREN |= WDT_RREN_RR0_Msk;  //Enable reload register 0
NRF_WDT->TASKS_START = 1;           //Start the Watchdog timer}

I am using QFAA C0 chip

  • Hi

    I am also not making great success with the watchdog in the debugger mode. It basically never triggers reset. The problem is reported in nRF51822-PAN v2.2 issue #38, found on our web site. I am however not having any problems with the watchdog in normal mode, i.e. after power cycling.

  • Initially I was going to cite PAN issue #38 as well. However it looks like Wojtek is following the advice of the PAN and configuring the watchdog to halt while the debugger is paused. Perhaps the PAN needs clarification/broadening of this issue?

  • You are correct John, I was perhaps too quick to answer the question. For the first revision hardware of nRF51, the watchdog does not produce a reset while in debug mode. Your nRF51822QFAAC0/nRF51422C0 chip is the first revision hardware. However, it works with the second revision nRF51 hardware (e.g. nRF51822QFAAG0). The watchdog however stops when I set breakpoint in debug mode and stop the code execution for the second revision hardware. When I remove the breakpoint and continue execution, the watchdog resets the chip. For the first revision hardware, I can set a breakpoint and halt code execution, but the watchdog still does not work in debug mode, it does not reset the chip when I remove the breakpoint and continue execution. So, yes I aggree, PAN issue #38 needs some clarification

Related