[En-Nut-Discussion] Bug in half duplex mode
Henrik Maier
hmlists at focus-sw.com
Mon Aug 28 02:25:19 CEST 2006
Thank you for publishing your findings. I have a few questions though.
Andrej Taran wrote:
> static void AvrUsartTxStart(void)
> {
> //#ifdef UART_HDX_BIT
> // if (hdx_control) {
> // /* Enable half duplex transmitter. */
> // UART_HDX_TX(UART_HDX_PORT, UART_HDX_BIT);
> // }
> //#endif
> /* Enable transmit interrupts. */
> sbi(UCSRnB, UDRIE);
I would expect this could stay as it is. Can't see anything wrong with
this. If there is a reason to move the half-duplex control to
AvrUsartTxEmpty, can you please explain?
> 2. And add control of UART_HDX_BIT in AvrUsartTxEmpty:
>
> ...
> #ifdef UART_HDX_BIT
> if (hdx_control) {
> /* Enable half duplex transmitter. */
> UART_HDX_TX(UART_HDX_PORT, UART_HDX_BIT);
> sbi(UCSRnA, TXC); /* clear TXC bit, it is very important */
> }
> #endif
> /*
> * Start transmission of the next character.
> */
> outb(UDRn, *cp);
>
> ...
In normal situations TXC is cleared by it's interrupt handler. Why do
does it need to be cleared here as well?
Henrik
http://www.proconx.com
More information about the En-Nut-Discussion
mailing list