WATCHDOG: What would be the worst thing when I do not wait for the WATCHDOG to sync the new settings

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi freaks

I had a project with XMEGA that puts MCU to sleep mode repeatedly. I disable the WDT before entering sleep mode and enable it on waking up.

WDT enable function was like

void wdt_enable(void)
{
	uint8_t wdt_ctrl = WDT.CTRL | WDT_ENABLE_bm | WDT_CEN_bm;
	ccp_write_io((void *)&WDT.CTRL, wdt_ctrl);
	WDT_SYNCBUSY();
	wdt_reset();
}

And I recently notice that it takes 4ms for my watchdog timer to synchronize new settings. It would be quite amount of time if MCU waking up from sleep mode frequently.

 

Now, I wander what if I do not wait WDT sync. Can I still reset it when it is synchronizing? Or else, what the worst might happen if I skip wait for WDT_SYNCBUSY()?

"The life of the individual only has meaning insofar as it aids in making the life of every living thing nobler and more beautiful. Life is sacred, that is to say, it is the supreme value to which all other values are subordinate."
-- Albert Einstein

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you don't wait the watchdog might not enable.

 

My advice would be to avoid turning the watchdog off. Instead just use the RTC with the ultra low-power 30kHz oscillator to wake up and reset it every few seconds.