Changing Clock Speeds

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
Alan Chatham
Rank 1
Rank 1
Posts: 28
Joined: Wed Sep 30, 2009 3:36 am
Location: Osaka, Japan
Contact:

Changing Clock Speeds

Post by Alan Chatham » Sat Nov 07, 2009 10:31 am

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

Saimon

Re: Changing Clock Speeds

Post by Saimon » Sun Nov 08, 2009 12:07 am

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.

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Re: Changing Clock Speeds

Post by christian » Tue Nov 10, 2009 12:17 pm

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).

Post Reply