avr-chat
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-chat] Trouble with USART0 on ATmega644A


From: Bill Rochat
Subject: Re: [avr-chat] Trouble with USART0 on ATmega644A
Date: Thu, 6 Jan 2011 09:17:14 -0800

Hi Rick,

A couple of possibilities:

Besides defaulting to 8MHz, the factory default 'divide by 8' is set, so unless you set the fuses, the part is running at 1MHz.

At 8MHz, the best baud rate accuracy you can get is -3.5% on 2x operaion, which is very marginal to say the least.  Also, the 8MHz internal oscillator will not be exact, and may be off 1.5% give or take.  

Your best bet without any fuse changes would be to set the Baud rate to 4800 or less.  If you change the fuses to run at 8MHz, the stay at 38,600 Baud or less.

Bill Rochat
R&R Technologies, Inc.

On Wed, Jan 5, 2011 at 11:41 PM, Rick Mann <address@hidden> wrote:
Hrm, I had the ATmega32A working just fine. But on the 644A I can't seem to pin down the baud rate (or something else is wrong). According to the docs, the '644A defaults to internal RC at 8 MHz. So, I've tried a number of variations of settings, with U2X0 set and clear. Here's the latest:

#define F_CPU                   8000000UL
#define UART_BAUD               115200

{
   UBRR0 = 8;  //  3;  //  (F_CPU / (16UL * UART_BAUD)) - 1;
   UCSR0A = 0 << U2X0;
   UCSR0B =      1 << RXEN0
               | 1 << TXEN0
               | 1 << RXCIE0;
   UCSR0C =      0x0 << UMSEL00        //  Async USART
               | 0x0 << UPM00          //  No parity
               | 0 << USBS0            //  1 stop bit
               | 0x3 << UCSZ00;        //  8-bit
}


But I get varying forms of gibberish characteristic of baud rate mismatches.

Any suggestions?

TIA,
Rick


_______________________________________________
AVR-chat mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-chat


reply via email to

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