ArduinoISP - Crystal

Hi guys!

Well, this is my first post. I've turned my Arduino Duemilanove into an ISP thanks to this tutorial. After that I've managed to program an ATmega8 using avrdude-gui, which is on a breadboard (tutorial). I've used a 16MHz crystal.

So the question is: can I use some other crystal, e.g. a 12 MHz one while programing? Won't this ruin any kind of synchronization between my Arduino and the programmed AVR?

Thanks in advance!

I think you probably can, the SPI clock frequency isn't directly dependent on system clock frequency. For example, ATmega328s come from the factory set to run on the internal oscillator at 8MHz, and which is then further divided by 8 to provide a 1MHz system clock. So if I'm programming a brand-new chip, even if I connect a crystal, it wouldn't be used. During programming I may reset the fuse bits to use an external crystal. This is what the Arduino IDE does when used to burn a bootloader.

However, if you intend to use the Arduino bootloader, a 12MHz crystal will cause issues uploading sketches.

Using a different frequency crystal shouldn't cause any problems when programming, however some parts of the Arduino library (e.g. delayMicroseconds) may not work well at unusual frequencies, especially frequencies that are not sub-mutiples of 16MHz. 8MHz is OK - I used it in a recent battery powered design to reduce power consumption.

You can use any frequency you want to if you don't care about serial communications and whether millis/micros return (and delay for) then normal time period.
SPI has it's own clock like mentioned above, it should work fine.

I've spent a good bit of time running attiny85s at 6.49MHz for a project. Millis/micros/delay are out to lunch, but everything functions just fine.

Serial communications (including uploading via the bootloader) won't work though.

Thanks! :slight_smile: