John bob

MCF52210 RTC problem

Discussion created by John bob on Jul 22, 2008
Latest reply on Aug 1, 2008 by John bob
Hi,
       For awhile now I've been using the RTC and its been working correctly, but now it is getting screwy.  The way i have it configured is that it can update the clock if the time is sent serially.  The problem occurs when I set the day register using the data received serially.  For some reason it messes up the hours and minutes registers.  It almost looks like every time the seconds register reaches 60 it increments both the minutes and the hours.  The problem does not occur if I don't give the day register a value, the code is setup as follows:
 
 
  //REAL TIME CLOCK CONFIG
 
   MCF_CLOCK_RTCCR=0b01010110; //RTCCC
  MCF_RTCGOCL = 0x00002000; //32KHz
  MCF_CLOCK_RTCCR=0b01010111; //RTCCC\
 
 
// Writing to registers
 
 MCF_RTC_HOURMIN = (((stimValue[parsingOffset + 3]) << 8) | (stimValue[parsingOffset + 4])); 
 MCF_RTC_SECONDS = MCF_RTC_SECONDS_SECONDS(stimValue[parsingOffset + 5]);
MCF_RTC_DAYS = (stimValue[parsingOffset +6]);
 
The stimValue is the data received serially, I'm just picking off the values needed to update
 
I know reading the values is not the problem becuase I looked in the registers and the acually values in the registers are changing, to weird numbers once the day reg is written to.
 
Thanks for any help.

Outcomes