MCF5222x RTC Confusion

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

MCF5222x RTC Confusion

2,139 次查看
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
标签 (1)
0 项奖励
回复
1 回复

1,148 次查看
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 项奖励
回复