public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] 1ms polling period
@ 2003-09-26  5:55 eibach
  2003-09-26  6:36 ` Eric de Jong
  2003-09-26  6:37 ` Eric Doenges
  0 siblings, 2 replies; 3+ messages in thread
From: eibach @ 2003-09-26  5:55 UTC (permalink / raw)
  To: ecos-discuss

Hello,

I have to do some hardware polling every 1-5 ms. 
What is the best way to do that in ecos?
Using the system clock there is only a minimum 10ms period available. I wouldn't like modifying the system clock, but is that the only way to do it?
Or should I manually use a hardware timer in my controller to generate an interrupt every 1ms? (My basic hardware is the ATMEL EB40A.)
Or is there maybe a completely different way to do this?
Any ideas you have about this are appreciated.

Regards,
Dirk Eibach


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

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

* Re: [ECOS] 1ms polling period
  2003-09-26  5:55 [ECOS] 1ms polling period eibach
@ 2003-09-26  6:36 ` Eric de Jong
  2003-09-26  6:37 ` Eric Doenges
  1 sibling, 0 replies; 3+ messages in thread
From: Eric de Jong @ 2003-09-26  6:36 UTC (permalink / raw)
  To: eCos discussion

>> I have to do some hardware polling every 1-5 ms.
>> What is the best way to do that in ecos?

Using a spare timer seems the best solution to me. It will garantee your polling
interval, and changes to your main application (more workload, adding threads)
later will not affect this.

Eric



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

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

* Re: [ECOS] 1ms polling period
  2003-09-26  5:55 [ECOS] 1ms polling period eibach
  2003-09-26  6:36 ` Eric de Jong
@ 2003-09-26  6:37 ` Eric Doenges
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Doenges @ 2003-09-26  6:37 UTC (permalink / raw)
  To: eibach; +Cc: ecos-discuss

eibach@gdsys.de wrote:

> I have to do some hardware polling every 1-5 ms. 
> What is the best way to do that in ecos?
> Using the system clock there is only a minimum 10ms period available.
 > I wouldn't like modifying the system clock, but is that the only way
 > to do it? Or should I manually use a hardware timer in my controller
 > to generate an interrupt every 1ms? (My basic hardware is the ATMEL 
EB40A.)
> Or is there maybe a completely different way to do this?
> Any ideas you have about this are appreciated.

I would say that depends on a number of things. If the overhead of eCos
system timer interrupts is not much larger than a normal interrupt,
then changing the system clock period is probably the easiest way to go
since you can use all the normal eCos timer functionality. Another
question is the required accuracy of your polling. If you use a 1ms
clock interrupt, your timing will be off by up to +/- 1ms (you can
probably disregard interrupt and thread switch latency in this case).

In a previous application, I had to poll the UART of a 16MHz 68332
periodically with an accuracy of 5 microseconds. The solution was to
request a timer interrupt sufficiently before ("sufficiently before"
was determined empirically by measuring the interrupt and thread
switching latency and adding a large safety factor) the actual polling 
time, and then poll the hardware timer in the highest priority thread
(with interrupts disabled) until the exact time was reached. Pretty
ugly, but it worked. Obviously, such an approach will suck up a lot of
the available processing resources of your CPU, so depending on how much
other work your application needs to do this may not be workable.
-- 
--------------------------------------------------------------------
|     Eric Doenges              |     DynaPel Laboratories GmbH    |
|     Tel: +49 89 962428 23     |     Fraunhoferstrasse 9/2        |
|     Fax: +49 89 962428 90     |     D - 85737 Ismaning, Germany  |
--------------------------------------------------------------------


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

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

end of thread, other threads:[~2003-09-26  6:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-26  5:55 [ECOS] 1ms polling period eibach
2003-09-26  6:36 ` Eric de Jong
2003-09-26  6:37 ` Eric Doenges

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).