public inbox for gentoo-embedded@lists.gentoo.org
 help / color / mirror / Atom feed
From: David Relson <relson@osagesoftware.com>
To: gentoo-embedded@lists.gentoo.org <gentoo-embedded@lists.gentoo.org>
Subject: [gentoo-embedded] High Speed Serial Problem
Date: Sun, 14 Mar 2010 10:24:59 -0400	[thread overview]
Message-ID: <20100314102459.20d7883b@osage.osagesoftware.com> (raw)

G'day,

I'm porting a DOS application to Linux and have encountered problems
with the high speed serial devices from which the app receives data.

The hardware consists of a PC-104 board with a 486 compatible SOC
(system on a chip) providing 4 serial ports.  Ports 2 and 4 connect to
external devices that communicate at 115,200 baud.  The device sends a
42 byte record (containing a CRC), asserts a break to indicate end of
record, then does it again.  Every hour or so the app sends a message
to the device.  The message is sent immediately after the break is
recognized.

As an additional complication, the device connection is RS-485.  Being
half duplex, the code enables receive mode and transmit mode as needed.

The DOS app has an ISR to handle the communication.  Measured
throughput is approx 4,230 characters per second.  There is an error
rate of approx 2.5 errors per 1,000 records.

The Linux app has a separate thread for each of the 2 serial ports.
Data is received using select() and read().  Read is called with a 32
byte buffer.  As neither BRKINT nor IGNBRK is set, the input thread
recognizes 0xFF, 0x00, 0x00 sequences as breaks.  When the encoded
break is recognized, any pending message is sent.  

The Linux app receives approx 5,169 bytes per second and has an error
rate of 100 errors per 1,000 records.

Errors generally show up as dropped bytes.  Usually only 1 or 2 bytes.

The first (and most obvious) problem is that the Linux error rate is
40X higher rate than the DOS error rate.

 The second problem is that output from Linux isn't working.  After
 writing to the device, reading back doesn't show any change.  It's
 suspected that there's a timing issue, i.e. a timing window for
 receiving messages after the device sends a break.

I'm using a 2.6.29 kernel and the 486 SOC is running at 300mhz.
Processor speed is not believed to be the root because a newer 500mhz
version of the PC-104 board exhibits the same symptoms.

Any suggestions of what to do or where to look to solve the problems?

Thank you.

David



             reply	other threads:[~2010-03-14 15:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-14 14:24 David Relson [this message]
2010-03-14 16:34 ` [gentoo-embedded] High Speed Serial Problem Manuel Lauss
2010-03-14 17:14   ` David Relson
2010-03-14 17:51 ` Peter Stuge
2010-03-15  1:47 ` Peter Bell
2010-03-15 13:34 ` Bob Dunlop
2010-03-15 17:47   ` Relson, David
2010-03-20 19:02     ` [gentoo-embedded] SOLUTION (partial) was: " David Relson
2010-03-23  5:19       ` James Ausmus
2010-03-15 14:07 ` [gentoo-embedded] " wireless

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100314102459.20d7883b@osage.osagesoftware.com \
    --to=relson@osagesoftware.com \
    --cc=gentoo-embedded@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox