Solved: Increasing RTC Period

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

I set up an RTC to wake up my ATXMEGA32D4 from the power save mode. The RTC Module uses the 1.024 kHz from 32.768 kHz crystal oscillator on TOSC, and the prescaler value is set to 1024. So the RTC counts for every one second. I change the RTC.PER to configure the wake-up time. It works well when I set it to 1 hour but if I set it to 4 hours I get a device reset on every 3 hours. Is there anything I need to know to understand the reason behind this issue? Here is an example:

 

void rtc_init(void)
{
	CLK.RTCCTRL	= CLK_RTCSRC_TOSC_gc|CLK_RTCEN_bm;	/* 1.024 kHz from 32.768 kHz crystal oscillator on TOSC */

	RTC.CTRL	= RTC_PRESCALER_DIV1024_gc;			/* RTC Clock / 1024 */

	while((RTC.STATUS & RTC_SYNCBUSY_bm));

	RTC.PER		= standby_wake_up_timer;			/* Configure the device wake-up time */
	RTC.INTCTRL |= RTC_OVFINTLVL_HI_gc;
	RTC.CNT		= 0;
	RTC.COMP	= 0;
}

/*

If I set the standby_wake_up_timer to 3599, it successfully wakes up the device on every hour.
But if I set it to 14399,the device resets on every 3 hours. It should have waked up the device on every 4 hours.

*/

 

Edit: I found out that the device reset was because of our external watchdog hardware. Sorry for my mistake. There is nothing wrong with the RTC :)

Last Edited: Thu. Apr 20, 2017 - 08:01 AM