Re: 2.4.18 serial drops characters with 16654

Russell King (rmk@arm.linux.org.uk)
Thu, 19 Sep 2002 19:43:09 +0100


On Thu, Sep 19, 2002 at 11:24:24AM -0700, Dan Christian wrote:
> This still isn't getting at the core problem. I'm sending data out the
> port and dropping characters. The receive works fine.
>
> It can't be a problem with the receiving device being over-run, since
> the 16550 works (even though it sends several bytes after CTS drops),
> and the 16654 doesn't (it stops after the current byte).
>
> I think that data must be lost when the receiving device drops CTS.
> Either this is a hardware flaw (and data is lost from the transmit
> FIFO), or there is some kind of race condition between the CTS drop and
> re-loading the FIFO.

Ok, it doesn't sound like FIFO underrun, but FIFO overrun. In theory,
this should never ever happen on the transmit side, however you appear
to be seeing exactly this.

The first thing I'll ask is that you check that the port is being
recognised as a ST16654 and not 16650V2. The former has 64 bytes of
FIFO, the latter has 256 bytes.

Secondly, how many characters on average do you seem to be dropping in
one go? I'm not expecting an exact figure, just a rough idea will
probably do.

Thirdly, there is a possibility here that could be causing this, and
it surrounds the following code in transmit_chars() in serial.c:

count = info->xmit_fifo_size;
do {
serial_out(info, UART_TX, info->xmit.buf[info->xmit.tail]);
info->xmit.tail = (info->xmit.tail + 1) & (SERIAL_XMIT_SIZE-1);
info->state->icount.tx++;
if (info->xmit.head == info->xmit.tail)
break;
} while (--count > 0);

We always load a full FIFO-size chunk of data into the UART whenever
it says "hey, my transmit holding register is empty" since the FIFO
should be empty. I'm wondering if the ST16654 is giving an early
indication.

Could you try changing the first line in drivers/char/serial.c to:

count = info->xmit_fifo_size / 2;

to find out whether that improves the situation? Don't worry, I don't
intend this as a fix. Its more to (dis-)prove the point.

-- 
Russell King (rmk@arm.linux.org.uk)                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/