MCF5222x RTC Confusion

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

MCF5222x RTC Confusion

2,257 Views
GPS
Contributor I
I'm using the MCF52221 and trying to use the integrated RTC. The latest versions of the RM (v1.0 and v2.0) indicate that the prescaler control for the RTC clock (used to generate the 1 Hz RTC clock) is in the RTC control register but fails to indicates the bits used or the magic numbers. I found a table in v0.0 of the RM that gives the magic numbers for selecting one of 4 clock sources but no indication of the location of the bits in the register or where the clock is actually coming from. The IDE is no help either because it doesn't even list the RTC as a device in the "register" view of the debugger. I'm running the CPU at 27.5 MHz and in the default mode (whatever that is) the RTC seems to be running slow - ~70 seconds of wall time measured as ~39 seconds by the RTC.

Is there anyone who can explain the RTC or point me to the Freescale document which describes it?

Thanks,
Greg
Labels (1)
0 Kudos
Reply
1 Reply

1,266 Views
DrSeuss
Contributor I
The counter register is:
 
 /* Set real time clock freq */
 MCF_CLOCK_RTCDR = 48000000;
 
The time register is:
 
 rtc_hrs = (UINT8)((MCF_RTC_HOURMIN & 0x00001F00)>>8);
 rtc_min = (UINT8)(MCF_RTC_HOURMIN & 0x0000003F);
 rtc_sec = (UINT8)(MCF_RTC_SECONDS & 0x0000003F);
0 Kudos
Reply