RTC in AT91SAM9263
I am using AT91SAM9263 on linux 2.6.27
For my application I need to use the RTC to store the time during data logging. I am using the RTT as RTC. I have made the configurations as mentioned below but was not able to run the RTC.
Following configurations were made in Linux:
CONFIG_RTC_LIB=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_HCTOSYS=y
CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
CONFIG_RTC_DEBUG=y
#
# RTC interfaces
#
CONFIG_RTC_INTF_SYSFS=y
CONFIG_RTC_INTF_PROC=y
CONFIG_RTC_INTF_DEV=y
#
# on-CPU RTC drivers
#
CONFIG_RTC_DRV_AT91SAM9=y
CONFIG_RTC_DRV_AT91SAM9_RTT=0
CONFIG_RTC_DRV_AT91SAM9_GPBR=0
I created a symbolic link in the file /etc/udev/rules.d/50-udev-default.rules:
KERNEL=="rtc0", ATTR{name}=="at91_rtt", DRIVERS=="at91_rtt", SYMLINK+="rtc"
The application included the code:
int fd;
struct rtc_time rtc_tm;
int ret;
fd = open("/dev/rtc0", O_RDWR, 0);
ret = ioctl(fd, RTC_RD_TIME, &rtc_tm);
printf ("RTC read return = %d\n",ret);
The value printed was -1.
Also the file /dev/rtc0 has a size of '0'.
Can any one tell me what seetings are to be made additionally for the RTC to run.
|