Go Down

Topic: Arduino crystal freq. Why 16Mhz instead of 20Mhz? (Read 1 time) previous topic - next topic

jcgalvezv

I was asking myself why Arduino runs at 16Mhz instead of 20Mhz? if both ATmega8 and ATmega168 support 20Mhz.

I don't need to change anything. It is just my curiosity.

kg4wsv

Quote
if both ATmega8 and ATmega168 support 20Mhz

They don't - the original Arduino was based on the ATmega8, which has a max frequency of 16MHz.  There is lots of timing code built around that frequency, and 16MHz is plenty fast enough for most folks, so it has stayed.

With the "boards" configuration file now available, it would be fairly easy to convert a mega168 board to 20MHz.

Hmm, does the bootloader have to be recompiled for clock changes?  It may not be quite as simple as a crystal swap and editing a text file.

-j


jcgalvezv

Quote

They don't - the original Arduino was based on the ATmega8, which has a max frequency of 16MHz.

Sorry about that mistake. You are right. ATmega8 is 16Mhz maximum.

So, there is no reason other than compatibility with ATmega8. Wouldn't be better to run Arduino at 20Mhz. 20% increase in speed. Wouldn't be any issues with Software Serial or anything else with this increase in speed?

kg4wsv

#3
Aug 15, 2008, 01:52 pm Last Edit: Aug 15, 2008, 01:53 pm by kg4wsv Reason: 1
Quote
Wouldn't be any issues with Software Serial or anything else with this increase in speed?

Yes.  UART timing, delay(), delayMilliseconds() and millis() timing, as well as the bootloader I mentioned before.

The bootloader is the showstopper, as it requires a hardware programmer to change it.  One of the big attractions of the Arduino is that you don't need the external hardware programmer, and I would guess most Arduino users don't have one.  Combine this with the fact that most folks don't need the extra speed, and you just don't see a lot of interest in changing the clock rate.

There's a 20MHz bootloader out there, and programmers of varying cost.  If you really need 20MHz it's within reach.

-j


jcgalvezv

I guess my initial question is going the wrong way. I just wanted to know why Arduino creators preferred to run Arduino at 16Mhz instead of 20Mhz if the device can do 20Mhz. That is it.

Quote
Quote
Wouldn't be any issues with Software Serial or anything else with this increase in speed?

Yes.  UART timing, delay(), delayMilliseconds() and millis() timing, as well as the bootloader I mentioned before.


I know that if we want to run it at 20Mhz there are changes to do, starting with bootloader and following with some includes and libraries. Obviously we are not going to make changes that will create incompatibilities and make the Arduino useless.

Quote
The bootloader is the showstopper, as it requires a hardware programmer to change it.

Not at all. You can use Parallel Programmer to burn the bootloader.

Quote
There's a 20MHz bootloader out there, and programmers of varying cost.  If you really need 20MHz it's within reach.

As I wrote in my initial post, I don't want to change anything.

DMan

I think the reason is to allow for backward/forward compatibility with ATmega chips, for example the ATmega 328 is coming out soon (out already maybe?) and that can be dropped into an Arduino since it's compatible.

So in order to keep everything compatible, they left the clock frequency at 16Mhz. That way, all ATmega chips in the same family will work with it.

Go Up