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

Re: Serial port ttys0 and ttys2




You are correct with the new release,

With this configuration :
=========================
cris-dist-1.56.tar.gz
cris-dist-glibc-1.56.tar.gz
cris-dist-linux-headers-1.56.tar.gz
devboard_lx-R2_2_0.tar.gz
linux-2.4.26.tar.gz
-> gcc version 3.2.1 Axis release R56/1.56

With the default kernelconfig :
===============================
This message appear : handle_descr_data: Too much pending incoming 
serial data! Dropping 256 bytes.

I made a c program (See the previous message in this thread).
I send a file (1000000 bytes) on the ttyS0 with minicom program at 
115200 bauds. And, I don't use the ethernet interface :
ttyS0 -> minicom (Transfer port)
ttyS2 -> minicom (Debug port)

With : usleep = 0 or 1 or other value

With this kernelconfig :
========================

CONFIG_ETRAX_DEBUG_PORT2=y
CONFIG_ETRAX_RESCUE_SER2=y
CONFIG_ETRAX_SERIAL_FAST_TIMER=y
CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST=y

I made a c program (See the previous message in this thread).
I send a file (1000000 bytes) on the ttyS0 with minicom program at 
115200 bauds. And, I don't use the ethernet interface :
ttyS0 -> minicom (Transfer port)
ttyS2 -> minicom (Debug port)

usleep / size of data receive /
      0   1000000
100000   1000000
200000   1000000
300000   1000000
350000    990983
400000    932270

With that you can calulate the size of the buffer in the serial driver 
program.

115200 bauds (bits/s) -> 1 byte / 69us
300000 us / 69 = 4320 bytes (Approximately)

With this kernelconfig :
========================

CONFIG_ETRAX_DEBUG_PORT0=y
CONFIG_ETRAX_RESCUE_SER0=y
CONFIG_ETRAX_SERIAL_FAST_TIMER=y
CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST=y

I made a c program (See the previous message in this thread).
I send a file (1000000 bytes) on the ttyS2 with minicom program at 
115200 bauds. And, I don't use the ethernet interface :
ttyS2 -> minicom (Transfer port)
ttyS0 -> minicom (Debug port)

usleep / size of data receive /
      0   1000000
100000   1000000
200000   1000000
300000   1000000
350000    989713
400000    930326

With this kernelconfig :
========================

CONFIG_ETRAX_DEBUG_PORT_NULL=y
CONFIG_ETRAX_RESCUE_SER0=y
CONFIG_ETRAX_SERIAL_FAST_TIMER=y
CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST=y

-> No one problem ... excellent, good job.

(But, with the old devboard_lx-R2_1_0.tar.gz (and Linux 2.4.14) there is 
some problem on the ttyS2.)

Thanks.

Johan Adolfsson a écrit:
> Hi,
> Have you had any progress with the hints I gave you?
> I can't explain the different behaviour between ttyS0 and ttyS2,
> you see, If you try a longer file you might see it there as well?
> 
> If I do the following test in three different telnet windows
> with a loopback plug in ttyS2:
> 1. Runs comm program.
> 2. cat /dev/zero >/dev/ttyS2
> 3. cat /proc/tty/driver/serial # over and over again
> I can see that the rx_pend:num1/num2 increases which indicates that
> the application doesn't keep up the reading num1 is teh amount buffered
> and num2 is the maximum buffered amount.
> After about 600000 bytes the buffer is full and you start dropping data.
> Same goes for ttyS0 for me.
> 
> Your comm application that sleeps like and does non-blocking reads like
> that is not keeping up I guess.
> 
> /Johan
> 
> 
> ----- Original Message ----- 
> From: "Frossard Philippe" <p.frossard@xxxxxxx.ch>
> To: "Johan Adolfsson" <johana@xxxxxxx.com>
> Cc: <jonashg@xxxxxxx.com>
> Sent: Wednesday, August 18, 2004 4:09 PM
> Subject: Re: Serial port ttys0 and ttys2
> 
> 
> 
>>Thanks Johan for your help,
>>I'm doing some test about your message,
>>
>>I read the file : ET100LX_07_DMA_011019.pdf
>>
>>DMA Channel 0/1 (Priority highest) : Network
>>DMA Channel 2/3                    : Async serial port P2 (ttyS2)
>>DMA Channel 4/5                    : ?
>>DMA Channel 6/7                    : Async serial port P0 (ttyS0)
>>DMA Channel 8/9 (Priority lowest)  : ?
>>
>>Why this c program run very well on the ttyS0 and not on the ttyS2 ?
>>Logicaly the ttyS2 must be the best !
>>
>>
>>Johan Adolfsson a écrit:
>>
>>>Hi,
>>>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
>>>...
>>>
>>>
>>>
>>>>CONFIG_ETRAX_SERIAL_RX_TIMEOUT_TICKS=5
>>>
>>>
>>>You could try changing to:
>>>CONFIG_ETRAX_SERIAL_RX_TIMEOUT_TICKS=1
>>>
>>>
>>>
>>>>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:
>>> flush_to_flip_buffer(info);
>>>at the end of the receive_chars_dma() function in
>>>os/linux/arch/cris/drivers/serial.c
>>>but I don't think that's the problem for you.
>>>
>>>Let us know if it helps.
>>>
>>>/Johan
>>>
>>>
>>
>>-- 
>>Philippe Frossard
>>
>>
>