[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Microseconds per tick



- On Leon2, there is a PRESCALER register that drives 2 timers. The 
prescaler is driven by
the CPU clock (1 cpu clock -> 1 prescaler count). When the prescaler 
underflows, it decreases
the timers by 1 count and when the timer1 underflows, it generates 1 
tick (and this
this the system tick).  The number in
#define CONFIGURE_MICROSECONDS_PER_TICK is used to reload the TIMER1
and the bsp assumes that TIMER1 is driven by 1 microsecond pulse, which 
is not always
correct, depending on what PRESCALER was originally loaded.

- In your case, for example, your cpu clock is 80 MHz. If you programmed 
the prescaler
with 79, when the prescaler underflows (counting down) after 80 cpu 
clocks, it decreases
the timers by 1 count (1 microsecond). So if you #define 
CONFIGURE_MICROSECONDS_PER_TICK
100, then it loads 100 into TIMER1 register, and after it counts down 
every 100 counts (100 microseconds),
TIMER1 generates 1 system tick.  However, if you programmed the 
prescaler to any
different value (799 for example, to generate 10-microsecond pulses), 
your system tick
is still 100, but it'll be 100 x 10 = 1000 microseconds system tick.

What I'm wondering is if there is a way to reconfigure the prescaler by 
#define without
having to explicitly program it myself (currently I'm doing it 
explicitly in the bootrom).
 
-mike-




Leonard Bise wrote:
>
> Hi all,
>
> I'm quite new to RTEMS and I'm not very experienced so I hope you can 
> give me an hand!
>
> We are working with a board using a LEON2 Sparc processor running at 
> 80Mhz, I figured that the microseconds per tick value would be 0.0125 
> (is this correct?).
>
> Shall I simply configure my application with this define ? #define 
> CONFIGURE_MICROSECONDS_PER_TICK 0.0125 ?
>
> I hope you can help, thanks in advance.
>
> L?onard.
>
> ps: By the way I posted once using the wrong mail address and it said 
> it was awaiting approval from the moderators, please delete this one. 
> This is the correct address.
> ------------------------------------------------------------------------
>
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.com
> http://rtems.rtems.org/mailman/listinfo/rtems-users
>