This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: AdderII: Writing an ISR for the CPM timers


Note: please copy the eCos discussion list, so that all may benefit.
Private replies from me are available, but only with a support contract
with MLB Associates.

On Tue, 2004-05-04 at 10:01, Tzahi wrote:
> Thank you for responding.
> I'm sorry for not being clearer about what I need to do, so I'll be more
> specific.
> 
> We are developing a technology that would a very accurate clock
> synchronization (Stratum level) over IP.
> My application requires an ISR activation every 100msec but in an accuracy
> of 20 NanoSeconds (minimum Jitter)

You're never going to achieve this in software - not with a CPU running
at 48Mhz.

> I found out that the cyg_alarm is not accurate by:
> 1. Initialize the CPM timers (1+2) for counting in a resolution f 48MHz (a
> single tick is 20 NanoSeconds long)
> 2. Initialize a cyg_alarm to activate MyHandler() periodically every
> 100msec.
> 3. The MyHandler() reads the CPMTimer (every 100msec)
> The intervals are (10 min)
> min=0004799545 max=0004800771 ave=0004800173
> That means a Jitter of 12.3 microscond (peak to peak)

This seems altogether reasonable for a software routine - approx 600 
instructions to execute.

> I still had not tried using the PIT_ISR timers (var_misc.c),
> But I believe that I need something about 500 times more accurate (than
> var_misc.c), so the CPM timers looks like the best option.
> Do you have an example of using the CPM timers with a user IRQs (that calls
> MyHandler() )?

Look at the file I recommended before - it does just this.  n.b. in eCos
there is no "user" mode - all system functions are the same whether they
are written in the kernel or in your user application.

> 
> 
> 
> =======================================
> Tzahi Manistersky
> mailto:tzahi@terasync.net
> Software Engineer
> TeraSync LTD. http://www.terasync.net/
> Tel: +972(3)5360202 ext:1222
> Fax: +972(3)5360202
> 13 Altalef St., Industrial Zone - Yehud
> P.O.Box. 160, Yehud, 56000
> Israel
> =======================================
> 
> -----Original Message-----
> From: Gary Thomas [mailto:gary@mlbassoc.com]
> Sent: Tuesday, May 04, 2004 1:52 PM
> To: Tzahi
> Cc: Posting to
> Subject: Re: [ECOS] AdderII: Writing an ISR for the CPM timers
> 
> On Tue, 2004-05-04 at 06:07, Tzahi wrote:
> > Hello
> > I am using an AdderII board (MPC852T) running eCos 2.0.
> > I would like to write an ISR that would be activated exactly every
> 100msec.
> > (I found that using the cyg_alarm had not been accurate enough for my
> > needs).
> > I can use the CPM timers for measuring a TimeStamps in a 48MHz accuracy.
> > I know that there is a possibility to initialize the CPM's timers for
> > generating CYGNUM_HAL_INTERRUPT_CPM_TIMER. (So I can run my ISR when a
> > 100msec timer expires).
> > Had anyone managed to do so - on the AdderII?
> > How can I associate my ISR during initialization, without changing the
> code
> > of hal_arbitration_isr_cpm() etc. ?
> 
> If you only want 100ms accuracy, what's wrong with just using an alarm?
> 
> As for using the higher performance timers, look at
>   packages/hal/powerpc/mpc8xx/current/src/var_misc.c
> These timers can be used in support of profiling and there is code in
> that file that set them up, etc.
> 
> --
> Gary Thomas <gary@mlbassoc.com>
> MLB Associates
-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]