This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Over-riding Real Time Clock


Note: sending the same message 4 times in the span of 30 minutes
*DOES NOT* improve your chances of a reply (far from it!)

On Thu, 2005-12-08 at 23:33 -0800, AbdullahKhateeb Khan wrote:
> --
> 
> MY target system is an Intel Pentium-4 processor with
> a 2.4 GHz clock.
> My Host platform is an i386 based system. The default
> settings of RTC clock constants for
> i386 based system are 
> Real-time clock numerator = 1000000000
> Real-time clock denominator = 100
> Real-time clock Period = 11932
> 
> In other words the clock frequency equals to 100Hz.
> This settng gives me a clock output such that the
> clocks drifts 20msec after 200sec. I have few
> questions regarding this
> 
>  
> 
> - How can we minimize the RTC clock drift?
> - What will be the values of 
>  "Clock Hardware Initialization Value",
>  "Clock Resolution numerator",
>  "Clock Resolution Denominator"
> 
>  to configure the above mentioned Intel Pentium-4
> processor for 2.4GHz clock
>  
>  I have used Over ride default clock setting option
> available in eCos Configuration tool
>  to change the clock frequency.
>  I got the following results for different Clock
> Hardware Initialization Value.
>  
>  Experiment #1:
>  Clock Hardware Initialization Value=5966
>  Denominator = 1000,000,000
>  Numerator = 100
>  Resultant Clock frequency = 200Hz  
> 
>  Experiment #2:
>  Clock Hardware Initialization Value=11932
>  Denominator = 1000,000,000
>  Numerator = 100
>  Resultant Clock frequency = 100Hz  
> 
>  Experiment #3:
>  Clock Hardware Initialization Value=11932
>  Denominator = 1000,000,000
>  Numerator = 60
>  Resultant Clock frequency = 100Hz  
> 
>  Experiment #4:
>  Clock Hardware Initialization Value=23864
>  Denominator = 1000,000,000
>  Numerator = 100
>  Resultant Clock frequency = 50Hz  
> 
> 
> I didnot observe any noticeable effect of Numerator
> and Denominator setting in changing the
> clock frequency. Why is it so? Only one parameter
> ("Clock Hardware Initialization Value")
> changes the clock frequency.
> If u see the above mentioned results then its clear
> that the Numerator value (100 or 60) 
> does not change the resultant clock frequency i.e
> 100Hz. I have experienced the same
> problem while generating the 50Hz or 200Hz clock
> frequency i.e 'The value of Numerator and Denominator
> does not help in changing the clock frequency'. 

That's because the only thing that affects the actual clock
frequency is the "Clock Hardware Initialization Value".  The
other two are used by eCos to understand how fast the clock
is running (and hence should be tuned to match).

On some targets (obviously not the PC), the initialization
value is computed based on the known system clock rate and
the desired numerator/denominator ratio.

See if you can work out where the initialization value came
from for the PC (or at least how it _should_ be derived) and
change the CDL to compute this value based on the desired
numerator and denominator values.  A little experimentation
and you should be able to both adjust the actual system "clock"
(RTC) rate and any errors that are currently present.

There might be other reasons for drift; e.g. if you have a 
heavily loaded system and it misses clock interrupts, how are
these handled, etc.

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]