This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Configure Watchdog timer to pause during sleep .

Hello,

I am working on a nrf52833 custom board.  Most of the time, the system stays in sleep mode, and periodically sends bursts of data via SoftDevice.

I try to configure the WDT to pause during long sleep for this system.  However, it seems like doing so would disable the watchdog timer reset functionality.  I intended to let the application run without reloading the WDT and the reset never happens. 

However, if I configure the WDT to run during CPU sleep (NRF_WDT->CONFIG = 1), then the WDT raises reset as expected if it is not serviced.

Is there any extra configuration I have missed out from the nrf52833 documentation that would cause such behavior?  Thank you for your help. Phil.

NRF_WDT->CONFIG = 0; // Set WDT to pause during CPU sleep
NRF_WDT->CRV =   32768;
NRF_WDT->RREN = 0x01; //enables RR[0] only
NRF_WDT->TASKS_START = 1;

Parents
  • Hi,

    I don't think I have seen cases where the WD did not time out. More often we see customers complaining it does time out after many hours in case of long sleep periods and having the SD run in the background.

    I see that you have configured a timeout value of ~1 second and also halting the WDT while in sleep. This means you have to do spend some time not sleeping before the watchdog will trigger a reset. Can you elaborate a little on your application? what do you do when it's not sleeping? for how long is it awake? how long sleep periods do you have? i.e. are you sure the cpu has been running enough for the wdt to trigger?

    As an experiment maybe you could try to enter a loop after the sleep period to see if the wdt resets as it should in that case?

  • Hello run_ar,

    Thank you for the information, as I see the periodic events generated in my system are extremely short, and the sleep period is way longer, and therefore the confusion.  I did the suggestion to let the system enter endless loop and the WDT resets as expected.

    All and all, this leads to another question regarding the resolution of the WDT timer.  Since the WDT timer runs on the 32.768Khz clock (~30.5 uSec period), will the WDT eventually time out if the duration of every periodic event is less than this WDT resolution, say 30 uSec?

    Phil.

  • Hi,

    The WDT timer will increment on the 32.768KHz clock. In this case, when the timer is configured to halt in sleep, and the periodic events are shorter than one 32kHz clock cycle, it will not increment, and not time out as long as the periodic events are short enough.

Reply Children
No Data
Related