I need a 3s timer and a 60s timer in different place, i choice the RTC module to generate the timer flag, LPO clk is the RTC CLK source, how to enable RTC module when the timer is needed, and how to disable RTC when it is unwanted.
I want to generate RTC interrupt for every 60 seconds. Can anyone suggest how to do the register setting
Here is my code for 1 second interrupt
void init_rtc(void) {
SIM_SCGC |= SIM_SCGC_RTC_MASK; /* Enable clock for RTC*/
RTC_MOD = RTC_MOD_MOD(37500);//32000);//26666);//32000);
Enable_Interrupt(INT_RTC);
RTC_SC |= RTC_SC_RTIF_MASK | RTC_SC_RTCPS(1);
RTC_SC|=RTC_SC_RTCLKS(0b10); /* int clock selected*/
SIM_PINSEL0|=SIM_PINSEL_RTCPS_MASK; /* RTCO in PTC5 */
RTC_SC |=RTC_SC_RTIE_MASK;
}
Hi,
thanks,i don't use RTC_CLKOUT PIN, i just use RTC as a timer, because PIT is already used , what i want to know is how to disable RTC moduel, because i use LPOCLK as the RTC clk source, and SIM->SCGC &= ~SIM_SCGC_RTC_MASK will not disable RTC, is this right? the manaul says when reset ,the RTC is stopped in default, how can i start the RTC, and when the RTC runs, how to disable it?which instruction can i use ?
Hi,
Well, the RTC module do not need to disable, it is disabled as default. For your case, you may would like make the LPOCLK as a WDG clock. Please make reference this post on detail:https://community.nxp.com/thread/448643