[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [microblaze-uclinux] 10 msec number of ticks bug..
John,
I rechecked the microblaze timer document, it does say it correctly
(matches whatever i calculated). So the code should have been
count = ((unsigned)-1) - CONFIG_XILINX_CPU_CLOCK_FREQ / rate + 2;
instead of "count = ((unsigned)-1) - CONFIG_XILINX_CPU_CLOCK_FREQ / rate - 2;"
I also retested in our board with a free running clock. So please
apply the change.
Also, please correct the following in the do_settimeofday() in the
time.c. The "#if 0" should be removed. Otherwise, it wouldn't count
the elapsed ticks whenever settimeofday() called potentially leading
to the fixed offset.
#if 0
tv->tv_usec -= mach_gettimeoffset ();
#endif
Thanx
- Prasad
On 6/4/06, John Williams <jwilliams@xxxxxxxxxxxxxx> wrote:
Hi Prasad,
DeviPrasad Natesan wrote:
> I had 10msec accuracy problem in my system (ntpd had many drift). Then
> i could figure out 300 ticks drift happening every second becos of the
> wrong initial value in the timer register i belive. We verified my
> change with the free running counter implemented in the fpga and
> comparing the value every one second and we could see a drift of
> around 6 ucsec.
>
> The change is in the microblaze_timer.c
>
> From
> count = ((unsigned)-1) - CONFIG_XILINX_CPU_CLOCK_FREQ / rate - 2;
>
> to
> count = -(CONFIG_XILINX_CPU_CLOCK_FREQ / rate) + 1;
>
> One extra tick is required (might be bcos of an extra tick happening
> while loading the value back to the comparator register.
Interesting - it's a long time since I looked at that code, but from memory I
did the timer counter load value based on the formula in the opb_timer
datasheet. As you say, perhaps it's necessary to compensate for the time it
takes to actually reset the counter?
> Please confirm this and if it is right apply the change.
You say you tested with with ntpd / ntpclient? Can you please post a few
details about your test, and I'll try to replicate it here.
Thanks for your efforts,
John
___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/
___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/