Difference between revisions of "RTC"

From ArmadeusWiki
Jump to: navigation, search
m (Configuration)
(beautifying continue)
Line 1: Line 1:
On this page, you will find usefull informations to use an external DS1374 Real Time Clock.
+
On this page, you will find useful informations to use the Real Time Clock of your boards (if chip is mounted).
This feature apply to the armadeus software release 2.0 and above.
+
  
 
== Hardware ==
 
== Hardware ==
  
No permanent RTC is present on the APF9328 but 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).
+
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.
  
== Configuration ==
+
== Driver installation ==
 
+
DS1374 is by default included in standard Armadeus Linux kernel.
 
+
To check if your board (Linux) has correctly detected the RTC:
First be sure to use an armadeus 2.0 or higher.
+
<pre class="apf">
The RTC/DS1374 support is already configured in U-BOOT and linux kernel 2.6.18.1 and higher.
+
# dmesg | grep ds1374
Therefore you have nothing to configure to use the RTC.
+
ds1374-legacy 0-0068: chip found, driver version 1.0
Nevertheless these are the parameters to check to have the RTC supported:
+
ds1374-legacy 0-0068: rtc core: registered ds1374-legacy as rtc0
$ make linux26-menuconfig
+
ds1374-legacy 0-0068: setting system clock to 1970-01-01 00:00:07 UTC (7)
* check the i2c module drivers  "I2C support", "I2C DEVICE", "I2C HARDWARE/bus on imx" 
+
</pre>
* check the RTC module driver "RTC class", "set time from RTC" "RTC interface dev"  
+
* if you integrates these module statically in the kernel then the system date will be set at power-up.
+
 
+
$ make
+
and reload your kernel and/or rootfs
+
 
+
== Installation ==
+
 
+
*Installation is automatic with the default configuration but if you choose to compile rtc and i2c drivers as module then you have to load them:
+
$ modprobe i2c-imx
+
$ modprobe rtc-ds1374
+
$ modprobe rtc-dev
+
 
+
*you will get something like this :
+
 
+
$ dmesg | grep rtc
+
<6>ds1374 0-0068: rtc intf: sysfs
+
<6>ds1374 0-0068: rtc intf: proc
+
<6>ds1374 0-0068: rtc intf: dev (254:0)
+
<6>ds1374 0-0068: rtc core: registered ds1374 as rtc0
+
  
 
== Usage ==
 
== Usage ==
  
 
* 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.
  BIOS> '''help date'''         for more information
+
<pre class="apf">
  BIOS> '''date reset'''         to be done after battery exchange to remove message '''### Warning: RTC oscillator has stopped'''
+
  BIOS> help date          for more information
  BIOS> '''date 013122302007''' to set the date January 31th 2007 22h30.
+
  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 commande '''hwclock''' to read, write, synchronize the RTC:
+
</pre>
  # '''hwclock --help'''
+
* From Linux use the command '''hwclock''' to read, write, synchronize the RTC:
  # '''hwclock -r'''     to read hardware clock and print result
+
<pre class="apf">
  # '''hwclock -s'''     to set the system time from the hardware RTC clock
+
  # hwclock --help
  # '''hwclock -w'''     to set the hardware RTC clock to the current system time
+
  # hwclock -r      to read hardware clock and print result
 +
  # hwclock -s      to set the system time from the hardware RTC clock
 +
  # hwclock -w      to set the hardware RTC clock to the current system time
 +
</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:
  # '''date --help'''       for more information
+
<pre class="apf">
  # '''date -R'''           to read hardware clock and print result
+
  # date --help        for more information
  # '''date 013122302007''' to sets the system date january 31th 2007 22h30.
+
  # date -R            to read hardware clock and print result
 
+
  # date 013122302007  to sets the system date january 31th 2007 22h30.
 +
</pre>
 
* Then, when booting you will see something like this:
 
* Then, when booting you will see something like this:
 +
<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>
  
 
== Links ==
 
== Links ==
* maxim-ic ds1374 datasheet http://datasheets.maxim-ic.com/en/ds/DS1374-DS1374U.pdf
+
* [http://datasheets.maxim-ic.com/en/ds/DS1374-DS1374U.pdf Maxim's DS1374 datasheet]

Revision as of 11:45, 26 February 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

  • 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:
 # hwclock --help
 # hwclock -r      to read hardware clock and print result
 # hwclock -s      to set the system time from the hardware RTC clock
 # hwclock -w      to set the hardware RTC clock to the current system time
  • 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 january 31th 2007 22h30.
  • Then, when booting you will see something like this:
 ds1374 0-0068: setting the system clock to 2007-09-09 17:35:51 (1189359351)

Links