|Subject:||RE: [Ltib] date and rtc|
|Date:||Wed, 16 Feb 2011 19:14:41 +0100|
>I am using fdi3250 board with kernel 2.6.34. My problem is when i read pcf8563 rtc chip by i2cget command it gives different time, when i use date command it gives different time when i do more /proc/dev/rtc it gives different time. When i set the date by date -s "16 Feb 2011 15:29:00" then the date is working but when i reset the board it gives
It sounds like the on-chip RTC and the external RTC are both enabled in the build. Cat’ing /proc/drivers/rtc dumps the on-chip RTC time, while i2cget pulls data from the external RTC chip. The date command only shows the Linux system time, which may or may not match one of the RTC’s time.
The RTC driver node is probably /dev/rtc0. I’m not sure what the pcf8563 driver node is (rtc1?). You might have to manually add the RTC nodes.
>for example i set the year 2011 by using i2cset command. When i read date from pcf8563 it gives 2011 but when i read date by using date command it gives 1970.
The date command doesn’t read the hardware RTCs. The kernel will load the system date from a RTC at startup/resume if you have it enabled in the kernel. You can also select which RTC is used to provide the date.
After you set the date of the system, you need to transfer the system date to the hardware RTC. You can use the hwclock command to do this. As long as your selected RTC is continuously powered, you should get the correct system time/date at startup from the hardware clock if it’s enabled in the kernel.
There is a basic write up on how to use the on-chip RTC here: http://www.lpclinux.com/Forums/ForumLPC32xx0004
|[Prev in Thread]||Current Thread||[Next in Thread]|