System Clock runaway on Xilinx platform
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
Signature · 2 lines
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.
Quoted 7 lines · khollan
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.
Quoted 6 lines
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.
Signature · 2 lines
Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd.
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
Quoted 37 lines · Grant Likely
Quoted 7 lines · khollan
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.Quoted 6 lines
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 forCONFIG_XILINXand look for the line that setsbd->bi_intfreq). MakeXPAR_CORE_CLOCK_FREQ_HZin xparameters matches you CPU clock speed.Side note: you may notice that
bd->bi_tbfreqis also used but not set; that's becausebd->bi_intfreqandbd->tbfreqpoint 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.
Quoted 7 lines · Kevin Holland
I load with the zImage.elf, so my xparameters are set like this:
#define
XPAR_CPU_PPC405_CORE_CLOCK_FREQ_HZ300000000 #defineXPAR_CORE_CLOCK_FREQ_HZXPAR_CPU_PPC405_CORE_CLOCK_FREQ_HZI 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.
Signature · 2 lines
Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd.
Quoted 4 lines · jozsef imrek
kevin, how do you get that 175 MHz PLB?
Quoted 15 lines
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.
Signature · 1 line
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
Signature · 2 lines
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.
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
Quoted 2 lines
-----Original Message-----
From: [email protected]
[mailto:linuxppc-embedded-
Quoted 10 lines
[email protected]] On Behalf Of khollan
Sent: Wednesday, February 06, 2008 11:42 AM
To: [email protected]
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
Quoted 3 lines
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
Quoted 1 line
date derived from? I set my date with rdate -s time.mit.edu at boot
and
Quoted 1 line
then compare with the date command and rdate -p time.mit.edu and they
are
Quoted 1 line
off by 20 or so seconds even just after a few minutes, this trend
continues
Quoted 1 line
and it will be off by a day after a few hours. I think I just don't
have
Quoted 7 lines
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-
Quoted 7 lines
tp15312437p15312437.html
Sent from the linuxppc-embedded mailing list archive at Nabble.com. =20
_______________________________________________
Linuxppc-embedded mailing list [email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-embedded