avr-gcc-list
[Top][All Lists]
Advanced

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

RE: [avr-gcc-list] Strangeness with UART Baud Rate


From: Ben Mann
Subject: RE: [avr-gcc-list] Strangeness with UART Baud Rate
Date: Mon, 25 Jul 2005 11:23:12 +0800

A quick thought - by default the clock on the chip is the 1MHz internal RC
oscillator. Going based on what you have described this sounds like the most
likely cause, although I'm surprised that the crystal is oscillating.

Another observation is that for 1MHz clock, 2400 requires UBRR of 25 rather
than 23 (23 gives about 12% error).

Ben

-----Original Message-----

I have an Atmel STK500 with ATMEGA16-16P1.  

 The divisor is Fosc/(16*baud)-1.  For a 3.6864Mhz xtal, this is
 3686400/16/9600-1 or a divisor of 23.

UBRRH = (BAUD >> 8);
 UBRRL = 23;

Looking at the XT1 pin on PORTE with a scope on a .05us/div time
 scale, gives 1/(5.4*.05e-6) or 3703703.7, close enoiugh to 3.6864 Mhz
 the clock is spec;d as.

 Using #define BAUD 3686400/16/9600-1 and playin with the FreeBSD
 serial port, gives a connection speed of 2400.
 
 #Using define BAUD 1000000/16/9600-1 and playin with the FreeBSD
 serial port, gives a connection speed of 9600.

So, it appears that Fosc is really 1Mhz, not 3.6764MNhz...

 Where does this come from?

tomdean








reply via email to

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