[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: [rtl] Serial querry



Jim,

Do you really need to stay in the RT task for 1ms?  I suspect
you may be waiting on an ADC conversion in your RT task.  I
would not do that.  IMO it is an un-needed waste of CPU time.  

What I do is have an 8KHz interrupt on each tick I
  0) If (not time_to_read) return
  1) Read sample N
     reset time_to_read
  2) Do a "start convert" on sample N + 1

In a 10Hz loop I do
  1) time_to_read = 1

You could use a 1KHz and 4Hz loop and your CPU would never be
blocked for more than a few micro seconds.


The 1/8000 sec period is just a bit longer than my ADC's conversion
time so I never have to wait.  The trick is to do it backwards
read _then_ start the converter.  Never do a busy wait inside
an RT task.

If you think you will have problems with your serial port what
about Ethernet, the disk, floppy tape drive and so on?

Actually my program is a bit more complex.  I have two loops.
Each is a Finite State machine with about a dozen states and
make a transition once per cycle  I third task accepts commands
from a user program. but the above is the guts of it.  I read
blocks of 2400 16-bit integers off the interface.  One block
about every 0.9 seconds.  The whole RT process does not seem
to have any effect on even my 486/66.  The reason is there is
_no_ wait loop anyplace in the RT code.

James Cassidy wrote:
> 
> Hello everyone.  I've got a querry regarding serial processing....
> 
> The real time task that I'm setting up will scan a bunch of ADC
> channels very quickly.  This will take up to 1ms every 250ms.
> So I'm assuming that the serial interrupts won't be processed by
> Linux for this 1ms block.
> 
> Does this mean that the speed of the serial port is limited?
> I.e. at high baud rates, could I experience serial overruns?
> 
> I beleive the serial hardware has a 16 byte buffer, so is my
> serial rate limited to:
> 
> time to recieve 16 bytes < 1ms
> 
> Just want to make certain that I'm understanding the constraints
> before I get too far.
>

-- 
--Chris Albertson

  chris@topdog.logicon.com                Voice:  626-351-0089  X127
  Logicon RDA, Pasadena California          Fax:  626-351-0699
--- [rtl] ---
For more information on Real-Time Linux see:
http://rtlinux.cs.nmt.edu/