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.
Solved! Go to Solution.
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
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