8

I wonder why Arduino doesn't run at 20 MHz, the frequency the AVR is specified for. Now, running at 16 MHz, we're wasting 20% performance for nothing.

I don't think there are any implications when you replace the 16 MHz resonator with a 20 MHz type, with probably the sole exception for the baudrate in the bootloader. Or is there?

Does anybody know why the Arduino designers chose 16 MHz?

  • Don't forget to set the fuses when you do this – portforwardpodcast May 12 '15 at 11:52
  • 1
    @portforwardpodcast no need to change the fuses. They are already set to "Full-swing external oscillator". – Gerben May 12 '15 at 13:54
6

There's no hardware reason (as far as I'm aware) that you couldn't run a suitable Arduino at 20 MHz. You'd run into minor timing inaccuracies in software though, as the standard Arduino configuration apparently works best if the clock speed is either 8 or 16MHz.

I suspect this is largely for historical reasons. Early Arduino boards were based on chips which only went up to 16 MHz, such as the ATmega8. Using the same configuration for all chips just keeps everything a bit simpler and more consistent.

There is more information here about the timing issues: http://forum.arduino.cc/index.php?topic=158223.0#msg_1186708

  • 1
    Thanks for your answer. Can you elaborate on "exact power of 2"? The 1 second period over which clock pulses are counted doesn't mean anything to a microcontroller, it only knows clock ticks. Overmore, 16 MHz isn't an exact power of 2, that would have to be 16.777216 MHz. – Joris Groosman May 12 '15 at 11:03
  • @JorisGroosman Sorry I didn't explain that properly. It's about the way the Arduino core calculates microseconds from clock ticks. This forum topic gives a much better explanation than I could. – Peter Bloomfield May 12 '15 at 12:00
4

You can, and I do.

It's not technically an Arduino anymore, I guess. I made my own board, replacing a resonator on a board will require some fine soldering, but it is definitely possible.

There are some gotchas: Anything time-related (e.g. millis() ) will be run faster than is should - 25% more millis() per second. Also, the bootloader expects 16mhz, so you won't be able to reprogram it at this speed. I purchased a USBASP programmer - it hooks into the 2x3 pin grid on one side of the board, and lets you reprogram it without the bootloader (this is how the bootloader is put on in the first place!). You will need at least 4.5 volts at 20mhz to avoid problems, compared to 3.78 volts for 16mhz - this means batteries will drain somewhat quicker (3x1.5v batteries will run down pretty quick), and if you have any motors or other draw on the batteries, 3 1.5v batteries will probably not work even if they are fresh.

Alternatively, going in the exact opposite direction, the lower the clock speed, the less voltage is required - for some projects, you might not need the clock speed - you can go down to 1.8v running at 4mhz.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.