Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: corrado33 on July 04, 2011, 06:51:57 PM

Title: External Crystal vs. External (Crystal) Oscillator
Post by: corrado33 on July 04, 2011, 06:51:57 PM
Ugh, I had a post written up but some website crashed my browser!!  :'(

Anyway, I'm trying to learn about other clock sources for MCUs.  Looking at the AtMega8 datasheet it says it can use a couple of different external sources including an external crystal/cermanic resonator, an external low freq crystal (32.### hz watch crystal), an external oscillator, and an external clock.

I know the difference between the crystal alone and the oscillator is that the oscillator is a crystal with the electronics to make it oscillate included.

BUT, I can use both on (let's just be specific here, it's easier) an AtMega8?  The crystal would require a few external caps (looking at the datasheet), while the oscillator would require a cap and a resistor.  The external clock option would require no external anything(wow awesome grammar there), just hook it up to one of the pins.  

So.... (trying to remember why I started this thread again...).... what's the best choice?  Does it really matter?  I'm guessing messing with external clock sources could easily brick the MCU, right?  Meaning if I set it up wrong I won't be able to fix it?  

I know I probably won't use this info any time soon (unless I build some kind of EZ-wakeup device that shines LEDs on my face), but I'm just trying to educate myself for future reference.   ;D
Title: Re: External Crystal vs. External (Crystal) Oscillator
Post by: Soeren on July 05, 2011, 08:33:52 AM
Hi,

[...] while the oscillator would require a cap and a resistor.  
No, it's plug 'n pray, all contained.


The external clock option would require no external anything(wow awesome grammar there), just hook it up to one of the pins.  
I guess you meant "internal" here?
Internal clocks doesn't need to be "hooked up"
External clock are precisely that - the clock could come from a canned x-tal oscillator, a 555, another controller, if you want to synch them or whatever else gives a pulse within the defined range - A pushbutton and a resistor could be used for clock (if you have more time than most  ;D)


So.... (trying to remember why I started this thread again...).... what's the best choice?  Does it really matter?  I'm guessing messing with external clock sources could easily brick the MCU, right?  Meaning if I set it up wrong I won't be able to fix it?  
There's no single "Best Choice" without knowing the specifics of where the controller is gonna serve its purpose.
Some apps demands a very precise timing, while others are very lax on that. Some apps need the lowest possible power consumption.


The "how to clock" question needs to take the application into account, so you just need to know the characteristics of each.

X-tal or x-tal oscillators are needed when timing must be precise (higher frequency means higher current consumption). X-tals are vulnerable to shock and vibration, which you need to address in a mobile application.

Ceramic Resonators are sort of in-between x-tals and RC's in precision. They're slightly cheaper than x-tals, more rugged, but not invulnerable. The 3 pin devices doesn't need the 2 extra caps as the 2 pin variety does.

Internal RC are low precision (around 1%) and while in PIC's, they can be tuned for frequency, I'm not sure how it is with AVRs.

External RC is just like internal, just with extra components/pins used and the possibility to select a wide range of frequencies. They may be a bit looser in precision, depending on how they're made.

External clock is a very open ended use, as you make an oscillator to drive the Clock_in and this can be made precise or not, can be used to drive several controllers working in perfect synch, can use any technology (as long as the clock input sees the correct voltages and rise/fall times). The downside is that it complicates a design and takes up more real estate on the PCB.


Knowing what you want to do with the circuit, the above should help you make decisions on the clock.
Title: Re: External Crystal vs. External (Crystal) Oscillator
Post by: corrado33 on July 05, 2011, 02:36:10 PM
Thanks Soeren.  I really appreciate it.  Your post made everything perfectly clear.