LPC5536 RTC issue

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
910件の閲覧回数
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 解決策
883件の閲覧回数
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 返信
884件の閲覧回数
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 件の賞賛
返信