Clock Freq = 20MHz with ATmega168?

I'm throwing together a barebones using an ATmega168 on a breadboard, similar to Tom Igoe's
instructions at http://www.arduino.cc/en/Main/StandaloneAssembly only without the mistakes :wink:
and modifying pins as per 168 vs his ATmega8 pinout.

I only have 20MHz xtals here at present, but the ATmega168 datasheet says that 20MHz is a valid clock
frequency (albeit the maximum)....

But all the schematics I've found show 16MHz xtals, so my question is: does the bootloader code include
clock-freq-dependent code? ie. will the code only work at 16MHz? When I reset the chip I can see
digital13 (aka pb5 aka pin19) pulsing on an LED, but the Arduino IDE doesn't see anything,

I've tried both 0007 (old-school push-the-button uploading) and 0009, in both cases pushing
the reset button, but get "programmer not responding" or similar each time.

Thanks

The bootloader needs to know the clock speed when you compile it, so you can't just take a chip from an Arduino board and run it at 20 MHz. If you recompile the bootloader for a 20 MHz clock, it should work though. There are a few things in the core code that will be a bit off (delayMicroseconds() and PWM frequency), but most things should work (including millis() and delay()).

The bootloader needs to know the clock speed when you compile it, so you can't just take a chip from an Arduino board and run it at 20 MHz. If you recompile the bootloader for a 20 MHz clock, it should work though. There are a few things in the core code that will be a bit off (delayMicroseconds() and PWM frequency), but most things should work (including millis() and delay()).

Hey, thanks for the superfast response David! Now I can stop tinkering and go and do something less futile.
(Or at least dig around and see if I can find the bloody 16MHz xtals that I'm sure ordered along with the
the ATmega168s....)

Cheers

Chris