PIT initializing in MPC860
Joel Sherrill <joel@OARcorp.com>
joel.sherrill at OARcorp.com
Thu Jan 22 22:30:54 UTC 2004
Thomas Doerfler wrote:
> Hello Leon,
>
> I also got stuck at these lines. These lines were initially
> coded for a mpc860 system, where the PIT was fed by an
> external 4 MHz crystal, not the 25MHz oscillator. For a 4MHz
> crystal, you set
>
> Cpu_table.clicks_per_usec=4
> Cpu_table.microseconds_per_tick=10000
>
> and get a resulting PIT initalization value of 40000, which is
> just a bit below 2^16. This works fine.
>
> If your PIT input clock gets increased (to 25MHz) then the
> resulting divider value simply does not fit into the 16 PIT
> reload register and then you get odd system tick frequencies.
>
> You may activate the prescaler between the clock input and the
> PIT input (divide by 128), but in that case you get very odd
> timer tick frequencies.
>
> We came over this some weeks ago on newer MBX860 boards, and
> due to certain reasons I only could hack together a solution
> for demo purposes, but I did not yet find time to implement it
> cleanly. (Yes, Joel, I know you are waiting for it aswell...)
:) And thanks again for your hospitality. :)
If I remember the problem correctly, you have to know the
clock frequency to select the proper divider and this is
all done inside the BSP at compile time. Is there a way to
probe for the clock frequency being used?
If not, would it be feasible to have a BSP specific configure
option to specify the clock information? And use some default
value otherwise based upon the BSP model variant?
> I hope this helps a bit.
>
> wkr,
> Thomas.
>
>
>>Hello to MPC860 gurus :-)
>>
>> I am stuck with the following small issue:
>>The file ../libcpu/powerpc/mpc8xx/clock/clock.c contains:
>>
>> pit_value = (rtems_configuration_get_microseconds_per_tick() *
>> rtems_cpu_configuration_get_clicks_per_usec()) - 1 ;
>>
>>and this value is calculated incorrectly in my case - MPC860 running at 25MHz
>>I put Cpu_table.microseconds_per_tick=10000 (10ms per RTEMS clock) and
>>Cpu_table.clicks_per_usec=25.
>>
>>This means that I incorrectly understand the meaning of
>>Cpu_table.clicks_per_usec. As it is also used in several other places, I do
>>not want to change it by deriving the required value from the formula in
>>MPC860 manual.
>>
>>I tried to find something in documentation, but was not able to find this
>>Cpu_table, which is used in mpc8xx.
>>
>>I shall be very thankful for clarification.
>>--
>>Leon M.Pollak
>>leonp at plris dot com
>
>
> --------------------------------------------
> IMD Ingenieurbuero fuer Microcomputertechnik
> Thomas Doerfler Herbststrasse 8
> D-82178 Puchheim Germany
> email: Thomas.Doerfler at imd-systems.de
> PGP public key available at: http://www.imd-
> systems.de/pgp_keys.htm
>
--
Joel Sherrill, Ph.D. Director of Research & Development
joel at OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
More information about the users
mailing list