Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: Another push here... Serial on ATmega128

2005-07-06 by Alex De Lara

--- In AVR-Chat@yahoogroups.com, Dave VanHorn <dvanhorn@d...> wrote:
> >Also, does the baud rate prescaler use the system clock
> >(internally) by default ?  Is that correct ?
> >(meaning I should  not have to mess up with the fuses -CKSEL-
> >currently 0001 - also tried 0100 - both for the internal
> >calibrated osc).
> 
> A couple of things to be aware of:
> 
> You definitely want the CKOPT fuse checked, in 
> the studio  programmer.
> Otherwise, you have selected "vittoz" mode oscillator, which 
> has low amplitude, and can cause odd timing results, wrong 

I noticed this information on the datasheet as I wasn't really
willing to make any changes on this. So CKOPT is ON.

> If you do a reboot in your code, do it through the WDT.

So far, I'm just using the "push-button" to force the
hard reset. For all God's hardware designs, it should do ;-)

> Do not push  zeroes and do a return.

Though this is a cute trick, I never used it before
(maybe because I could use PCHL on 8085 or EX PC, HL on Z80 grin :-)

> I forgot about this little nugget a couple days ago, and was 
> wondering why my uart wasn't sending anything even though 
> it was set up correctly.
> A hardware reset gets to parts of the chip that you can't get 
> to by software.

Absolutely. And the WDT is excellent for this purpose.
(Well.. that's what is in there for)

> Yes, the default prescaler source is the internal CPU clock, 
> which is the crystal, resonator, or whatever you have selected.

I did not try to select anything special, other than the xtal,
after all, it's already there and I never had any problem in
the past using crystals.

> Crystals are accurate enough for serial work. Most resonators 
> are as well. The internal RC or external RC is not, except 
> under special conditions.

I'll take note of this. Thanks.

> It sounds like you're trying to use the internal RC for 
> serial which will bring misery, because it will almost work. 

I'm already feeling miserable !
Shoot !!! Just checked the CKSEL table on the datasheet 
and 0100 - 0001 does actually select "Calibrated internal 
RC oscilattor" 
Hmm... after a few paragraphs it actually says it ships
with 0001 (the internal rc thing) where I though the default
would be the crystal.
I will test the new settings (1111) tonite. Thanks for the hint !

So, basically just checking 
1) Setting CKOPT on
2) Setting CKSEL 1111
3) Programming the baud rate
4) Enabling TX/RX 
Should get it (finally and hopefulle) going....

Thanks for the pointers. It's always very interesting and
entertaining to hear for others.

-Alex

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.