"Sid Price" wrote:

> I am working on a design using the one UART0 on a mega164p and I am having
> an issue with initialization of the UART. I notice that when I enable the TX
> a byte of all zeros is transmitted. I even see this if I assert the TX
> enable bit with the debugger. Is this normal? Is there a way to avoid it?
> Thanks,
> Sid.

I have used UART0 on both the ATmega164P and ATmega324P and never seen the
behavior you describe.  My uart init routine does the following:

    ... initialize head and tail pointers, and set baud rate

    // Enable rx, tx, and rx complete interrupt
    UCSR0B = (1<<RXCIE0)|(1<<RXEN0)|(1<<TXEN0);
    // Set async 8N1
    UCSR0C = (1<<UCSZ01)|(1<<UCSZ00);

In the UDRE interrupt routine, I assign the byte to transmit to UDR0.

-Preston




_______________________________________________
AVR-chat mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-chat

Reply via email to