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