public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: Serial port latency
@ 2001-03-22 21:45 Manfred Spraul
  0 siblings, 0 replies; 32+ messages in thread
From: Manfred Spraul @ 2001-03-22 21:45 UTC (permalink / raw)
  To: geirt; +Cc: linux-kernel

Is the computer otherwise idle?
I've seen one unexplainable report with atm problems that disappeared
(!) if a kernel compile was running.

Could you try to run a simple cpu hog (with nice 20)?

<<
main()
{
    for(;;) getpid();
}
<<

I'm aware of one bug that could cause a delay of up to 20 ms (cpu_idle()
doesn't check for pending softirq's before sleeping), but that doesn't
explain your 500 ms delay.

--
    Manfred


^ permalink raw reply	[flat|nested] 32+ messages in thread
[parent not found: <Pine.LNX.4.20.0103221219410.3343-100000@linuxtaj.korpivaara.org>]
* Serial port latency
@ 2001-03-22 18:21 Geir Thomassen
  2001-03-22 20:08 ` Theodore Tso
                   ` (3 more replies)
  0 siblings, 4 replies; 32+ messages in thread
From: Geir Thomassen @ 2001-03-22 18:21 UTC (permalink / raw)
  To: linux-kernel; +Cc: tytso

Hi. 

My program controls a device (a programmer for microcontrollers) via the
serial port. The program sits in a tight loop, writing a few (typical 6)
bytes to the port, and waits for a few (typ. two) bytes to be returned from
the programmer. 

The program works, but it is very slow. I use an oscilloscope to monitor the
serial lines, and notices that there is a large delay between the returned
data, and the next new command. I really don't know if the delay is on the
sending or the receiving side (or both).

This is what the program does:

     fd=open("/dev/ttyS0",O_NOCTTY | O_RDWR);

     tcsetattr(fd,TCSANOW, &tio); /* setting baud, parity, raw mode, etc */

     while() {
             write( 6 bytes);   /* send command */
             read( 2 bytes);    /* wait for reply */
     }


The device on the serial port responds in typ. 10 ms, but the software uses
over 500ms to get the reply and send the next command. Why is this happening ?
I have a feeling that there is something obvious I am missing (like line
buffering, but that's a stdio (libc) thing, isn't it ?).

BTW, I am running a 2.2 kernel ....

Geir, geirt@powertech.no

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

end of thread, other threads:[~2001-04-10  0:35 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <000401c0b319517fea9@local>
2001-03-25 23:10 ` Serial port latency Pavel Machek
2001-03-29  7:58   ` Manfred Spraul
2001-03-30 22:36     ` Pavel Machek
2001-03-31 22:09       ` Manfred Spraul
2001-04-03 23:07         ` softirq buggy [Re: Serial port latency] Pavel Machek
2001-04-04 21:18           ` Manfred Spraul
2001-04-06 12:00             ` Pavel Machek
2001-04-07 22:28               ` Manfred Spraul
2001-04-08 16:58                 ` kuznet
2001-04-08 17:21                   ` Manfred Spraul
2001-04-08 17:58                     ` kuznet
2001-04-08 18:16                       ` Manfred Spraul
2001-04-08 21:35                       ` [PATCH] Re: softirq buggy Manfred Spraul
2001-04-09  8:42                         ` Albert D. Cahalan
2001-04-09 13:50                         ` Andrea Arcangeli
2001-04-09 15:26                           ` Manfred Spraul
2001-04-09 17:31                             ` Andrea Arcangeli
2001-04-09 17:48                             ` kuznet
2001-04-09 18:26                               ` Andrea Arcangeli
2001-04-10  0:37   ` Serial port latency Andrea Arcangeli
2001-03-22 21:45 Manfred Spraul
     [not found] <Pine.LNX.4.20.0103221219410.3343-100000@linuxtaj.korpivaara.org>
2001-03-22 20:03 ` Geir Thomassen
2001-03-22 20:17   ` Trent Jarvi
  -- strict thread matches above, loose matches on Subject: below --
2001-03-22 18:21 Geir Thomassen
2001-03-22 20:08 ` Theodore Tso
2001-03-22 20:32   ` Geir Thomassen
2001-03-22 20:55     ` Paul Fulghum
2001-03-22 22:44     ` Theodore Tso
     [not found] ` <20010322141937.C22479@universal-fasteners.com>
2001-03-22 21:02   ` Geir Thomassen
2001-03-22 21:52 ` Jonathan Lundell
2001-03-22 23:25 ` Pavel Machek
2001-03-23 14:43   ` Geir Thomassen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox