Overclocking Microcontrollers

We’re all familiar with overclocking desktop computers; a wonderful introduction to thermal design power and the necessities of a good CPU cooler. [Marcelo] wanted to see how far he could overclock a microcontroller – in this case an ATMega328 – and ended up with a microcontroller designed for 20 MHz running at 30 MHz.

To verify that his uC could run at higher clock speeds, [Marcelo] began his experiments by uploading a piece of code that toggled a few pins as fast as possible. He needed to upload this code with a common 16 MHz crystal – AVRDude simply won’t work when a chip is clocked at higher speeds.

After successfully demonstrating his microcontroller will turn pins on and off at 30 MHz, [Marcelo] wanted to see if he could do something useful. By editing a single setting in his Arduino boards.txt file., [Marcelo] was able to have his overclocked microcontroller read and reply to characters sent over a serial connection. It worked, demonstrating an overclocked microcontroller could be useful in some situations.

As for what [Marcelo] plans to do with his faster microcontroller, he’s thinking of improving a ATMega-powered VGA color generator. A higher clock speed means he can push more pixels out to a VGA monitor.

46 thoughts on “Overclocking Microcontrollers

    1. Best I have done is up a 486dx to 999Mhz. I was too afraid to let it run for more than 30 seconds or so. The CPU itself didn’t fail but lit some other stuff on fire and I burned myself for good measure.

        1. I smell sarcasm. Clearly you are not old enough to remember hardware overclockers that overrode the ‘turbo’ feature, most of which would let you set whatever frequency you wanted up to three digits. Stuff got lit and I had to pull my coveted overclocker off in a hurry, thus the burns.

          Technically you could attach an oscillator up to a z80 to supply 600Ghz, that does not mean it will work, just like the 486 – but ~1.5 Thz oscillators are easier to source.

          1. You mean puting your finger between contacts of rezistor on cheap clock replacement? I build small 8bit pc with z80. How i like smell of burned 8kb eeprom at the morning.

  1. isnt the ram and rom the part of the uC that doesnt allow higher clock rates than specified? i tried overclocking an atmega328 and over about 24mhz the sram cant be read back reliably.

  2. It can be handy in some situations (mostly timing related) but there is a reason why chips were rated at a certain speed. I’ve seen AVR do all sorts of crazy stuff when overclocked. They may still togle pins, but some hardware will not work properly, like the uart missing bytes. Also higher voltages allow stable operation at higher speeds.
    It’s cool for hacking purposes, but I certainly wouldn’t overclock a micro in a real product.

  3. It’s fairly well understood that the core of an AVR can be overclocked without much problem. There’s a youtube video of someone pushing one to 51mhz. Where things fail is in the ADC and EEPROM. Those components (especially the ADC) don’t like anything over 16mhz. You might be lucky to push 17 or 18mhz. A vga video generator will overclock ok, but if you have to read anything analog or persist data then you’re back to 16mhz.

    http://www.youtube.com/watch?v=gje4SvGOFuQ

      1. Spec sheets are just that: specs. The mfgrs do run tests such as OP to find a max, then a hair under, where everything works to put on the spec sheet. But you can get away with more just don’t expect things to go 100%. If you live life by what you are told, not by what you find, you will not get far.

        1. I think that he was referring to the ADC not working beyond 16MHz at the MCU. If you set the prescaler correctly it should work up to 20MHz, and by setting the prescaler higher it should give you an usable frequency for the ADC with decent precision even if the MCU is running beyond 20MHz.

      1. Indeed some 8-bit megaAVR’s are binned 20mhz speed grade (as opposed to the cheap 16mhz garden variety).. But the same limitations apply. Replace “17 to 18mhz” with “21 to 22mhz” here.. :-) .

  4. i have been doing this for years (ok just 2) on by flashy business card with a cheap MC … it was not to bad when i did it on that as i programmed it in ASM but when im doing it in c or anything of that sort i have to do all the calculations ahead of time so i know what delays, bauds, exc to use
    or use a crystal that divides evenly

  5. Most microcontrollers can be overclocked, but there’s a reason they’re only rated for a particular clock frequency range. How the chip behaves when exceeding its specifications is anyone’s guess, and can vary depending on operating conditions, production batch and phase of the moon.

    1. I assure you, if the chip exists, someone has overclocked it :) But just try it yourself and see what you find. Odds are most of it will work, but some peripherals will stop functioning sensibly sooner than others.

  6. As pointed out above, the usual warning that goes along with telling someone they can overclock a CPU is to tell the user that this may lead to a unstable operation and should never be used in a safety critical environment. We should bring out the watchdog timer tutorial and test the theoretical operating limits for each model and silicon die manufacturer.
    Hint: Generally, the CPU can be clocked way outside the specified norm as evidenced with this article.
    This is the root seed idea for a new competition.
    Please promote attribution.

  7. In my oLogic project, I overclocked a PIC18F26K20 from 16MHz xtal to 24MHz xtal, and used the internal x4 multiplier for 96MHz. The chip was speced to 64MHz. I have never had an issue doing this. I also have the overclocked chip in a comercial product, works extreamly well, and is one of my favorite chips for its speed. And yes, the PIC is 4 cycles per instruction, but its internaly 96MHz, and /4 for a 24MIPS

    Here it is in an open project:
    http://www.mculabs.com/projects/ologic1.4.html

  8. lol noone mentioned the fact that there are
    THREE DIFFERENT SPEED GRADES for AVR chips!
    (or more?)

    there are 8MHz, 16MHz, and 20MHz AVR chips.

    the 16MHz ones go to about 20 or 25MHz
    im pretty sure these are the ones used in an arduino

    and its the 20MHz one he is overclocking at 30MHz

    and i quote:
    “microcontroller designed for 20 MHz running at 30 MHz”

    1. What is your point exactly? He over clocked a chip and you seem to be mentioning that there are other chips that run at different speeds. I don’t understand your point, if there is one.

  9. I did that with an Arduino Uno to get it to use Jaromir Dvorak’s AVGA lib last year…you had to switch the 16MHz crystal in and out with the 30MHz one to for the usb to work and flash the hex…but it worked perfectly….pic on my blog of it working…

  10. Hi all,
    Everyone seems to just talk about increasing the Xtal frequency. What about increasing the voltage to the chip, let;s say 6V and superglue a small heatsink to the MCU, then put in the XTAL. This seems more the way to go, don’t you thin?

    JCooper

  11. I need to over clock a 16Mhz atmega2650 to get faster LCD screen updates. Do I just change the clock speed in the firmware or do I need to change the crystal on the circuit board as well?

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.