Find the answer to your Linux question:
Results 1 to 8 of 8
Hi, I am working on DM355 leopard board with linux kernel 2.6.10. But i didn get current time by using following commands #cd /proc/driver/ # cat rtc DaVinci I2C WARNING: ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2011
    Posts
    68

    How to set rtc time


    Hi,

    I am working on DM355 leopard board with linux kernel 2.6.10.
    But i didn get current time by using following commands

    #cd /proc/driver/
    # cat rtc
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: RAR detected
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: RAR detected
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: RAR detected
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: RAR detected
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: RAR detected
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: RAR detected
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: RAR detected
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: RAR detected
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: RAR detected
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: RAR detected
    DaVinci I2C WARNING: i2c: NACK detected

    rtc_date : 1900DaVinci I2C WARNING: i2c: RAR detected
    -01-00
    rtc_epocDaVinci I2C WARNING: i2c: NACK detected
    h : 1900
    DaVinci I2C WARNING: i2c: RAR detected
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: RAR detected
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: RAR detected
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: RAR detected

    Then i tried the following code to set the rtc time, but no use..

    /* Set the RTC time/date */
    rtc_tm.tm_mday = 7;
    rtc_tm.tm_mon = 1;/* for example Sep. 8 */
    rtc_tm.tm_year = 112;
    rtc_tm.tm_hour = 4;
    rtc_tm.tm_min = 24;
    rtc_tm.tm_sec = 0;

    printf("5. Set RTC Time\r\n");
    ret = ioctl(rtc_fd, RTC_SET_TIME, &rtc_tm);
    if (ret == -1) {
    printf("rtc ioctl RTC_SET_TIME error\r\n");
    }

    Any idea?

    Thanks

  2. #2
    Linux Newbie hans51's Avatar
    Join Date
    May 2011
    Posts
    136
    do a regular default time sync in your bash

    sntp -s pool.ntp.org
    or better start
    ntpd
    in your system configuration upon booting by default

  3. #3
    Just Joined!
    Join Date
    Jan 2011
    Location
    Fairfax, Virginia, USA
    Posts
    94
    When you try Hans's idea, transfer the system time to the RTC with a command something like:
    Code:
    hwclock --systohc
    Was your RTC compiled into your kernel or is it a module? Can you check if your module is loaded?
    I don't have experience with your card, but a quick Google suggests your RTC comes from drivers/rtc/rtc-davinci.c

  4. #4
    Just Joined!
    Join Date
    Nov 2011
    Posts
    68
    I am a newbie to this field so i don have much idea...I think RTC is compiled in to the kernel because when i gave 'lsmod' i didn find any rtc.. its there in cd /dev/driver...

    I tried following commands
    # hwclock -r
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: NACK detected
    Thu Jan 1 07:59:59 1970 0.000000 seconds

    # hwclock -s
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: NACK detected

    # hwclock -w
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: NACK detected
    hwclock: Could not set the RTC time: Input/output error

    # hwclock -l
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: NACK detected
    Thu Jan 1 07:59:59 1970 0.000000 seconds

    # hwclock -u
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: NACK detected
    DaVinci I2C WARNING: i2c: NACK detected
    Thu Jan 1 07:59:59 1970 0.000000 seconds

    How will i set the hardware clock??
    Last edited by steffi; 02-28-2012 at 10:24 AM.

  5. #5
    Just Joined!
    Join Date
    Nov 2011
    Posts
    68
    I tried with hwclock then also its showing the same error...How can i solve this problem??

  6. #6
    Just Joined!
    Join Date
    Jan 2011
    Location
    Fairfax, Virginia, USA
    Posts
    94
    Quote Originally Posted by steffi View Post
    I tried with hwclock then also its showing the same error...How can i solve this problem??
    Can you grep in your kernel .config file for RTC and post the response? Is there anything good in /var/log/messages?

  7. #7
    Just Joined!
    Join Date
    Nov 2011
    Posts
    68
    I couldn find any .config file for rtc and in /var/log there is no directory named message..

  8. #8
    Just Joined!
    Join Date
    Nov 2011
    Posts
    68
    Plz anyone can help me to solve this problem??

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •