LPC5536 RTC issue

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

LPC5536 RTC issue

跳至解决方案
922 次查看
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 项奖励
回复
1 解答
895 次查看
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 项奖励
回复
1 回复
896 次查看
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 项奖励
回复