Page 1 of 1

Changing Clock Speeds

Posted: Sat Nov 07, 2009 10:31 am
by Alan Chatham
So this is probably a dumb question, but is there something more you have to do to use a different clock speed than just redefine the F_CPU and USB_CFG_CLOCK_KHZ values to reflect your new clock speed?

I've been working on a project with a 16mHz external clock chip. I'm trying to make more of them, but all I have is 20mHz clock chips. My code works just fine with the 16mHz chips. However, when I plug in a 20mHz clock, make clean, modify the F_CPU and CLOCK_KHZ values in usb-config.h, and recompile, the device is no longer recognized by Windows. Is there something else I have to change, or should I just order some more 16mHz chips? I'm currently running on an ATMega168 at 5v, with 3.6v zener diodes dropping the USB line voltage.

Thanks,
Alan Chatham

Re: Changing Clock Speeds

Posted: Sun Nov 08, 2009 12:07 am
by Saimon
See datashhet to ATmega168. 20 MHz clock rate may be possible at voltage more than 5 V. Try to use self-power device at ~6 V, try to use other MCU, use stable V-USB lib drivers.
Best regards, Saimon.

Re: Changing Clock Speeds

Posted: Tue Nov 10, 2009 12:17 pm
by christian
These two defines should be all you need to change. And then you need to do a "make clean" because there are no dependencies on usbconfig.h and Makefile.

AVRs can usually be overclocked quite a bit, so I doubt that it's a hardware problem. I've tested the 20 MHz module myself and it worked for me (still works in one of my projects).