Gentoo Archives: gentoo-embedded

From: "Relson
To: gentoo-embedded@l.g.o
Subject: RE: [gentoo-embedded] High Speed Serial Problem
Date: Mon, 15 Mar 2010 18:05:38
Message-Id: 91FA647A1A781F41BBB0359765C90C15F713C8@mailsvr.orion-sys.com
In Reply to: Re: [gentoo-embedded] High Speed Serial Problem by Bob Dunlop
1 Hello Bob,
2
3 VMIN and VTIME are the default values of 1 and 0, respectively. If I
4 understand correctly, these settings will provide data as rapidly as
5 possible.
6
7 At present, I am using a 256 byte buffer for reading data. I've added
8 some statistics gathering. Every 1000 reads, the program logs the total
9 bytes read and the maximum read. The program was run for 30 seconds to
10 provide 6 statistics records
11
12 With _no_ processing of data, 1000 reads got from 27,545 to 28,520
13 chars. The max read was 128 chars. 3 of the 1000 read samples had max
14 reads of 56 or 57 and 3 had max reads of 110, 126, and 128.
15
16 With copying of data to a buffer (which involves several function calls,
17 incrementing counters, etc), 1000 reads got from 27,187 to 28,241 chars
18 and each of the 6 sample sets had a max read of 110 to 128 bytes.
19
20 One would expect processing to increase the total bytes received, but
21 this was not the case.
22
23 The code _is_ handling the 3 char break sequence and the (undocumented)
24 doubling (escaping) of 0xFF chars (to distinguish them from break
25 sequences).
26
27 Regards,
28
29 David
30 -----Original Message-----
31 From: Bob Dunlop [mailto:bob.dunlop@×××××××××.uk]
32 Sent: Monday, March 15, 2010 9:35 AM
33 To: gentoo-embedded@l.g.o
34 Subject: Re: [gentoo-embedded] High Speed Serial Problem
35
36 Hi,
37
38 > The Linux app has a separate thread for each of the 2 serial ports.
39 > Data is received using select() and read(). Read is called with a 32
40 > byte buffer. As neither BRKINT nor IGNBRK is set, the input thread
41 > recognizes 0xFF, 0x00, 0x00 sequences as breaks. When the encoded
42 > break is recognized, any pending message is sent.
43
44 There should be no problem handling 115K2 data at full speed on a 300MHz
45 processor although some SOC UARTs are realy gnarly. Using line break as
46 a protocol signalling element is so 1970s but again shouldn't be a
47 problem.
48
49 What are your VMIN, VTIME settings ? They can have a big impact on read
50 performance/timing. VMIN=VTIME=0 makes a mockery of using select for
51 example.
52
53 What size of return are you actually seeing from the read ?
54
55 If you are seeing reasonably full blocks, does you code handle the three
56 char break sequence spanning the read boundy ? Sorry if this is
57 teaching grandma to suck eggs.
58
59 --
60 Bob Dunlop

Replies

Subject Author
[gentoo-embedded] SOLUTION (partial) was: High Speed Serial Problem David Relson <relson@×××××××××××××.com>