Skip to content

Commit 69fa444

Browse files
committed
Updating USB core to work at 8 MHz (different PLLCSR value).
1 parent 6d296e0 commit 69fa444

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cores/arduino/USBCore.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,11 @@ void USBDevice_::attach()
638638
_usbConfiguration = 0;
639639
UHWCON = 0x01; // power internal reg
640640
USBCON = (1<<USBE)|(1<<FRZCLK); // clock frozen, usb enabled
641+
#if F_CPU == 16000000UL
641642
PLLCSR = 0x12; // Need 16 MHz xtal
643+
#elif F_CPU == 8000000UL
644+
PLLCSR = 0x02; // Need 8 MHz xtal
645+
#endif
642646
while (!(PLLCSR & (1<<PLOCK))) // wait for lock pll
643647
;
644648

0 commit comments

Comments
 (0)