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: Joerg Wunsch
Subject: Re: [avr-chat] Trouble with USART0 on ATmega644A
Date: Thu, 6 Jan 2011 20:50:06 +0100 (MET)

Bill Rochat <address@hidden> wrote:

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

That would also be my assumption.

> Your best bet without any fuse changes [...]

It's not strictly necessary to change fuse settings.  The CKDIV8 fuse
does nothing more or less but changing the clock prescaler to 8, but
you can change the clock prescaler from software at run-time:

#include <avr/power.h>

....
  clock_prescale_set(clock_div_1);

I agree, however, that trying to achieve a baud rate of 115200 with 8
MHz CPU frequency is quite beyond any guarantees, even in case the
oscillator is close to exact 8 MHz.  38400 Bd are possible with a
nominal error of 0.2 %, but anything beyond that is questionable.

What would be possible, however, is to tune the RC oscillator down to
7.37 MHz, and then get (almost) exact 115200 Bd.  This frequency is
guaranteed to be possible, but the exact OSCCAL value for this has to
be determined beforehand (and e.g. stored in EEPROM), as it will vary
from device to device.

-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)



reply via email to

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