I am using KL25 RTC for a while. the alarm interrup is working right as i can set an alarm and get an interrupt at the right time.
but when i try to read RTC_TSR i can not see it changing each 1 sec as it would be.
I tried timestamp = RTC_TSR and also RTC_HAL_GetDatetimeInSecs(RTC,×tamp);
I am doing something wrong? the module seems to be ok as the alam interrup is working nice.
Hello Edriano,
Please check whether the SR[TOF] or SR[TIF] are set ?
Hope it helps
Alice
Ok. now i got what is happening.
I am using LPO clock just for test and as i can't change the prescale it will only increment each 32,7 seconds.
I will try to find a 32Khz clock source to use as rtcclk.
Hello Alice.
both flags are zero, it is not the problem. i have investigated a little more futher and tried many others ways of reading the TSR. And what i see is that.
RTC_HAL_GetDatetime(RTC,&date); |
RTC_HAL_ConvertDatetimeToSecs(&date, ×tamp);
Or if i simple try to read TSR timestamp = RTC_TSR;
i get the same result RTC_TSR value divided by 2.