public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] timer interrupt help
@ 2009-04-24 17:32 Jeffrey Krasky
  2009-04-24 19:45 ` [ECOS] " John Dallaway
       [not found] ` <503B0C9A27DA734888E754583365E1F048B5D8@sh-e-01.hongkong.cortina.local>
  0 siblings, 2 replies; 3+ messages in thread
From: Jeffrey Krasky @ 2009-04-24 17:32 UTC (permalink / raw)
  To: ecos-discuss

Hi,
I've been reading about interrupts and how to create/attach them in eCos. 
There is still one piece of information that I am not sure about.

My goal is to have a timer go off every millisecond, as precise as 
possible. Is there a counter that I can register my ISR with so that when 
the counter reaches a value that's equivalent to 1ms in ticks, it will 
call my ISR? Or do I have to monitor the clock myself? I feel if I have 
to monitor the clock myself I will not achieve 1ms granularity.

Thanks,



Jeff



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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ECOS] Re: timer interrupt help
  2009-04-24 17:32 [ECOS] timer interrupt help Jeffrey Krasky
@ 2009-04-24 19:45 ` John Dallaway
       [not found] ` <503B0C9A27DA734888E754583365E1F048B5D8@sh-e-01.hongkong.cortina.local>
  1 sibling, 0 replies; 3+ messages in thread
From: John Dallaway @ 2009-04-24 19:45 UTC (permalink / raw)
  To: Jeffrey Krasky; +Cc: ecos-discuss

Hi Jeff

Jeffrey Krasky wrote:

> I've been reading about interrupts and how to create/attach them in
> eCos. There is still one piece of information that I am not sure about.
> 
> My goal is to have a timer go off every millisecond, as precise as
> possible. Is there a counter that I can register my ISR with so that
> when the counter reaches a value that's equivalent to 1ms in ticks, it
> will call my ISR? Or do I have to monitor the clock myself? I feel if I
> have to monitor the clock myself I will not achieve 1ms granularity.

The eCos system clock runs off a hardware timer which is typically
initialized to generate interrupts at 100Hz. For many regular
application tasks, you can simply create an eCos alarm and attach it to
the system clock to trigger every 'N' ticks. The associated alarm
function will be called each time the alarm triggers. Ref:

http://ecos.sourceware.org/docs-latest/user-guide/clocks-and-alarm-handlers.html

It would appear that the default eCos system clock frequency is unlikely
to be fast enough for your needs. You can modify the system clock
frequency to a certain extent by adjusting configuration options within
the eCos HAL, but there can be undesirable side effects. Ref:

http://ecos.sourceware.org/docs-latest/ref/kernel-clocks.html

You may prefer to identify another timer in your hardware design and
initialize it to generate interrupts at 1kHz. You can then write an
interrupt handler and attach it to the relevant interrupt vector. The
interrupt handler will be called at 1ms intervals in a manner which is
largely independent of any other activities in your system.

Either way, there is no need to poll a hardware timer.

I hope this helps

John Dallaway

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [ECOS] timer interrupt help
       [not found] ` <503B0C9A27DA734888E754583365E1F048B5D8@sh-e-01.hongkong.cortina.local>
@ 2009-04-25  7:45   ` Jeffrey Krasky
  0 siblings, 0 replies; 3+ messages in thread
From: Jeffrey Krasky @ 2009-04-25  7:45 UTC (permalink / raw)
  To: Libo Wang; +Cc: ecos-discuss

I'm doing this on a windows machine with Intel hardware. Considering all 
of the abstractions between the hardware, such as windows --> cygwin --> 
eCos, do I really stand a chance of getting 1ms periods, or will I only 
get something *close* like 1ms 200us, then 1us 150us, etc?

What I really want is a perfect 1 millisecond, with only being off by a 
few hundred nanoseconds.

Thanks,



Jeff



On Fri, 24 Apr 2009, Libo Wang wrote:

> Jeff
> The precise will decided by your hardware timer setting. Generally,
> hardware timer run at ns level.
> And you can set how many hardware cycles the timer interrupt will be
> triggered.
> For your case, you can refer the systems clock implement.  It should in
> clock.cxx.
>
> And I guess if you using such precise will caused high CPU load.
>
> BR
> Thx
> Libo Wang
>
> -----Original Message-----
> From: ecos-discuss-owner@ecos.sourceware.org
> [mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Jeffrey
> Krasky
> Sent: Friday, April 24, 2009 10:25 PM
> To: ecos-discuss@sourceware.org
> Subject: [ECOS] timer interrupt help
>
> Hi,
> I've been reading about interrupts and how to create/attach them in
> eCos.
> There is still one piece of information that I am not sure about.
>
> My goal is to have a timer go off every millisecond, as precise as
> possible. Is there a counter that I can register my ISR with so that
> when
> the counter reaches a value that's equivalent to 1ms in ticks, it will
> call my ISR? Or do I have to monitor the clock myself? I feel if I have
> to monitor the clock myself I will not achieve 1ms granularity.
>
> Thanks,
>
>
>
> Jeff
>
>
>
> --
> Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
> and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
>

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-04-24 20:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-24 17:32 [ECOS] timer interrupt help Jeffrey Krasky
2009-04-24 19:45 ` [ECOS] " John Dallaway
     [not found] ` <503B0C9A27DA734888E754583365E1F048B5D8@sh-e-01.hongkong.cortina.local>
2009-04-25  7:45   ` [ECOS] " Jeffrey Krasky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).