LPC5536 RTC issue

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

LPC5536 RTC issue

Jump to solution
496 Views
AlvinLin1933
Contributor I

When CPU run at 150MHz, read the value of RTC continuously then will get the error time sometime, loop the following code.

        IRTC_GetDatetime(RTC_PERIPHERAL,&datetime_get);
        if(datetime_get.second == 63)
        {
            //读取错误时,秒数位63秒
            a = datetime_get.second;
        }

but when CPU run at 96MHz, don't have the error.

0 Kudos
Reply
1 Solution
469 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

I suppose that you can not read the RTC time in a main forever loop like:

void main()

{

.............

while(1)

{

IRTC_GetDatetime(RTC_PERIPHERAL,&datetime_get);
if(datetime_get.second == 63)
{
//读取错误时,秒数位63秒
a = datetime_get.second;
}

}

.....................

}

The RTC count counts 1HZ tick, but you read it in a very high speed in a main loop.

I suggest you use a Timer to generate a fixed period interrupt with timerISR(); in the ISR, read RTC.

void timerISR()

{

IRTC_GetDatetime(RTC_PERIPHERAL,&datetime_get);

}

Hope it can help you

BR

XiangJun Rong

 

View solution in original post

0 Kudos
Reply
1 Reply
470 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

I suppose that you can not read the RTC time in a main forever loop like:

void main()

{

.............

while(1)

{

IRTC_GetDatetime(RTC_PERIPHERAL,&datetime_get);
if(datetime_get.second == 63)
{
//读取错误时,秒数位63秒
a = datetime_get.second;
}

}

.....................

}

The RTC count counts 1HZ tick, but you read it in a very high speed in a main loop.

I suggest you use a Timer to generate a fixed period interrupt with timerISR(); in the ISR, read RTC.

void timerISR()

{

IRTC_GetDatetime(RTC_PERIPHERAL,&datetime_get);

}

Hope it can help you

BR

XiangJun Rong

 

0 Kudos
Reply