How to disable RTC module of KEA128 when i use LPO clock as the RTC clk source

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to disable RTC module of KEA128 when i use LPO clock as the RTC clk source

1,440 Views
jikanghu
Contributor I

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.

0 Kudos
Reply
4 Replies

1,255 Views
prasannahv
Contributor II

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;
}

0 Kudos
Reply

1,303 Views
miduo
NXP Employee
NXP Employee

Hi,

You can disable the RTC module by disable the RTC_CLKOUT pin function. Disable the RTCO output function on pin PTC4 or PTC5 through SIM_PINSEL[RTCPS].

0 Kudos
Reply

1,303 Views
jikanghu
Contributor I

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 ?

0 Kudos
Reply

1,303 Views
miduo
NXP Employee
NXP Employee

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 

0 Kudos
Reply