Jump to content

a385: sysclock timedrifting compared to hwclock

Hardik Gohil

Recommended Posts

Hello All,


root:# hwclock --systohc
root:# while true; do date; hwclock -r; sleep 60; done


observing drift of 1 sec.


even tried this https://github.com/armbian/build/pull/2352/commits/59cdf431ef691d67d649adbfaf973f9d451823bc#diff-dc13c5522aed383d1b20662d765c5be9f2635553256069dce64f29be94f89b69




Armada 38x RTC driver 


Board Marvell Armada A385 DB AP  Kernel : 4.14 


community help will be grateful





Link to comment
Share on other sites

1 sec every 60 sec? that's a pretty big drift.

oh and btw hwclock seemed to have some ways to adjust for drift, but that'd probably means you need to sync your time to NTP



hwclock [function] [option...]

Time clocks utility.

-r, --show                      display the RTC time
    --get                       display drift corrected RTC time
    --set                       set the RTC according to --date
-s, --hctosys                   set the system time from the RTC
-w, --systohc                   set the RTC from the system time
    --systz                     send timescale configurations to the kernel
-a, --adjust                    adjust the RTC to account for systematic drift
    --param-get <param>         display the RTC parameter
    --param-set <param>=<value> set the RTC parameter
    --predict                   predict the drifted RTC time according to --date

-u, --utc                       the RTC timescale is UTC
-l, --localtime                 the RTC timescale is Local
-f, --rtc <file>                use an alternate file to /dev/rtc0
    --directisa                 use the ISA bus instead of /dev/rtc0 access
    --date <time>               date/time input for --set and --predict
    --delay <sec>               delay used when set new RTC time
    --update-drift              update the RTC drift factor
    --noadjfile                 do not use /etc/adjtime
    --adjfile <file>            use an alternate file to /etc/adjtime
    --test                      dry run; implies --verbose
-v, --verbose                   display more details

-h, --help                      display this help
-V, --version                   display version

<param> is either a numeric RTC parameter value or one of these aliases:
  - features: supported features (0x0)
  - correction: time correction (0x1)
  - bsm: backup switch mode (0x2)
  See Kernel's include/uapi/linux/rtc.h for parameters and values.

<param> and <value> accept hexadecimal values if prefixed with 0x, otherwise decimal.

For more details see hwclock(8).



Link to comment
Share on other sites

for some reasons I didn't find related docs in the company's web site


those docs links are apparently not accessible


but instead stumbled into a copy elsewhere in a web search


the interesting section is chapter 26 Real time clock pages 303


accordingly, the real time clock runs on a 32khz crystal, so check your board to see if it is there.

if it isn't there, maybe it isn't using the real time clock after all. And that if it is there, find in the source codes for the real time clock implementation, apparently some details about the RTC registers are documented, so those should after all match the func spec. And perhaps you may find your way around the code to 'tweak' the register settings etc.

if it is a 'pseudo RTC' i.e. didn't exist, then it is probably a 'simulated' h/w clock which may be written in s/w, it'd take reading the codes to find out that curious facts :)


hope that helps



Edited by ag123
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines