Other microprocessors supported by Arduino

I am wondering are there any other ATmega processors that run faster than 16Mhz? I have heard of some like the AT90pwm. A faster clock would allow me to have a faster pwm frequency when I write my own function. If there is one, are there any Arduino boards similar to the Duemilanove for easy programming?

The Mega328 in my Duemilanove can run at 20 MHz.

I have heard of some like the AT90pwm

I believe the AT90PWM is limited to 16MHz max (vs AtMega at 20MHz) so it may no help much in terms of PWM frequency.

Through low level programming, you can change PWM frequency from around 500Hz to as much as 32kHz on a 16MHz Arduino. If you need more than that, you can trade an increase in PWM frequency against reduced resolution. With 128 steps (as opposed to 256), you get 64kHz, 64 steps will give you 128kHz.

If you need even higher frequencies, you may look at interfacing an external dedicated PWM controller.

I already do low-level programming to get 12 bit resolution. This sets my pwm frequency to 3.9khz

Can the ATmega328 function properly with a 20Mhz clock crystal? Right now I am using a 16Mhz.

Here is a video of the uP, using a PWM control signal, varying the VCO input of a PLL to control the inverter frequency.

Here is a tutorial of how I built the unit. It includes theory and practical information


Impressive project!

Can the ATmega328 function properly with a 20Mhz clock crystal? Right now I am using a 16Mhz.

Yes! This would take you up to about 4.88kHz with 12bit resolution.

It involves uploading a new bootloader and changing the board definition to reflect the new crystal frequency, but that's about it (besides replacing the crystal on your board).

BenF, you have piqued my interest. My project just uses the ATmeg328. I run the chip with a 16mhz crystal and the necessary power and ground leads - that is all. What do I have to do, or where can I read about what specifically needs to be done?


You need to get a 20mhz crystal of course, and you need to get an ISP programmer such as http://www.sparkfun.com/commerce/product_info.php?products_id=9231

Then you need to modify the bootloader make file to generate a bootloader set to 20 mhz. If you dont know how to do this, I can do it for you.

Then you burn the new bootloader using the ISP programmer and the BURN BOOTLOADER command from the Arduino tools menu.

Then you need to make a new entry in boards.txt that has the 20mhz cpu clock (you want to keep the old one to be able to compile other boards)

Replace the 16mhz crystal with your 20 mhz crystal

And you are all done.


Our Gator board runs at 20 MHz with the ATmega324P and can be programmed with the standard Arduino environment.

-- Check out our new shield: http://www.ruggedcircuits.com/html/gadget_shield.html

RuggedCircuits, I am glad your a active and helpful member of this community or else I might have issue with that promotion ;)

Ok. The bootloader allows me to upload my sketches without an ISP. I can see that the duemilenova runs off a 16mhz clock. I don't want to change this because it is really easy to use.

Can I now take this atmega328 and insert it into my project to using a 20mhz crystal, or will the faster clock cause the existing bootloader to freeze? If I understand correctly, when the chip powers up and resets, the bootloader runs first and then calls the last uploaded sketch.

In order to download sketches using the AVR's UART, the bootloader has to know the the clock speed that the CPU is running at, so that it can set the correct divisors to get the expected bit rate on the serial port. This is the ONLY critical timing issue in the bootloader that is dependent on the clock rate.

If you download your sketch (using the bootloader) to the 328 in a board that runs at 16MHz, and then move the 328 into a board that runs at 20Mhz (but you no longer care to use the bootloader), it should work fine.

What westfw describes is something I do regularly. Note that - when downloading - you have to select the board definition of the FINAL target, ie. 20MHz. otherwise you would get a binary with wrong timing in the target (this has nothing to do with the bootloader!)

The modification in the boards.txt is e.g.

atmega328_20.name=20MHz atmega328_20.upload.protocol=stk500 atmega328_20.upload.maximum_size=30720 atmega328_20.upload.speed=57600 atmega328_20.build.mcu=atmega328p atmega328_20.build.f_cpu=20000000L atmega328_20.build.core=arduino

That code will also run on the 16MHz Arduino, but now there with wrong timing.

Note: When you do not need to flash your chip in the 20MHz environment you of course can (and have to!) keep the original 16MHz boootloader!

If you want to buy an ISP programmer anyway, you can also programm the Chip via ISP without the need for the serial connection; but note that the SPI lines will be in use then

mega48.name=ATmega48 mega48.upload.protocol=usbasp mega48.upload.maximum_size=4096 mega48.upload.speed=19200 mega48.upload.using=USBasp mega48.build.mcu=atmega48 mega48.build.f_cpu=8000000L mega48.build.core=arduino