Re: Linux serial port dropping bytes
- From: Robert Adsett <sub2@xxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 2 Apr 2008 20:58:12 -0500
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
.
- References:
- Linux serial port dropping bytes
- From: Derek Young
- Re: Linux serial port dropping bytes
- From: CBFalconer
- Re: Linux serial port dropping bytes
- From: Grant Edwards
- Re: Linux serial port dropping bytes
- From: CBFalconer
- Re: Linux serial port dropping bytes
- From: Grant Edwards
- Re: Linux serial port dropping bytes
- From: CBFalconer
- Re: Linux serial port dropping bytes
- From: David Brown
- Re: Linux serial port dropping bytes
- From: CBFalconer
- Re: Linux serial port dropping bytes
- From: David Brown
- Linux serial port dropping bytes
- Prev by Date: Re: reading in data from rs232 port, require to resend as an email
- Next by Date: Re: Linux serial port dropping bytes
- Previous by thread: Re: Linux serial port dropping bytes
- Next by thread: Re: Linux serial port dropping bytes
- Index(es):
Relevant Pages
|