Max Clock Speed of Arduino

Does anybody know the maximum frequency an Arduino can be safely and reliably run at? Thanks.

Does anybody know the maximum frequency an Arduino can be safely and reliably run at?

It depends on the particular Arduino variant that you're using; each is designed to run at a particular frequency and you can't vary that without also changing the code that deals with the serial port, timing functions, etc. It can be done but it's not particularly easy. I would say that you shouldn't plan to change the frequency unless you're very experienced with programming AVR chips.

The AVR microcontroller used has a max specified speed of 20MHz at 5V, and somewhat less at the voltage goes down.
That's the specification. You MIGHT be successful running at a higher clock speed...
you will have to go to some effort to get the arduino software to work correctly at speeds other than 8 or 16MHz...

Why do the Arduino's with the 20MHz chips not run at 20MHz?

Because many of the arduino functions control real time events, the underlying code is dependant on the chips clock speed. As westfw says, changing the low level code to a new clock speed is not an easy task, and although it would be nice to have, for most applications 16mhz may be fast enough.

FWIW, its been my experience that the performance of software is often affected much more by how the code is written than the speed of the clock. If performance is critical to your application, writing speed efficient code could bring much greater benefits than increasing the clock speed by 25%.

Was your question prompted by curiosity or is there something that you want to do that needs 25% faster performance?

Why do the Arduino's with the 20MHz chips not run at 20MHz?

Because the original Arduino used an ATmega8 with a max clock speed of 16MHz. There is a significant amount of effort invested in the code, much of which is time/clock frequency dependent, so they made the decision to leave it at 16MHz when the system was upgraded to the ATmega168.

Arduino systems are rarely compute-bound, and as mem points out when they are compute-bound some coding changes will usually make more difference than throwing more clock speed at it.

-j

So basically, if I'm reading everything right, the Atmega168 has a max clock frequency of 20MHz with some register modifications. Does anybody know what will happen if I exceed this frequency? The reason I ask is not because I am trying to run more instructions in a given period of time. I have a bunch of what I believe to be ceramic resonators that I have no clue about the frequency (Google turns up nothing). I would like to use these in a standalone setup but I don't know what frequency they run at.

Hi adclark, perhaps the arduino forum is not the best place for information on overclocking the ATmega168 chip. The Arduino approach tends to trade off performance in order to make computing simpler. It sounds like you want to wrestle with the complexity of modifying lots of low level code to try and make it work at higher clock speeds and a forum like avrfreaks is perhaps a more likely place to find this information: http://www.avrfreaks.net/index.php?name=PNphpBB2&file=index

But if getting more performance is the goal (rather than the intellectual challenge of seeing how fast the chip will run) then you could look at using some of the low level techniques that the arduino abstracts, like direct port io. For example, you can pulse a pin 40 times faster by directly manipulating the io ports than by using digitalWrite. But this comes at a cost: a little more complexity, a little less compatibility across chips, and code that is not as sharable among the arduino community. Avrfreaks is also a good place for discussions maximizing performance using direct port io.

IMO, learning programming techniques to make your code more efficient is a more productive way to get more performance. Particularly if you don't want to give up the benefits that the arduino environment provides.

A big problem with overclocking is that it what may work one day may not work the next, or on the next chip. And perhaps not the most helpful, but the best advice I have heard on overclocking is that if you don't know how to do it, you probably shouldn't.

Dive under the covers if that's where your curiosity takes you, but be prepared for a steep learning curve.

I have a bunch of what I believe to be ceramic resonators that I have no clue about the frequency (Google turns up nothing). I would like to use these in a standalone setup but I don't know what frequency they run at.

Sounds like you need a simple driver circuit and an oscilloscope or frequency counter. You can't make effective use of any clock source with the ATmega if you don't know what the frequency is.

-j