Pages: [1]   Go Down
Author Topic: Arduino crystal freq. Why 16Mhz instead of 20Mhz?  (Read 1160 times)
0 Members and 1 Guest are viewing this topic.
El Salvador, Central America
Offline Offline
Jr. Member
**
Karma: 0
Posts: 96
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Faraday Member
**
Karma: 7
Posts: 2526
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

El Salvador, Central America
Offline Offline
Jr. Member
**
Karma: 0
Posts: 96
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

0
Offline Offline
Faraday Member
**
Karma: 7
Posts: 2526
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

« Last Edit: August 15, 2008, 06:53:53 am by kg4wsv » Logged

El Salvador, Central America
Offline Offline
Jr. Member
**
Karma: 0
Posts: 96
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: