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, [email protected] ======================================================================== Whom computers would destroy, they must first drive mad. _______________________________________________ AVR-chat mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/avr-chat
