Re: Linux serial port dropping bytes



In article <66adnW6htpJRI27aRVnygQA@xxxxxxxx>, David Brown says...
CBFalconer wrote:
<snip>
That depends on your CPU speed. Within the interrupt, you have to
handle something like:

REPEAT
test for more in FIFO
take one, stuff in buffer, while checking for buffer full.
test for overflow or other errors.
if any, call appropriate handler
UNTIL FIFO empty
clear interrupt system
rearm interrupt
exit

Note that some operations will require several accesses to the
UART. Those will eat up time. They will be much slower than
on-chip memory access.


This stuff is not magic - it's standard fare for embedded developers.
You seem determined to view the problem from the worst possible angle,
and pick the worst possible solution. You do *not* have to check for
overflows or other receive errors for each byte (buffered uarts provide
summary flags, and you would normally use higher level constructs, such
as crc checks, to check correctness on a fast link). You do *not* have
to check for space in your buffer for each byte. At the start of the
ISR, you ask the UART how many bytes are in the FIFO buffer, and you
check how much space you have in the memory buffer. That tells you how
often to execute your loop.

Of course this assumes the UART can tell you how many characters are in
the FIFO. I don't remember any of the ones I've used having that
capability (not to suggest they don't esist, just that it's not rare for
it not to be there).

Robert

--
Posted via a free Usenet account from http://www.teranews.com

.



Relevant Pages

  • Re: Developing interrupt driven serial driver
    ... My next task is to make this driver codebase interrupt driven. ... deassert CTS so that the DTE would stop sending when the FIFO is full. ... interrupt handler for the receiver put the data into a larger buffer ...
    (comp.arch.embedded)
  • Re: Interrupt driven UART
    ... think I can implement the fifo with a fixed array size of n, ... and tail index rather than pointer. ... when the buffer is non-empty and when the buffer is full. ... I'm wondering how the retransmission will occur. ...
    (comp.arch.embedded)
  • Re: Interrupt driven UART
    ... think I can implement the fifo with a fixed array size of n, ... and the receivebyte function will simply wait for the rx ready ... when the buffer is non-empty and when the buffer is full. ... I'm wondering how the retransmission will occur. ...
    (comp.arch.embedded)
  • Re: Interrupt driven UART
    ... think I can implement the fifo with a fixed array size of n, ... and the receivebyte function will simply wait for the rx ready ... when the buffer is non-empty and when the buffer is full. ... I'm wondering how the retransmission will occur. ...
    (comp.arch.embedded)
  • Re: Interrupt driven UART
    ... think I can implement the fifo with a fixed array size of n, ... The rx isr ... when the buffer is non-empty and when the buffer is full. ... I'm wondering how the retransmission will occur. ...
    (comp.arch.embedded)