Clock problem using newer 80Mhz uC8252 card

Phillip Sorensen pas37 at
Thu Oct 22 19:17:19 UTC 2009

Hello all,

We have purchased the newer 80Mhz Arcturus Networks uCdimm 5282 (bsp 
uC5282).  I have added "--defsym _CPUClockSpeed=80000000"
to linker command line to change the value returned by the 
bsp_get_CPU_clock_speed() function.  This successfully  changes the 
settings for the
serial ports so the console baud rate is correct.  However I discovered 
that the clock was running fast (about 15 seconds per minute).  Looking at
the code in the clock/clock.c file in the uC5282 BSP, I discovered that 
the code assumed that the clock rate was a power of 2, and was using
the PIT prescaler to count in microseconds.  Since 80 is not a power of 
two, the calculation was wrong.

I have attached the patch I came up with to solve this problem.  It 
tries to keep the counts per microsecond as close to 1 as possible.  I 
have tested
that things work with my application on both the 64MHz and 80Mhz chips. 

Let me know if there are any questions, or if I should open a bug report.

Phil Sorensen
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: uC5282-clock.patch
URL: <>

More information about the users mailing list