So i have been having a rough go at getting the RTC to function properly under MQX 4.2.
A little background:
We are have been using the k60 for awhile now, and previously used MQX 4.01. We recently upgraded to MQX 4.2, to work with the GNU compiler and KDS IDE (moving away from codewarrior).
At first, i thought it was an issue that the RTC was not configured properly in the BSP libraries because upon each boot the RTC would be set to Jan. 1970.
Under the MQX 4.01, there was a function to sync the mqx time with the rtc time after the initialization in init_bsp.c
In version 4.2, this does not exist.
We setup a function to be called from the user application (not the BSP operating system) which resolved the time/data being set to the 1970 default.
mqx_time.SECONDS = rtc_seconds;
So everything is working as expected now? Not so fast....
Still have 1 anomaly that I cant really explain...
When I go to change the time/date. It is offset by 7~8 minutes.
Here is the process:
1) Call _time_get() to get the mqx time.
2) Call _time_to_date() to get the time relative to the RTC.
3) Set the new hour and minutes in the DATE_STRUCT.
_time_to_date (&time_mqx, &time_rtc);
time_rtc.HOUR = iHour;
time_rtc.MINUTE = iMinute;
time_rtc.SECOND = 0;
The Date structure is then passed to another function which does the following:
1) Calls _time_from_date().
2) Calls _time_set() to set the new mqx time.
3) Calls _rtc_set_time() and passes in the mqx time in seconds.
4) Calls _time_get() & _time_to_date() to verify the data was entered correctly.
Here's the interesting part...
Only after the first power cycle since setting the time, will make the time jump forward 7-8 minutes.
The RTC is still running via battery power when the main power (vdd) is turned off and i have verified it does boot backup with the correct data and time (plus the initial 8 minute jump that happens only on the first power cycle after setting the time).
Does anyone have any advice to what could be occurring?
I also apologize if this appears to be a duplicate post.
Thanks for your time,