aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino
diff options
context:
space:
mode:
authorDavid A. Mellis <d.mellis@arduino.cc>2012-10-18 15:03:23 -0400
committerDavid A. Mellis <d.mellis@arduino.cc>2012-10-18 15:03:23 -0400
commit69fa44473b4deea26200aab1537d39e8ffac949b (patch)
tree8ae5dc7a040d8c574664f8abcabfb5dbe27e8500 /cores/arduino
parent6d296e0faba5b9910084c307a3f93cb2653bf7f8 (diff)
Updating USB core to work at 8 MHz (different PLLCSR value).
Diffstat (limited to 'cores/arduino')
-rw-r--r--cores/arduino/USBCore.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/cores/arduino/USBCore.cpp b/cores/arduino/USBCore.cpp
index 8bcf66c..decfd6b 100644
--- a/cores/arduino/USBCore.cpp
+++ b/cores/arduino/USBCore.cpp
@@ -638,7 +638,11 @@ void USBDevice_::attach()
_usbConfiguration = 0;
UHWCON = 0x01; // power internal reg
USBCON = (1<<USBE)|(1<<FRZCLK); // clock frozen, usb enabled
+#if F_CPU == 16000000UL
PLLCSR = 0x12; // Need 16 MHz xtal
+#elif F_CPU == 8000000UL
+ PLLCSR = 0x02; // Need 8 MHz xtal
+#endif
while (!(PLLCSR & (1<<PLOCK))) // wait for lock pll
;