RTC

From ArmadeusWiki
Revision as of 17:26, 11 October 2012 by Jorasse (Talk | contribs)

Jump to: navigation, search

On this page, you will find useful informations to use the Real Time Clock of your boards (if chip is mounted).

Hardware

APF9328/APF27

No permanent RTC is present on the APF9328/APF27 modules, but you can have one (as an option) on the development boards or add it yourself if you are an electrician (it is not so complex to add a DS1374 (with integrated quartz) on the I2C bus). Do not forget to provide the two power-supply (VCC and Vbackup)). Currently only Maxim's DS1374 has been used but any I2C RTC, supported by Linux, should work the same way.

APF51/APF28

APF51 and APF28 modules have an onboard PMIC with an integrated RTC.

Driver installation

APF9328/APF27

DS1374 is by default included in standard Armadeus Linux kernel. To check if your board (Linux) has correctly detected the RTC:

# dmesg | grep ds1374
ds1374-legacy 0-0068: chip found, driver version 1.0
ds1374-legacy 0-0068: rtc core: registered ds1374-legacy as rtc0
ds1374-legacy 0-0068: setting system clock to 1970-01-01 00:00:07 UTC (7)

APF51 and APF28

Driver is by default installed and launched. To check if your board (Linux) has correctly detected the RTC:

# dmesg | grep rtc
wm831x-rtc wm831x-rtc: rtc core: registered wm831x as rtc0
wm831x-rtc wm831x-rtc: setting system clock to 2011-05-03 13:27:26 UTC (1304429246)

Usage

Note Note: We recommand to store time in UTC format in the RTC; that will ease the timezone/summer time handling.
  • From Linux use the command hwclock to read, write, synchronize the RTC (here we pre-suppose that RTC is storing time in UTC format).
 # hwclock --help
 # hwclock -r -u      to read hardware clock and print result (localtime)
 # hwclock -s -u      to set the system time from the hardware clock
 # hwclock -w -u      to set the hardware clock to the current system time (UTC)
Warning Warning: Security "features" prevent to change RTC time more than 8 times per hour on the APF51 !!
  • and date to read and update system date and time while running:
 # date --help        for more information
 # date -R            to read hardware clock and print result
 # date 013122302011           to sets the system date to january 31th 2011 22h30 (localtime)
 # date 2011.01.31-22:30:00    also do the job
  • Then, when booting you will see something like this:
ds1374 0-0068: setting the system clock to 2011-xxxx
or
wm831x-rtc wm831x-rtc: setting system clock to 2011-xxxx
  • TimeZone/Summer time handling can be configured in /etc/TZ:
 # cat /etc/TZ
 CET-1DST,M3.5.0/2:00,M10.5.0/3:00
  • you can update RTC from a NTP (Network Time Protocol) server if your board is connected to internet or a NTP server
 # ntpd -nqp 217.147.208.1
 ntpd: setting clock to Mon Apr 23 22:36:39 DST 2012 (offset 1335216961.855897s)
 # hwclock -wu  # to set the hardware clock to the current system time (UTC)

Links