Re: reading on serial port slow...



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



Relevant Pages

  • Re: [RFC] Add Input IOCTL for accelerometer devices
    ... We have lots of kernel drivers and kernel features which we are using everyday However, I know these are can't be merged kernel. ... Many real accelerometer rigs out there actually use a pair of chips, ... Then you can make another device driver module or API that can help intercommunicate between two devices. ... I'd also argue that the reading you ...
    (Linux-Kernel)
  • Re: Most forgetful Chiltern driver!
    ... I've also had one routing error, when an HST that I was travelling on ... from Padd to Reading was routed into a through road at Reading. ... Can't really blame the driver, ... I once observed the Golden Arrow given the wrong route at Bickley Junction. ...
    (uk.railway)
  • Re: ResultSet size limitation
    ... I have recreated the problem running in a wsad test ... are returned and I'm reading the columns left to right. ... newsroomPhotographyCollectionDetail " + whereClause; ... >> jdbc driver, windows 2000 server, SQLServer enterprise ...
    (microsoft.public.sqlserver.jdbcdriver)
  • Re: A poor workman blames...
    ... the printer driver is broken. ... As some of our users know (and readers of Qercus certainly should know ... It will come as little if any surprise to some reading this that I ... pointed out to our three officials running this ...
    (comp.sys.acorn.advocacy)
  • RE: The Handle Is Invalid when printing to new HP printer
    ... Visit following website to download the latest driver: ... If the issue persists, let's move on: ... Microsoft Shared Fax Monitor ... Microsoft Online Newsgroup Support ...
    (microsoft.public.windows.server.sbs)