* System Clock runaway on Xilinx platform
@ 2008-02-06 19:41 khollan
2008-02-06 20:29 ` Grant Likely
2008-02-07 0:10 ` Stephen Neuendorffer
0 siblings, 2 replies; 6+ messages in thread
From: khollan @ 2008-02-06 19:41 UTC (permalink / raw)
To: linuxppc-embedded
Hi all,
Thanks for the help so far!
I'm now running linux 2.6.21 on my custom virtex 4 board modeled after the
ml410. The cpu clock is 300MHz and the PLB bus is 175MHz.
My question is which clock is the linux system clock that keeps track of the
date derived from? I set my date with rdate -s time.mit.edu at boot and
then compare with the date command and rdate -p time.mit.edu and they are
off by 20 or so seconds even just after a few minutes, this trend continues
and it will be off by a day after a few hours. I think I just don't have
something defined correctly but I can't figure out which.
Thanks
Kevin
--
View this message in context: http://www.nabble.com/System-Clock-runaway-on-Xilinx-platform-tp15312437p15312437.html
Sent from the linuxppc-embedded mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: System Clock runaway on Xilinx platform
2008-02-06 19:41 System Clock runaway on Xilinx platform khollan
@ 2008-02-06 20:29 ` Grant Likely
2008-02-06 22:39 ` Kevin Holland
2008-02-07 0:10 ` Stephen Neuendorffer
1 sibling, 1 reply; 6+ messages in thread
From: Grant Likely @ 2008-02-06 20:29 UTC (permalink / raw)
To: khollan; +Cc: linuxppc-embedded
On 2/6/08, khollan <khollan@daktronics.com> wrote:
>
> Hi all,
>
> Thanks for the help so far!
> I'm now running linux 2.6.21 on my custom virtex 4 board modeled after the
> ml410. The cpu clock is 300MHz and the PLB bus is 175MHz.
>
> My question is which clock is the linux system clock that keeps track of the
> date derived from? I set my date with rdate -s time.mit.edu at boot and
> then compare with the date command and rdate -p time.mit.edu and they are
> off by 20 or so seconds even just after a few minutes, this trend continues
> and it will be off by a day after a few hours. I think I just don't have
> something defined correctly but I can't figure out which.
The clock is maintained off of the PowerPC time base register (TBL,
TBU). On Virtex ppc platforms, the time base frequency is supposed to
be the same as the CPU clock. Can you figure out *exactly* how
quickly the clock is drifting?
How are you booting your Virtex platform? u-boot or a zImage.elf? If
it's a zImage, the CPU clock frequency is set in
arch/ppc/boot/simple/embed_config.c (search for CONFIG_XILINX and look
for the line that sets bd->bi_intfreq). Make XPAR_CORE_CLOCK_FREQ_HZ
in xparameters matches you CPU clock speed.
Side note: you may notice that bd->bi_tbfreq is also used but not set;
that's because bd->bi_intfreq and bd->tbfreq point to the same memory
location. (It's kind of messed up that way, don't worry too much
about it)
If you're using u-boot, then u-boot will set the cpu frequency in the
board info structure.
Cheers,
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: System Clock runaway on Xilinx platform
2008-02-06 20:29 ` Grant Likely
@ 2008-02-06 22:39 ` Kevin Holland
2008-02-06 22:52 ` Grant Likely
0 siblings, 1 reply; 6+ messages in thread
From: Kevin Holland @ 2008-02-06 22:39 UTC (permalink / raw)
To: Grant Likely; +Cc: linuxppc-embedded
I load with the zImage.elf, so my xparameters are set like this:
#define XPAR_CPU_PPC405_CORE_CLOCK_FREQ_HZ 300000000
#define XPAR_CORE_CLOCK_FREQ_HZ XPAR_CPU_PPC405_CORE_CLOCK_FREQ_HZ
I took readings every 5 min over a 15 min period and it seems to be
increasing by approximately 50 sec every 5 mins.
Thanks
Kevin
On Wed, 2008-02-06 at 13:29 -0700, Grant Likely wrote:
> On 2/6/08, khollan <khollan@daktronics.com> wrote:
> >
> > Hi all,
> >
> > Thanks for the help so far!
> > I'm now running linux 2.6.21 on my custom virtex 4 board modeled after the
> > ml410. The cpu clock is 300MHz and the PLB bus is 175MHz.
> >
> > My question is which clock is the linux system clock that keeps track of the
> > date derived from? I set my date with rdate -s time.mit.edu at boot and
> > then compare with the date command and rdate -p time.mit.edu and they are
> > off by 20 or so seconds even just after a few minutes, this trend continues
> > and it will be off by a day after a few hours. I think I just don't have
> > something defined correctly but I can't figure out which.
>
> The clock is maintained off of the PowerPC time base register (TBL,
> TBU). On Virtex ppc platforms, the time base frequency is supposed to
> be the same as the CPU clock. Can you figure out *exactly* how
> quickly the clock is drifting?
>
> How are you booting your Virtex platform? u-boot or a zImage.elf? If
> it's a zImage, the CPU clock frequency is set in
> arch/ppc/boot/simple/embed_config.c (search for CONFIG_XILINX and look
> for the line that sets bd->bi_intfreq). Make XPAR_CORE_CLOCK_FREQ_HZ
> in xparameters matches you CPU clock speed.
>
> Side note: you may notice that bd->bi_tbfreq is also used but not set;
> that's because bd->bi_intfreq and bd->tbfreq point to the same memory
> location. (It's kind of messed up that way, don't worry too much
> about it)
>
> If you're using u-boot, then u-boot will set the cpu frequency in the
> board info structure.
>
> Cheers,
> g.
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: System Clock runaway on Xilinx platform
2008-02-06 22:39 ` Kevin Holland
@ 2008-02-06 22:52 ` Grant Likely
2008-02-07 16:07 ` khollan
0 siblings, 1 reply; 6+ messages in thread
From: Grant Likely @ 2008-02-06 22:52 UTC (permalink / raw)
To: Kevin Holland; +Cc: linuxppc-embedded
On 2/6/08, Kevin Holland <khollan@daktronics.com> wrote:
> I load with the zImage.elf, so my xparameters are set like this:
>
> #define XPAR_CPU_PPC405_CORE_CLOCK_FREQ_HZ 300000000
> #define XPAR_CORE_CLOCK_FREQ_HZ XPAR_CPU_PPC405_CORE_CLOCK_FREQ_HZ
>
> I took readings every 5 min over a 15 min period and it seems to be
> increasing by approximately 50 sec every 5 mins.
Hmm; 5 min == 300 seconds
300 - 50 == 250 seconds
300/250 = 1.2
So, timebase_period_ns is set 1.2 times faster than the actual period.
Can you confirm that the EDK frequency is actually correct? Are you
*sure* that the CPU is running at 300MHz.
Cheers,
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: System Clock runaway on Xilinx platform
2008-02-06 22:52 ` Grant Likely
@ 2008-02-07 16:07 ` khollan
0 siblings, 0 replies; 6+ messages in thread
From: khollan @ 2008-02-07 16:07 UTC (permalink / raw)
To: linuxppc-embedded
jozsef imrek wrote:
>
>
> kevin, how do you get that 175 MHz PLB?
>
> it should not matter, since the wall clock is derived from the
> cpu clock, but i suspect that your cpu clock is just twice the
> PLB clock, thus it is not 300 MHz, but 350 MHz. this would explain
> the time drift, as
>
> 300 s * (350 MHz / 300 MHz) = 350 s (obviously :)
>
> so here is the extra 50 secs in every 5 minutes.
>
>
>
> --
> mazsi
>
>
Thanks to an email by jozef imrek I realized that I'm an idiot. To get the
CPU clock I multiply the PLB X 2 which is 175MHz X 2 = 350 MHz not 300MHz, I
guess I had a brain fart in calculation. I changed the xparameters to 350
and it seems to be keeping time, I haven't tested it for very long but it's
doing a lot better than before. Thanks to him I didn't have to wait 45 min
to rebuild the bit stream and probe the clocks.
Thanks Kevin
--
View this message in context: http://www.nabble.com/System-Clock-runaway-on-Xilinx-platform-tp15312437p15337076.html
Sent from the linuxppc-embedded mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: System Clock runaway on Xilinx platform
2008-02-06 19:41 System Clock runaway on Xilinx platform khollan
2008-02-06 20:29 ` Grant Likely
@ 2008-02-07 0:10 ` Stephen Neuendorffer
1 sibling, 0 replies; 6+ messages in thread
From: Stephen Neuendorffer @ 2008-02-07 0:10 UTC (permalink / raw)
To: khollan, linuxppc-embedded
The processor is an integer factor faster than the bus, unless you're
doing something really unusual. Are you sure that's not 300 and 150?
175/150 =3D 1.16, which might be the difference you're seeing?
Steve
> -----Original Message-----
> From: linuxppc-embedded-bounces+stephen=3Dneuendorffer.name@ozlabs.org
[mailto:linuxppc-embedded-
> bounces+stephen=3Dneuendorffer.name@ozlabs.org] On Behalf Of khollan
> Sent: Wednesday, February 06, 2008 11:42 AM
> To: linuxppc-embedded@ozlabs.org
> Subject: System Clock runaway on Xilinx platform
>=20
>=20
> Hi all,
>=20
> Thanks for the help so far!
> I'm now running linux 2.6.21 on my custom virtex 4 board modeled after
the
> ml410. The cpu clock is 300MHz and the PLB bus is 175MHz.
>=20
> My question is which clock is the linux system clock that keeps track
of the
> date derived from? I set my date with rdate -s time.mit.edu at boot
and
> then compare with the date command and rdate -p time.mit.edu and they
are
> off by 20 or so seconds even just after a few minutes, this trend
continues
> and it will be off by a day after a few hours. I think I just don't
have
> something defined correctly but I can't figure out which.
>=20
> Thanks
>=20
> Kevin
> --
> View this message in context:
http://www.nabble.com/System-Clock-runaway-on-Xilinx-platform-
> tp15312437p15312437.html
> Sent from the linuxppc-embedded mailing list archive at Nabble.com.
>=20
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-02-07 16:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-06 19:41 System Clock runaway on Xilinx platform khollan
2008-02-06 20:29 ` Grant Likely
2008-02-06 22:39 ` Kevin Holland
2008-02-06 22:52 ` Grant Likely
2008-02-07 16:07 ` khollan
2008-02-07 0:10 ` Stephen Neuendorffer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).