Difference between revisions of "RTC"

From ArmadeusWiki
Jump to: navigation, search
m (Hardware)
(Insist on UTC)
Line 17: Line 17:
  
 
== Usage ==
 
== Usage ==
 
+
{{Note|We recommand to store time in [[wikipedia:UTC|UTC]] format in the RTC; that will ease the timezone/summer time handling.}}
 
* From U-Boot there is a command '''date''' to read, reset, update the RTC.
 
* From U-Boot there is a command '''date''' to read, reset, update the RTC.
 
<pre class="apf">
 
<pre class="apf">
Line 24: Line 24:
 
  BIOS> date 013122302007  to set the date January 31th 2007 22h30.
 
  BIOS> date 013122302007  to set the date January 31th 2007 22h30.
 
</pre>
 
</pre>
* From Linux use the command '''hwclock''' to read, write, synchronize the RTC:
+
* From Linux use the command '''hwclock''' to read, write, synchronize the RTC (here we pre-suppose that RTC is storing time in UTC format).
 
<pre class="apf">
 
<pre class="apf">
 
  # hwclock --help
 
  # hwclock --help
  # hwclock -r      to read hardware clock and print result
+
  # hwclock -r -u     to read hardware clock and print result (localtime)
  # hwclock -s      to set the system time from the hardware RTC clock
+
  # hwclock -s -u     to set the system time from the hardware clock
  # hwclock -w      to set the hardware RTC clock to the current system time
+
  # hwclock -w -u     to set the hardware clock to the current system time (UTC)
 
</pre>
 
</pre>
 
* and '''date''' to read and update system date and time while running:
 
* and '''date''' to read and update system date and time while running:
Line 35: Line 35:
 
  # date --help        for more information
 
  # date --help        for more information
 
  # date -R            to read hardware clock and print result
 
  # date -R            to read hardware clock and print result
  # date 013122302007  to sets the system date january 31th 2007 22h30.
+
  # date 013122302007  to sets the system date to january 31th 2007 22h30 (localtime)
 
</pre>
 
</pre>
 
* Then, when booting you will see something like this:
 
* Then, when booting you will see something like this:
 
<pre class="apf">
 
<pre class="apf">
 
  ds1374 0-0068: setting the system clock to 2007-09-09 17:35:51 (1189359351)
 
  ds1374 0-0068: setting the system clock to 2007-09-09 17:35:51 (1189359351)
 +
</pre>
 +
* TimeZone/Summer time handling can be configured in /etc/TZ:
 +
<pre class="apf">
 +
# cat /etc/TZ
 +
CET-1DST,M3.5.0/2:00,M10.5.0/3:00
 
</pre>
 
</pre>
  
 
== Links ==
 
== Links ==
 
* [http://datasheets.maxim-ic.com/en/ds/DS1374-DS1374U.pdf Maxim's DS1374 datasheet]
 
* [http://datasheets.maxim-ic.com/en/ds/DS1374-DS1374U.pdf Maxim's DS1374 datasheet]

Revision as of 18:05, 26 August 2009

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

Hardware

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.

Driver installation

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)

Usage

Note Note: We recommand to store time in UTC format in the RTC; that will ease the timezone/summer time handling.
  • From U-Boot there is a command date to read, reset, update the RTC.
 BIOS> help date          for more information
 BIOS> date reset         to be done after battery exchange to remove message '''### Warning: RTC oscillator has stopped'''
 BIOS> date 013122302007  to set the date January 31th 2007 22h30.
  • 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)
  • 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 013122302007  to sets the system date to january 31th 2007 22h30 (localtime)
  • Then, when booting you will see something like this:
 ds1374 0-0068: setting the system clock to 2007-09-09 17:35:51 (1189359351)
  • 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

Links