Hi,everyone!
I found a problem when I referred to the example code. the codes "while(RTC->MOD)" will spend more than 1 second.I use the oscilloscope to observe in my project .Could you help me?
mcu:keazn8
example code:
void RTC_DeInit(void)
{
Disable_Interrupt(RTC_IRQn);
RTC->MOD = 0;
while(RTC->MOD);
if(RTC_GetFlag())
{
RTC_ClrFlags();
}
RTC->SC = 0;
while(RTC->SC);
SIM->SCGS &= ~SIM_SCGC_RTC_MASK;
}
My code:
void RTC_DeInit(void)
{
Disable_Interrupt(RTC_IRQn);
RTC_MOD = 0;
while(RTC_MOD);
if(RTC_SC_RTIF_MASK == (RTC_SC & RTC_SC_RTIF_MASK))
{
RTC_SC |= RTC_SC_RTIF_MASK;
}
RTC_SC = 0;
while(RTC_SC);
SIM_SCGC &= ~SIM_SCGC_RTC_MASK;
}