FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Embedded

 
 
LinkBack Thread Tools
 
Old 03-20-2010, 06:02 PM
David Relson
 
Default SOLUTION (partial) was: High Speed Serial Problem

On Mon, 15 Mar 2010 13:47:14 -0400
Relson, David wrote:

> Hello Bob,
>
> VMIN and VTIME are the default values of 1 and 0, respectively. If I
> understand correctly, these settings will provide data as rapidly as
> possible.
>
> At present, I am using a 256 byte buffer for reading data. I've added
> some statistics gathering. Every 1000 reads, the program logs the
> total bytes read and the maximum read. The program was run for 30
> seconds to provide 6 statistics records
>
> With _no_ processing of data, 1000 reads got from 27,545 to 28,520
> chars. The max read was 128 chars. 3 of the 1000 read samples had
> max reads of 56 or 57 and 3 had max reads of 110, 126, and 128.
>
> With copying of data to a buffer (which involves several function
> calls, incrementing counters, etc), 1000 reads got from 27,187 to
> 28,241 chars and each of the 6 sample sets had a max read of 110 to
> 128 bytes.
>
> One would expect processing to increase the total bytes received, but
> this was not the case.
>
> The code _is_ handling the 3 char break sequence and the
> (undocumented) doubling (escaping) of 0xFF chars (to distinguish them
> from break sequences).
>
> Regards,
>
> David

The serial input problem has been solved! While talking with the
project manager, it occurred to me to check whether all byte codes,
i.e. 0x00 to 0xFF, were being received. I quickly found that 2 were
missing -- 0x11 and 0x13 -- which are the usual XON and XOFF
characters. Simply setting termios.c_iflag=PARMK (rather than or'ing
the flag) solved the lost character input problem.

Even with a dedicated thread, the program is still receiving multiple
characters per read. Calculating average and maximum byte counts for
each 10,000 reads, I've often seen maximums of 150 and have never seen
an average under 12. These numbers occur with VMIN=1 and VTIME=0.

Is there a setting so that the serial port driver will release
characters sooner (rather than later)?

My basic loop looks like:

while (1) {
char buffer[256];
select(...)
count = read(fd, buffer, sizeof(buffer))
... save characters.
}

Regards,

David
 

Thread Tools




All times are GMT. The time now is 11:51 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org