[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Serial port ttys0 and ttys2

Please see my comments below:

----- Original Message ----- 
From: "Frossard Philippe" <p.frossard@xxxxxxx.ch>
To: <jonashg@xxxxxxx.com>
Cc: "Dev-etrax" <dev-etrax@xxxxxxx.com>
Sent: Wednesday, August 18, 2004 11:42 AM
Subject: Re: Serial port ttys0 and ttys2


You could try changing to:

> The test on ttyS2 :
> ===================
> I made a c program (See the previous message in this thread).
> If you send a file about 1Mbytes on the ttyS2 with minicom program, the 
> number of byte receive is not correct (I have only one Telnet connection 
> to the axis board ! / I don't use Ftp or Http in the same time).
> The messages on ttyS0 :
> =======================
> handle_descr_data: Too much pending incoming serial data! Dropping 256 
> bytes.
> handle_descr_data: Too much pending incoming serial data! Dropping 256 
> bytes.
> ...
> -- 
> Philippe Frossard

I believe the debug output indicates that the application is not 
reading data fast enough, and might be busywaiting for data
and thus starving the CPU.
You could try skipping the usleep() in your program or even better
use a select() call to wait until data is avalable or use blocking 
reads instead (skip the O_NONBLOCKING flag in open()).
(or use flow control although I don't think that should be needed for
 an application that uses select())

Maybe worth nothing:
* Your read() will probaly just return max 4096 bytes since thats 
  what the tty buffers are.
* An usleep(5000) will probably sleep in at least 10 msec.

You could also try adding:
at the end of the receive_chars_dma() function in 
but I don't think that's the problem for you.

Let us know if it helps.