[En-Nut-Discussion] Bug in half duplex mode
Andrej Taran
fant at vinnitsa.com
Fri Aug 25 12:27:58 CEST 2006
Hi all
Another bug in half duplex mode in file usartavr.c.
At uart speed 115200 and CPU_FREQ = 7,3728 MHz some bytes transmit not
correct.
The solve this problem.
1. In AvrUsartTxStart delete control of UART_HDX_BIT:
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);
}
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);
...
Regards,
Andrej Taran
More information about the En-Nut-Discussion
mailing list