1 |
G'day, |
2 |
|
3 |
I'm porting a DOS application to Linux and have encountered problems |
4 |
with the high speed serial devices from which the app receives data. |
5 |
|
6 |
The hardware consists of a PC-104 board with a 486 compatible SOC |
7 |
(system on a chip) providing 4 serial ports. Ports 2 and 4 connect to |
8 |
external devices that communicate at 115,200 baud. The device sends a |
9 |
42 byte record (containing a CRC), asserts a break to indicate end of |
10 |
record, then does it again. Every hour or so the app sends a message |
11 |
to the device. The message is sent immediately after the break is |
12 |
recognized. |
13 |
|
14 |
As an additional complication, the device connection is RS-485. Being |
15 |
half duplex, the code enables receive mode and transmit mode as needed. |
16 |
|
17 |
The DOS app has an ISR to handle the communication. Measured |
18 |
throughput is approx 4,230 characters per second. There is an error |
19 |
rate of approx 2.5 errors per 1,000 records. |
20 |
|
21 |
The Linux app has a separate thread for each of the 2 serial ports. |
22 |
Data is received using select() and read(). Read is called with a 32 |
23 |
byte buffer. As neither BRKINT nor IGNBRK is set, the input thread |
24 |
recognizes 0xFF, 0x00, 0x00 sequences as breaks. When the encoded |
25 |
break is recognized, any pending message is sent. |
26 |
|
27 |
The Linux app receives approx 5,169 bytes per second and has an error |
28 |
rate of 100 errors per 1,000 records. |
29 |
|
30 |
Errors generally show up as dropped bytes. Usually only 1 or 2 bytes. |
31 |
|
32 |
The first (and most obvious) problem is that the Linux error rate is |
33 |
40X higher rate than the DOS error rate. |
34 |
|
35 |
The second problem is that output from Linux isn't working. After |
36 |
writing to the device, reading back doesn't show any change. It's |
37 |
suspected that there's a timing issue, i.e. a timing window for |
38 |
receiving messages after the device sends a break. |
39 |
|
40 |
I'm using a 2.6.29 kernel and the 486 SOC is running at 300mhz. |
41 |
Processor speed is not believed to be the root because a newer 500mhz |
42 |
version of the PC-104 board exhibits the same symptoms. |
43 |
|
44 |
Any suggestions of what to do or where to look to solve the problems? |
45 |
|
46 |
Thank you. |
47 |
|
48 |
David |