go_away

Author Topic: Use external Crystal for AT Mega 8 AVR  (Read 3286 times)

0 Members and 1 Guest are viewing this topic.

Offline HDL_CinC_DragonTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,261
  • Helpful? 5
Use external Crystal for AT Mega 8 AVR
« 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?
United States Marine Corps
Infantry
Returns to society: 2014JAN11

Offline hazzer123

  • Supreme Robot
  • *****
  • Posts: 460
  • Helpful? 3
Re: Use external Crystal for AT Mega 8 AVR
« Reply #1 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

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.
Imperial College Robotics Society
www.icrobotics.co.uk

Offline Tsukubadaisei

  • Robot Overlord
  • ****
  • Posts: 293
  • Helpful? 0
Re: Use external Crystal for AT Mega 8 AVR
« Reply #2 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
A.I.(yes those are my initials)

Offline rgcustodio

  • Robot Overlord
  • ****
  • Posts: 217
  • Helpful? 0
  • Use "Search" and ye might find answers!
Re: Use external Crystal for AT Mega 8 AVR
« Reply #3 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.
The best thing one can do when it's raining is to let it rain. - H. W. Longfellow

understanding is the path to enlightenment

Offline HDL_CinC_DragonTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,261
  • Helpful? 5
Re: Use external Crystal for AT Mega 8 AVR
« Reply #4 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 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!
United States Marine Corps
Infantry
Returns to society: 2014JAN11

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Use external Crystal for AT Mega 8 AVR
« Reply #5 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.
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

 


Get Your Ad Here

data_list