Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: HDL_CinC_Dragon on August 06, 2007, 10:26:54 PM

Title: Use external Crystal for AT Mega 8 AVR
Post by: HDL_CinC_Dragon on August 06, 2007, 10:26:54 PM
My Mega8 is 16MHz. Ive got a 20MHz crystal laying around. Is there a way that I can have my Mega8 use that 20MHz crystal instead of its own internal 16MHz resonator?
If yes, how do I go about setting this up?


And also, is there any sort of limit as to what Hz crystal I would be able to use? For instance if got lucky and found like a 1GHz Crystal :o, could I use that?


... And I guess more importantly, is there a real advantage to upping the processing speed? Im guessing that I would simply be able to read in sensor data faster and make a faster decision based on that and all that right?
Title: Re: Use external Crystal for AT Mega 8 AVR
Post by: hazzer123 on August 07, 2007, 02:04:14 AM
This will be interesting for you - http://www.sparkfun.com/commerce/present.php?p=Overclocking%20a%20PIC (http://www.sparkfun.com/commerce/present.php?p=Overclocking%20a%20PIC)

Yeah the advantage is the processing speed, but you won't be able to read analogue sensor signals any faster. Another disadvantage is the power consumed increases with the clock speed.
Title: Re: Use external Crystal for AT Mega 8 AVR
Post by: Tsukubadaisei on August 07, 2007, 07:43:47 AM
Yeah the advantage is the processing speed, but you won't be able to read analogue sensor signals any faster. Another disadvantage is the power consumed increases with the clock speed.

I burned a microcontroller once. It was an H8/3048. 25MHz->200MHz=boom
Title: Re: Use external Crystal for AT Mega 8 AVR
Post by: rgcustodio on August 07, 2007, 11:12:09 AM
Start on Page 23 of the ATmega 8 data sheet. This section shows how one can connect an external oscillator to the MCU.

I doub't if it'll work reliably. The key work here is reliability. You might be able to read I/O faster but are you reading the correct results? AFAIK, the ATMega 8 registers and fuse bits (CKSEL, OSCCAL, etc) doesn't those clock rates so timings might actually go awry, ie UART, SPI might go out of whack.
Title: Re: Use external Crystal for AT Mega 8 AVR
Post by: HDL_CinC_Dragon on August 07, 2007, 05:21:49 PM
Thanks for the help guys =)

@ Hazzer
Thanks for the link. Helped BIG TIME! =)

@ Tsukubadaisei
Thanks for the warning =)

@ Rgcustudio
Thats for the advice! I checked it out out DataSheetCatalog.com (http://www.datasheetcatalog.com/datasheets_pdf/A/T/M/E/ATMEGA8-16PC.shtml) and it told me everything id need to know.


Ive decided not to install an external crystal as im not yet advanced enough to utilize it properly just yet but at least now I know what I need to know regarding that sort of thing :)


Thanks guys!
Title: Re: Use external Crystal for AT Mega 8 AVR
Post by: Soeren on August 07, 2007, 05:25:56 PM
Hi,

My Mega8 is 16MHz. Ive got a 20MHz crystal laying around. Is there a way that I can have my Mega8 use that 20MHz crystal instead of its own internal 16MHz resonator?
Oh, it's only a 20% increase. I guess that it would work with some specimens and not with others.

Quote
If yes, how do I go about setting this up?
Like if it was 16MHz.

Quote
And also, is there any sort of limit as to what Hz crystal I would be able to use?
Yes

Quote
For instance if got lucky and found like a 1GHz Crystal :o, could I use that?
Finding a 1GHz X-tal wouldn't take luck, but rather a very powerfull improbability field ;)
For X-tal work on much less than half of that, a PLL with dividers has to be used, since it's impossible to grind an X-tal so thin that it would swing at that high frequencies.

Quote
... And I guess more importantly, is there a real advantage to upping the processing speed?
Any over-clocker would say yes. somewhat higher speed, but on the downside, anyone with half a deck would mumble "much higher temperatures and current consumption" as a very direct consequence.

Quote
Im guessing that I would simply be able to read in sensor data faster and make a faster decision based on that and all that right?
Read speed would depend on what your sensor can handle in quite a number of sensor apps. But you would get higher execution speed (in more than one meaning of that term ;))

If you wanna speed up, go with a faster processor, or to start with, optimize your algos.