[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Microseconds per tick
- Date: Fri, 27 Mar 2009 11:34:09 -0700
- From: antispam21 at verizon.net (mike)
- Subject: 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
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
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
having to explicitly program it myself (currently I'm doing it
explicitly in the bootrom).
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.
> 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