Re: 8ms Timer for serial port access

From: Byron A Jeff (byron_at_cc.gatech.edu)
Date: 10/29/03


Date: 28 Oct 2003 18:12:13 -0500

In article <BBC40CFE.17F7%jens.schumacher@uni.de>,
Jens Schumacher <jens.schumacher@uni.de> wrote:
-Hello,
-
-I need to collect data from the serial port every 8ms since the device
-connected to the port works at 120Hz. This doesn't seems to work properly
-due to the 10ms time slice interval of a normal i386 kernel. The
-communication to the serial port is done in user space at the moment and is
-not loaded as a module. I read a lot in the history of the newsgroup and
-there are some solutions recommended. From low latency kernel patches to the
-use of real-time Linux. But I'm pretty new to Linux and feel not comfortable
-by patching the kernel since I don't know how a low latency path affects
-other programs on the system.
-
-It is important that I get the data nearly every 8 ms because I don't want
-the serial port buffer to overflow and loose data. But the use of real-time
-Linux seems to be a overhead to me.

My head is swirling with confusion. I seek clarity in this matter. You wish
to collect data, and not have the buffer overflow.

The last time I checked on this matter, that was exactly the purpose of the
kernel serial driver, serial.o.

So I'm very confused as to why you are attempting to reinvent a wheel that
rolls quite well.

Now it may be another matter if you in fact need to time the receipt of each
byte, but that wasn't clear from the description above.

Since you are newbie, and I'm confused, would you mind if we started over?

Here's what I got from above:

1) Device sends data via the serial port.
2) You need to collect the data.
3) You do not want to lose any data.

But there's a bunch missing:

1) What bit rate is the data transmitted?
2) Does the data need to be timestamped?
3) Is the data bursty or does it come in a steady stream?
4) What makes you think that the data will overrun the serial port and kernel
   driver?

In the grand scheme of things, the serial port is a low speed device. The
current Linux serial port driver can receive and buffer a 460k continuous
stream without breaking a sweat. It isn't the old DOS BIOS serial driver.

-What about soft-real-time? I looked at the sched* functions, but could'nt
-get it running as fast as I want.
-What about using the rtc?
-
-Is it also possible to run the application at that frequency to work with
-the data I get?

I'm still trying to figure out what you require from the OS. Care to explain
the goals of the application?

BAJ



Relevant Pages

  • Re: console startup
    ... Once I completed Montavista's incomplete serial driver, the serial port ... beginning with the following from the 2.4 Montavista kernel. ...
    (comp.os.linux.embedded)
  • Re: Garmin GPS 18LVC Setup but questions on best way
    ... The PPS line from the GBS-18 LVC is wired to the DCD line of the ... driver, but as I said before, I'm no expert! ... I had to recompile the FreeBSD kernel to include this patch. ... has anyone done tests on the serial port interrupt to see how much ...
    (comp.protocols.time.ntp)
  • Re: How to get System log files???
    ... >> like to see what's goin on when the system crash. ... >> need a patch file or some program thru which all system logs are ... > some rh kernel patch allowing to dump through the network. ... serial port, or to a printer over the parallel port. ...
    (comp.os.linux.misc)
  • Re: Serial port blues
    ... on the serial output for 4 different computers running 4 different versions of Linux. ... I am now convinced that the current serial port drivers available to us on the Linux platform WILL NOT support CW and/or RTTY that is software generated in a satisfactory manner. ... The jitter is caused by the asynchronous response of the kernel to the request to control the port. ... It totally wipes out the ability to generate an FSK signal on the DTR or RTS pin. ...
    (Linux-Kernel)
  • Re: kernel ignores kenv comconsole_speed?
    ... As I said, boot and loader are happily using 115200, but the kernel ... serial port is initialised/"tinkered with" in stages. ... depending upon numerous aspects (/boot.config for boot0, ... the BIOS serial redirection works fine until ...
    (freebsd-stable)