RE: [uClinux-dev] Re: how to decrease serial port tx latency? (Alexey Goncharov)

2010-07-16 Thread Ben Kloosterman
I had this exact problem years ago and it was due to COM1 and COM2 IRQ being
revered on the card  3& 4 instead of  4 & 3  ( so the HW was opposite the
driver as the old cards allowed you to change IRQ and someone got it wrong)
and it would clear the data  when noise came in or a poll was scheduled.
Funny thing was it worked ok for months when a noisy cable was plugged into
the  Com2 ( and unattached at the other end) when the unused cable was
unplugged COM1 stopped working. 

Anyway the story is the OS doesn't know the HW config so you need to check
the HW settings. 

Ben

___
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev


Re: [uClinux-dev] Re: how to decrease serial port tx latency? (Alexey Goncharov)

2010-07-15 Thread Lennart Sorensen
On Thu, Jul 15, 2010 at 04:53:45PM +0600, Alexey Goncharov wrote:
> Guys, i've just figured out a strange behaviour of the serial driver. As  
> I mentioned above in my previous letter, irq count is going up fast  
> enough (serial tx period is ~100 ms now). I started to debug 8250.c and  
> append debug strings to different functions and to  
> serial8250_backup_timeout function in particular. The debug string from  
> this function appears in the console. So.. right after that i started to  
> adjust timeouts in the following strings related to the polling mode of  
> the driver:
>
> mod_timer(&up->timer, jiffies + poll_timeout(up->port.timeout) + HZ/5);
>
> mod_timer(&up->timer, jiffies + poll_timeout(up->port.timeout) + HZ/5);
>
> I've changed the division rate from 5 to 50: HZ/5 -> HZ/50.
>
>  Right after that data becomes to appear on the pin in (0;20 ms]  
> range. It seems that driver works in polling-mode despite the fact that  
> irq are being counted properly.
>
> My next question is to the person who is familiar with the working  
> principles of this driver: what settings should i do to make irqs work  
> properly in this case (16550A driver and lpc2468 processor)?

Well according to
http://www.linux.org/docs/ldp/howto/Serial-HOWTO-18.html, if you have
an IRQ problem, the driver will still work using slow polling.  If you
set the IRQ to 0, it will use fast polling instead (because 0 means irq
disabled), but use more CPU.

So I still suspect you have the IRQs wrong somehow.  Perhaps they are
inverted, or you have them swapped, or something else is wrong with
the setup.  The fact you are seeing them count up means at least something
is driving the IRQ lines (but doesn't tell you if they are the right
device of course).  Have you verified that traffic on one port is causing
the count for that port's IRQ to go up?  If you send one character at
a time, hopefully you should see the IRQ go up once per character.
At higher speeds you hopefully won't see quite that many IRQs.

So double check your platform setup code to make sure you have the IRQs
configured correctly (polarity, edge versus level trigger, etc).

-- 
Len Sorensen
___
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev


Re: [uClinux-dev] Re: how to decrease serial port tx latency? (Alexey Goncharov)

2010-07-15 Thread Alexey Goncharov

Here is some output from linux booting log:

Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing isabled
serial8250.0: ttyS0 at MMIO 0xe000c000 (irq = 6) is a 16550A
serial8250.0: ttyS1 at MMIO 0xe001 (irq = 7) is a 16550A
serial8250.0: ttyS2 at MMIO 0xe0078000 (irq = 28) is a 16550A
serial8250.0: ttyS3 at MMIO 0xe007c000 (irq = 29) is a 16550A

Am i right saying that irqs were installed and are being used properly
according to the log above? The crystal which I am using is lpc2468 with
the following definitions from 8250.c:


No. That just says what it thinks is right.



If you want to know, check /proc/interrupts and make sure the count is
going up on the serial port you are using.


Count is definitely going up, Lennart.. Could you please give more tips? :)


Guys, i've just figured out a strange behaviour of the serial driver. As 
I mentioned above in my previous letter, irq count is going up fast 
enough (serial tx period is ~100 ms now). I started to debug 8250.c and 
append debug strings to different functions and to 
serial8250_backup_timeout function in particular. The debug string from 
this function appears in the console. So.. right after that i started to 
adjust timeouts in the following strings related to the polling mode of 
the driver:


mod_timer(&up->timer, jiffies + poll_timeout(up->port.timeout) + HZ/5);

mod_timer(&up->timer, jiffies + poll_timeout(up->port.timeout) + HZ/5);

I've changed the division rate from 5 to 50: HZ/5 -> HZ/50.

 Right after that data becomes to appear on the pin in (0;20 ms] 
range. It seems that driver works in polling-mode despite the fact that 
irq are being counted properly.


My next question is to the person who is familiar with the working 
principles of this driver: what settings should i do to make irqs work 
properly in this case (16550A driver and lpc2468 processor)?



--
Agava Design Bureau
620026, Russia, 620026, Yekaterinburg, Bazhova str. 174
tel./fax. +7 (343) 262-92-76, 262-92-78, 262-92-87
http://kb-agava.ru

___
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev


Re: [uClinux-dev] Re: how to decrease serial port tx latency? (Alexey Goncharov)

2010-07-14 Thread Alexey Goncharov

Here is some output from linux booting log:

Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing isabled
serial8250.0: ttyS0 at MMIO 0xe000c000 (irq = 6) is a 16550A
serial8250.0: ttyS1 at MMIO 0xe001 (irq = 7) is a 16550A
serial8250.0: ttyS2 at MMIO 0xe0078000 (irq = 28) is a 16550A
serial8250.0: ttyS3 at MMIO 0xe007c000 (irq = 29) is a 16550A

Am i right saying that irqs were installed and are being used properly
according to the log above? The crystal which I am using is lpc2468 with
the following definitions from 8250.c:


No.  That just says what it thinks is right.



If you want to know, check /proc/interrupts and make sure the count is
going up on the serial port you are using.


Count is definitely going up, Lennart.. Could you please give more tips? :)


--
Agava Design Bureau
620026, Russia, 620026, Yekaterinburg, Bazhova str. 174
tel./fax. +7 (343) 262-92-76, 262-92-78, 262-92-87
http://kb-agava.ru

___
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev


Re: [uClinux-dev] Re: how to decrease serial port tx latency? (Alexey Goncharov)

2010-07-14 Thread Alexey Goncharov

On Tue, Jul 13, 2010 at 06:25:23PM +0600, Alexey Goncharov wrote:

I wonder if the port is using the irq or polling?  I seem to recall
seeing really bad serial performance when the irq wasn't setup right once.


Here is an excerpt from 8250 driver debug log:

serial8250_interrupt(28)...status = 61...end.
THRE...serial8250_interrupt(28)...status = 61...end.
status = 60...THRE...serial8250_interrupt(28)...status = 60...end.
serial8250_interrupt(28)...status = 61...end.


status = 61 <--- 0x61 - a value that is stored in UnLSR (UART Line 
Status Register). UnLSR register description can be found  in LPC2468 
user manual rev. 4 ( http://www.nxp.com/documents/data_sheet/LPC2468.pdf 
) on page 432. Below is a part of it:


0x61 = 0110 0001
|| |
|| +->   Overrun Error
|+--->   Transmitter Holding Register Empty (THRE)
+>   Transmitter Empty (TEMT)

So.. how should i treat UARTs to except this kind of overruns? I send no 
more than 16 bytes every 80-100 ms and it tells me "overrun".


Thank you for your time

___
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev


Re: [uClinux-dev] Re: how to decrease serial port tx latency? (Alexey Goncharov)

2010-07-13 Thread Alexey Goncharov

By the way, why would a 16650 have a fifo size of 1?  That would give
really awful performance.  16550's have fifo sizes of 16.  I thought
16650's were at least that and usually bigger.


Sorry, Lennart, wrong copy-paste. Actually my settings are:

[PORT_16550A] = {

.name   = "16550A",

.fifo_size  = 16,

.tx_loadsz  = 16,

.fcr= UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10,

.flags  = UART_CAP_FIFO,

--
Agava Design Bureau
620026, Russia, 620026, Yekaterinburg, Bazhova str. 174
tel./fax. +7 (343) 262-92-76, 262-92-78, 262-92-87
http://kb-agava.ru

___
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev


Re: [uClinux-dev] Re: how to decrease serial port tx latency? (Alexey Goncharov)

2010-07-13 Thread Lennart Sorensen
On Tue, Jul 13, 2010 at 06:25:23PM +0600, Alexey Goncharov wrote:
>> I wonder if the port is using the irq or polling?  I seem to recall
>> seeing really bad serial performance when the irq wasn't setup right once.
>
> Here is some output from linux booting log:
>
> Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing isabled
> serial8250.0: ttyS0 at MMIO 0xe000c000 (irq = 6) is a 16550A
> serial8250.0: ttyS1 at MMIO 0xe001 (irq = 7) is a 16550A
> serial8250.0: ttyS2 at MMIO 0xe0078000 (irq = 28) is a 16550A
> serial8250.0: ttyS3 at MMIO 0xe007c000 (irq = 29) is a 16550A
>
> Am i right saying that irqs were installed and are being used properly  
> according to the log above? The crystal which I am using is lpc2468 with  
> the following definitions from 8250.c:

No.  That just says what it thinks is right.

>   [PORT_16650] = {
>
>   .name   = "ST16650",
>
>   .fifo_size  = 1,
>
>   .tx_loadsz  = 1,
>
>   .flags  = UART_CAP_FIFO | UART_CAP_EFR |
>   UART_CAP_SLEEP,

If you want to know, check /proc/interrupts and make sure the count is
going up on the serial port you are using.

By the way, why would a 16650 have a fifo size of 1?  That would give
really awful performance.  16550's have fifo sizes of 16.  I thought
16650's were at least that and usually bigger.

-- 
Len Sorensen
___
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev


Re: [uClinux-dev] Re: how to decrease serial port tx latency? (Alexey Goncharov)

2010-07-13 Thread Alexey Goncharov

I wonder if the port is using the irq or polling?  I seem to recall
seeing really bad serial performance when the irq wasn't setup right once.


Here is some output from linux booting log:

Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing isabled
serial8250.0: ttyS0 at MMIO 0xe000c000 (irq = 6) is a 16550A
serial8250.0: ttyS1 at MMIO 0xe001 (irq = 7) is a 16550A
serial8250.0: ttyS2 at MMIO 0xe0078000 (irq = 28) is a 16550A
serial8250.0: ttyS3 at MMIO 0xe007c000 (irq = 29) is a 16550A

Am i right saying that irqs were installed and are being used properly 
according to the log above? The crystal which I am using is lpc2468 with 
the following definitions from 8250.c:


[PORT_16650] = {

.name   = "ST16650",

.fifo_size  = 1,

.tx_loadsz  = 1,

.flags  = UART_CAP_FIFO | UART_CAP_EFR |
  UART_CAP_SLEEP,


___
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev


Re: [uClinux-dev] Re: how to decrease serial port tx latency? (Alexey Goncharov)

2010-07-08 Thread Алексей Гончаров

Not sure if it applies here, but I use a utility called "setserial" to
set the "low_latency" flag on the port.


I've heard about this setting and used the following code to adjust it:

ioctl( ttyfd, TIOCGSERIAL, &ser );
ser.flags |= ASYNC_LOW_LATENCY;
ioctl( ttyfd, TIOCSSERIAL, &ser );

Is it right or how can it be setup in a proper way?


I also build my kernel with a
1000hz tick rate. It seems to reduce some of the latency,


How can changing of tick rate affect to the whole system? Ethernet, USB, 
framebuffer? These subsystems work just fine.



but I have never seen it as high as what you are seeing.


Unfortunately, it's not only me. I talked to one guy yesterday, he uses 
2.6.24 kernel and suffers from the same issue.

___
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev


Re: [uClinux-dev] Re: how to decrease serial port tx latency? (Alexey Goncharov)

2010-07-08 Thread Lennart Sorensen
On Thu, Jul 08, 2010 at 11:46:51AM -0500, Mark Schank wrote:
> Not sure if it applies here, but I use a utility called "setserial" to  
> set the "low_latency" flag on the port. I also build my kernel with a  
> 1000hz tick rate. It seems to reduce some of the latency, but I have  
> never seen it as high as what you are seeing.

I wonder if the port is using the irq or polling?  I seem to recall
seeing really bad serial performance when the irq wasn't setup right once.

-- 
Len Sorensen
___
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev