K60DN512VLL10 based custom board. "Strange problem with RTC"...

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

K60DN512VLL10 based custom board. "Strange problem with RTC"...

448 Views
chandrasekarkan
Contributor III

Hello there
   My setup:      i).    MCU used   : K60DN512VLL10       ii).   Development Env  : Keil uVision      iii).  Debugger  : pEMultilink Universal   

NOTE:   My project is up and working fine on the board but we are encountering a strange problem with RTC.

In the user config I have enabled "BSPCFG_ENABLE_RTCDEV", in the hardware, we have VBAT in place and a 32kHz clock source in place.

Code snippet:

void setTime()

{

    time_rtc.YEAR     = 2013;

    time_rtc.MONTH    = 10;

    time_rtc.DAY      = 30;

    time_rtc.HOUR     = 20;

    time_rtc.MINUTE   =  6;

    time_rtc.SECOND   =  0;

    time_rtc.MILLISEC =  0;

   _rtc_set_time_mqxd(&time_rtc);

   _time_from_date (&time_rtc, &time_mqx);

   _time_set( &time_mqx);

   _rtc_sync_with_mqx(FALSE);

}

void ReadTime()

{

  _rtc_sync_with_mqx (FALSE);

  _time_get (&time_mqx);

  _time_to_date (&time_mqx, &time_rtc);

  printf ("\nCurrent Time : %02d.%02d.%4d %02d:%02d:%02d \n", time_rtc.DAY,   time_rtc.MONTH,  time_rtc.YEAR,

                                                                                                time_rtc.HOUR, time_rtc.MINUTE,  time_rtc.SECOND);

}

I use above code to set time(30-10-2013 20:06:00), the time is getting set. Now I comment off the above code and flash it again so that time is not set every time i reset the HW.

Then when I power OFF and ON the HW (no matter how long I power off), when I read time only 2 secs had been incremented(30-10-2013 20:06:02).

What could be the problem? Please give me any reference or workaround...

0 Kudos
0 Replies