avr-chat
[Top][All Lists]
Advanced

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

Re: [avr-chat] UART half-duplex link, ignoring echo : how best to implem


From: David Kelly
Subject: Re: [avr-chat] UART half-duplex link, ignoring echo : how best to implement it ?
Date: Tue, 10 Feb 2009 16:21:22 -0600
User-agent: Mutt/1.4.2.3i

On Tue, Feb 10, 2009 at 01:29:13PM +0100, Vincent Trouilliez wrote:
> 
> #3 Don't touch the receiver at all. Instead, before sending 'N' data
> bytes, tell the Rx ISR routine to ignore 'N' bytes, and when 'N' bytes
> have been skipped, start processing incoming bytes again.
> 
> My favorite option would be #3 because it does not "disturb" the
> Receiving part (Hardware) of the UART whatsoever, doesn't make any
> gamble on how the UART will react exaclty. So I avoid any potential
> H/W problems, glitches, race conditions, strange problems what have
> you, that could make pull my hair again.

Here is what I do:

Don't start looking for input until after the last character has cleared
the transmitter. Then reset your receiver indexes to flush the input
buffer.

If you send 10 characters you don't want to bet on receiving 10
characters before valid data. You could, but what if you get off by one?
When will it ever resync?

Would be even better yet if your receive interpreter knew what your
messages looked like, and knew what the other device's messages look
like. So it would know your messages are to be discarded as random line
noise and only act on data from the remote item.

-- 
David Kelly N4HHE, address@hidden
========================================================================
Whom computers would destroy, they must first drive mad.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]