Re: reading on serial port slow...
- From: phil-news-nospam@xxxxxxxx
- Date: 15 Dec 2007 14:35:42 GMT
On Sat, 15 Dec 2007 00:31:36 -0800 (PST) werasm <werasm@xxxxxxxxx> wrote:
| On Dec 15, 2:53 am, fl...@xxxxxxxxxx (Floyd L. Davidson) wrote:
|> werasm <wer...@xxxxxxxxx> wrote:
|> >On Dec 14, 7:29 pm, Joe Beanfish <j...@xxxxxxxxxx> wrote:
|>
|> >> You should be using select() and/or a blocking read() rather than
|> >> assuming anything about timing.
|>
|> >My requirements require me to do it the way I do it. I'm very familiar
|> >with select (and non-blocking read) or blocking read. But you still
|> >have not answered my question (but perhaps you don't know the answer).
|>
|> >Regards,
|>
|> >Werner
|>
|> Your question was "What's wrong with my code?"
|>
|> I can see the problem, right *there*...
|>
|> --
|> Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
|> Ukpeagvik (Barrow, Alaska) fl...@xxxxxxxxxx
|
| You don't need to see my code. Actually my code works fine.
And since Linux also works fine (though you are quite welcome to read
the code, and even change its behaviour if you like), then I guess all
is well?
| Initially I used a blocking read - no magic there - go look
| it up in the Unix Spec. We used to Termios driver to set
| up the port and the smallest timeout specifiable is 1 DeciSec
| or the first character, whichever happens first. The problem
| was that even after a DeciSec for certain tests there was
| no data to read (under certain circumstances), even though
| the data should have been received after approx. 7ms (and
| this was verified by oscilloscope). The reason I found
| to be the fact that the task sending a 1000 messages
| (in a loop) was holding the processor. The more messages
| were sent, the longer the processor was held (because
| of the fact that it used SCHED_FIFO). My question is:
So why not persist in the reading as a test to see how long it is for
the process to actually get the data? Or see if it ever gets the data.
If there is a problem somewhere, this information might help.
So why are you wanting this other task to hold the processor?
| Can I change the "lack of reading behaviour" by forcing
| the Linux Kernel (or the termios driver) to service its I/Os,
| thereby making the data available to read. It was also seen
| that as soon as the thread that sends messages stops, data
| suddenly becomes available to read (after a couple of
| messages has been lost). I'm not in the mood for posting
| my code. The behavior I describe is quite clear. Therefore
| please just answer if you can, else go irritate someone
| else.
If the data is unavailable _and_ persists to be unavailable, there could
be many causes. If the other process being running can cause the data
to become unavailable, that, too, could be one or more of many issues.
There could be scheduling issues with the process trying to read the data
or even the driver reading it from the hardware, depending on how much
the busy process is hogging resources. It could be a memory issue. This
is where diagnostic analysis is needed. And we cannot do that for you
(because we need far more information than is available to us to do it).
If you are confident that the driver is somehow refusing to read the
device for extended periods of time for some reason, then what I suggest
is to add some code to that driver to have it do printk's to describe
what it is doing at any given instant of time, at critical logic points
in its code (such as reading from the device, handling interrupts, etc).
And watch the console for this.
--
|---------------------------------------/----------------------------------|
| Phil Howard KA9WGN (ka9wgn.ham.org) / Do not send to the address below |
| first name lower case at ipal.net / spamtrap-2007-12-15-0823@xxxxxxxx |
|------------------------------------/-------------------------------------|
.
- Follow-Ups:
- Re: reading on serial port slow...
- From: werasm
- Re: reading on serial port slow...
- From: werasm
- Re: reading on serial port slow...
- References:
- reading on serial port slow...
- From: werasm
- Re: reading on serial port slow...
- From: Joe Beanfish
- Re: reading on serial port slow...
- From: werasm
- Re: reading on serial port slow...
- From: Floyd L. Davidson
- Re: reading on serial port slow...
- From: werasm
- reading on serial port slow...
- Prev by Date: Re: reading on serial port slow...
- Next by Date: Re: reading on serial port slow...
- Previous by thread: Re: reading on serial port slow...
- Next by thread: Re: reading on serial port slow...
- Index(es):
Relevant Pages
|