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 imple


From: Dave Hylands
Subject: Re: [avr-chat] UART half-duplex link, ignoring echo : how best to implement it ?
Date: Tue, 10 Feb 2009 07:40:41 -0800

Hi Vince,

> I am having to communicate with a serial device on a half-duplex link.
> I am in the middle of implemeting the protocol to chat with said device,
>  and have reached the point where I have to choose the best
> way to ignore the echo that gets back to me every time I send something
> trough the UART. My answer is: I don't know !
> I do have a few ideas of course, listed below, but I don't know which
> one actually would work best, would the most reliable, in the real
> world, so I am asking the pros who know this (I feel, very classical)
> problem inside out, to share their experience ! :-)  Maybe there is a
> fourth option I have not even thought of ?
>
> The options I thought of:
>
> #1 Disabling the RXD interrupt just before sending data, and re-enable
> it as soon as the last byte has been fully sent out.
> Might have to flush the receive buffer too, since it will contain the
> last byte sent, which I want to ignore.
>
> #2 Same as above but disable the UART Receiver altogether. Shouldn't
> require to flush the RX buffer since it was not active while sending.
> But when the Receiver will be re-enabled, will it do so "cleanly", or
> is there a chance the next byte I receive might be mis-read, this makes
> me feel uncomfortable so I prefer option #1

I've done this before with the bioloid bus, which transmits at 1
MegaBuad and has the external Rx hardwired to Tx. You can see my code
over here:
<http://websvn.hylands.org/> Click on Projects, common, avr, bioloid-uart.c

If the CFG_BLD_UART0_RCV_TX option is set to 0, then the Receiver is
disabled, as well as the interrupt.

It seems to work well and has been tested on ATMeag8, 168, and 128.

-- 
Dave Hylands
Shuswap, BC, Canada
http://www.DaveHylands.com/




reply via email to

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