• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: Clock working?  (Read 5854 times)
jlpoole
Principal Software Engineer
Global Moderator
Jr. Member
*****

Karma: 2
Posts: 87

Principal Software Engineer -- Oracle Corporation


View Profile
« on: April 15, 2009, 10:09:18 PM »

Is there a hardware clock on the SheevaPlug?   Using Gentoo 2.6.30_rc1:

plug1 ~ # hwclock --show
Timed out waiting for time change.
plug1 ~ #

The SheevaPlug Development Kit Reference Design Rev 1.0 (I know this is superceded) references on page 10 a RTC battery, I'm guessing this means "Real Time Clock".

I'm looking at  time programs such as   htpdate (See http://en.gentoo-wiki.com/wiki/Time_synchronisation ).
Logged

The statements and opinions expressed here are my own and do not necessarily represent those of Oracle Corporation.

tmk
Newbie
*

Karma: 1
Posts: 40


View Profile
« Reply #1 on: April 15, 2009, 10:11:49 PM »

works for me, using stock filesystem/distribution:

Code:
root@charger:~# hwclock --show
Wed Apr 15 22:11:00 2009  -0.679639 seconds

-tmk
Logged

elBradford
Newbie
*

Karma: 0
Posts: 44


View Profile
« Reply #2 on: April 19, 2009, 02:34:13 AM »

My hardware (and software) clock are resetting seemingly on every boot. I guess there's no battery to keep time when there's a loss of power? Anyway, I use webmin and it makes it really easy to set up time synchronization. It really messes with my blog posts though, since it puts them back in January 2009 :S
Logged

KaiBo
Newbie
*

Karma: 0
Posts: 35



View Profile
« Reply #3 on: April 26, 2009, 07:32:51 AM »

Anyone figured out yet what to compile to make the hardware-clock work using a custom-kernel?

Without paying any further attention to my kernel-options I am stuck with this:
Code:
abeir:~# hwclock --show
The Hardware Clock registers contain values that are either invalid (e.g. 50th day of month) or beyond the range we can handle (e.g. Year 2095).
abeir:~# date
Sun Apr 26 14:31:09 UTC 2009

Oh... Marvell SoC RTC (CONFIG_RTC_DRV_MV) is compiled into the kernel.
« Last Edit: April 26, 2009, 07:39:00 AM by KaiBo » Logged

kilowatt
Global Moderator
Full Member
*****

Karma: 3
Posts: 106


View Profile
« Reply #4 on: April 26, 2009, 02:07:57 PM »

I just did hwclock -w to get the correct time written to the hardware clock.

The try hwclock -r to read it back.

Seems to work fine once you set it.

Mark
Logged

KaiBo
Newbie
*

Karma: 0
Posts: 35



View Profile
« Reply #5 on: April 30, 2009, 10:34:14 AM »

My clock seems to work ever since. However, during boot-time I still get an error:
Code:
Setting the system clock.
Cannot access the Hardware Clock via any known method.
Use the --debug option to see the details of our search for an access method.
Unable to set System Clock to: Thu Apr 30 17:30:52 UTC 2009 (warning).

Thanks nevertheless!
Logged

jlpoole
Principal Software Engineer
Global Moderator
Jr. Member
*****

Karma: 2
Posts: 87

Principal Software Engineer -- Oracle Corporation


View Profile
« Reply #6 on: April 30, 2009, 12:42:13 PM »

I just did hwclock -w to get the correct time written to the hardware clock.

The try hwclock -r to read it back.

Seems to work fine once you set it.

Mark

Thanks, Mark.  Some contextual clarifications:

hwclock is for the Linux console.  ("man hwclock" is your friend.)

I set my date in Linux and then used the "systohc" [system to hardware clock?] parameter:  hwclock  --systohc

Note, you can set the hardware clock for the Sheeva in the pre-boot console:
date    - get/set/reset date & time


Somehow, setting the hardware clock (as opposed to the Linux system time) either eluded me, or I bungled it at first.  Everything seems okay now.
Logged

The statements and opinions expressed here are my own and do not necessarily represent those of Oracle Corporation.

jlpoole
Principal Software Engineer
Global Moderator
Jr. Member
*****

Karma: 2
Posts: 87

Principal Software Engineer -- Oracle Corporation


View Profile
« Reply #7 on: May 05, 2009, 06:34:55 PM »

I'm still having problems with the date being stored in the SheevaPlug after a power cycle (unplugging, waiting 10 seconds, and re-plugging it).

The Marvell U-Boot help provides:

Code:
Marvell>> ? date
date [MMDDhhmm[[CC]YY][.ss]]
date reset
  - without arguments: print date & time
  - with numeric argument: set the system date & time
  - with 'reset' argument: reset the RTC

So, today, I did the following:

Code:
CPU : Marvell Feroceon (Rev 1)

Streaming disabled
Write allocate disabled


USB 0: host mode
PEX 0: interface detected no Link.
Net:   egiga0 [PRIME], egiga1
Hit any key to stop autoboot:  0
Marvell>> date
Date: 2085-01-11 (Thursday)    Time: 13:33:12
Marvell>> date
Date: 2085-01-11 (Thursday)    Time: 13:34:07
Marvell>> echo This date is clearly wrong: 2095??!!
This date is clearly wrong: 2095??!!
Marvell>> ? date
date [MMDDhhmm[[CC]YY][.ss]]
date reset
  - without arguments: print date & time
  - with numeric argument: set the system date & time
  - with 'reset' argument: reset the RTC

Marvell>> date 050518242009.00
Date: 2009-05-05 (Tuesday)    Time: 18:24:00
Marvell>> date
Date: 2009-05-05 (Tuesday)    Time: 18:24:05
Marvell>> date reset
Reset RTC...
Date: 2009-05-05 (Tuesday)    Time: 18:24:33
Marvell>> date
Date: 2009-05-05 (Tuesday)    Time: 18:24:38
Marvell>> echo let's test what happenes on a soft "reset"
lets test what happenes on a soft "reset"
Marvell>> reset

         __  __                      _ _
        |  \/  | __ _ _ ____   _____| | |
        | |\/| |/ _` | '__\ \ / / _ \ | |
        | |  | | (_| | |   \ V /  __/ | |
        |_|  |_|\__,_|_|    \_/ \___|_|_|
 _   _     ____              _
| | | |   | __ )  ___   ___ | |_
| | | |___|  _ \ / _ \ / _ \| __|
| |_| |___| |_) | (_) | (_) | |_
 \___/    |____/ \___/ \___/ \__|
 ** MARVELL BOARD: SHEEVA PLUG LE

U-Boot 1.1.4 (Mar 16 2009 - 18:03:32) Marvell version: 3.4.16

U-Boot code: 00600000 -> 0067FFF0  BSS: -> 006CEE80

Soc: 88F6281 A0 (DDR2)
CPU running @ 1200Mhz L2 running @ 400Mhz
SysClock = 400Mhz , TClock = 200Mhz

DRAM CAS Latency = 5 tRP = 5 tRAS = 18 tRCD=6
DRAM CS[0] base 0x00000000   size 256MB
DRAM CS[1] base 0x10000000   size 256MB
DRAM Total size 512MB  16bit width
Flash:  0 kB
Addresses 8M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (8M - 7M): Done
NAND:512 MB

CPU : Marvell Feroceon (Rev 1)

Streaming disabled
Write allocate disabled


USB 0: host mode
PEX 0: interface detected no Link.
Net:   egiga0 [PRIME], egiga1
Hit any key to stop autoboot:  0
Marvell>> date
Date: 2009-05-05 (Tuesday)    Time: 18:25:17
Marvell>> echo This is fine... looks like the RTC has a good date...
This is fine... looks like the RTC has a good date...
Marvell>> echo But wait, there's more... I'm going to unplug the electricity!
But wait, theres more... Im going to unplug the electricity!
Marvell>>

I don't trust "resets" on electrical equipment, and therefore I unplugged the plug, waited 10 seconds, unplugged the network cable and the USB serial cable to my laptop and waited 30 seconds and then plugged the cables back in and then plugged the power cord back in and reconnected via PuTTY in the serial port.

Code:
512 MB

CPU : Marvell Feroceon (Rev 1)

Streaming disabled
Write allocate disabled


USB 0: host mode
PEX 0: interface detected no Link.
Net:   egiga0 [PRIME], egiga1
Hit any key to stop autoboot:  0
Marvell>> date
Date: 2085-01-11 (Thursday)    Time: 13:33:04
Marvell>> echo Darn! the SheevaPlug's RTC is off
Darn! the SheevaPlugs RTC is off
Marvell>>


What gives??  I believe I'm using the correct data structure in the "date" command as evidenced by the display of the date values thereafter.  It is the power down cycle that causes the values to go awry.

Logged

The statements and opinions expressed here are my own and do not necessarily represent those of Oracle Corporation.

jlpoole
Principal Software Engineer
Global Moderator
Jr. Member
*****

Karma: 2
Posts: 87

Principal Software Engineer -- Oracle Corporation


View Profile
« Reply #8 on: May 05, 2009, 06:47:02 PM »

Just in case someone says I should try the abbreviated format, or that I should not have used the "date reset" command, I have the following sessions:

Code:
512 MB

CPU : Marvell Feroceon (Rev 1)

Streaming disabled
Write allocate disabled


USB 0: host mode
PEX 0: interface detected no Link.
Net:   egiga0 [PRIME], egiga1
Hit any key to stop autoboot:  0
Marvell>> date
Date: 2000-01-01 (Saturday)    Time:  0:00:00
Marvell>> date 0505184009
Date: 2009-05-05 (Tuesday)    Time: 18:40:00
Marvell>> reset

         __  __                      _ _
        |  \/  | __ _ _ ____   _____| | |
        | |\/| |/ _` | '__\ \ / / _ \ | |
        | |  | | (_| | |   \ V /  __/ | |
        |_|  |_|\__,_|_|    \_/ \___|_|_|
 _   _     ____              _
| | | |   | __ )  ___   ___ | |_
| | | |___|  _ \ / _ \ / _ \| __|
| |_| |___| |_) | (_) | (_) | |_
 \___/    |____/ \___/ \___/ \__|
 ** MARVELL BOARD: SHEEVA PLUG LE

U-Boot 1.1.4 (Mar 16 2009 - 18:03:32) Marvell version: 3.4.16

U-Boot code: 00600000 -> 0067FFF0  BSS: -> 006CEE80

Soc: 88F6281 A0 (DDR2)
CPU running @ 1200Mhz L2 running @ 400Mhz
SysClock = 400Mhz , TClock = 200Mhz

DRAM CAS Latency = 5 tRP = 5 tRAS = 18 tRCD=6
DRAM CS[0] base 0x00000000   size 256MB
DRAM CS[1] base 0x10000000   size 256MB
DRAM Total size 512MB  16bit width
Flash:  0 kB
Addresses 8M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (8M - 7M): Done
NAND:512 MB

CPU : Marvell Feroceon (Rev 1)

Streaming disabled
Write allocate disabled


USB 0: host mode
PEX 0: interface detected no Link.
Net:   egiga0 [PRIME], egiga1
Hit any key to stop autoboot:  0
Marvell>> date
Date: 2009-05-05 (Tuesday)    Time: 18:40:24
Marvell>> date
Date: 2009-05-05 (Tuesday)    Time: 18:40:41
Marvell>>

POWER DOWN

Code:
512 MB

CPU : Marvell Feroceon (Rev 1)

Streaming disabled
Write allocate disabled


USB 0: host mode
PEX 0: interface detected no Link.
Net:   egiga0 [PRIME], egiga1
Hit any key to stop autoboot:  0
Marvell>> date
Date: 2085-01-11 (Thursday)    Time: 13:33:13
Marvell>>


Power down still results in a mangled date.
Logged

The statements and opinions expressed here are my own and do not necessarily represent those of Oracle Corporation.

jlpoole
Principal Software Engineer
Global Moderator
Jr. Member
*****

Karma: 2
Posts: 87

Principal Software Engineer -- Oracle Corporation


View Profile
« Reply #9 on: May 06, 2009, 08:26:52 PM »

So, I'm learning that the real time clock for the SheevaPlug is not something to bank on for persistence.

The DENX U-Boot and Linux Guide (DULG), section 14.3.24. Use NTP to synchronize system time against RTC provides in part:

Quote
If a system has a real-time clock (RTC) this is often used only to initialize the system time when the system boots. From then, the system time is running independently. The RTC will probably only be used again at shutdown to save the current system time. Such a configuration is used in many workstation configurations. It is useful if time is not really critical, or if the system time is synchronized against some external reference clock like when using the Network Time Protocol (NTP) to access time servers on the network.

So I guess I shouldn't be concerned with getting current time values from the Real Time Clock on the SheevaPlug, but once starting Linux, use Network Time Protocol ("NTP") to establish the correct time.  I guess this is something most people in this area take for granted... there's a lot to learn here.

There's also a dated (2004) presentation about The Universal Boot Loader ("Das U−Boot")
Logged

The statements and opinions expressed here are my own and do not necessarily represent those of Oracle Corporation.

plugit
Global Moderator
Full Member
*****

Karma: 0
Posts: 139



View Profile
« Reply #10 on: May 06, 2009, 09:08:15 PM »

I'd agree with that. I've never really cared about hardware clocks; one of the first thing I do when setting up a UNIX system is get time synchronization going.

Fortunately ntpd works perfectly on the plug!
Logged

dieterk
Newbie
*

Karma: 0
Posts: 21


View Profile
« Reply #11 on: June 18, 2009, 12:38:32 PM »

Hi everybody,

I don't know what u-boot version is running on the sheeva. But lasted marvell git seems to lack some rtc driver for sheeva. So maybe this is the root cause of your problems?
You can try to boot linux and set the clock using date. Afterwards AFAIK you have to use hwclock to write the settings to the hardware RTC.
Maybe this will help?

Dieter

I'd agree with that. I've never really cared about hardware clocks; one of the first thing I do when setting up a UNIX system is get time synchronization going.

Fortunately ntpd works perfectly on the plug!
Logged

bobnielsen
Newbie
*

Karma: 0
Posts: 9


View Profile
« Reply #12 on: June 19, 2009, 12:55:08 PM »

One of the suggestions I saw was to have /etc/rc.local run ntpdate to update the system clock at bootup.  If you run 'hwclock --systohc' after that, the hardware clock should also be updated.
Logged

Pages: [1]
Print
Jump to: