diff --git a/keyboards/system76/launch_beta_1/rules.mk b/keyboards/system76/launch_beta_1/rules.mk index bc8d6fe734a..85774a90d48 100644 --- a/keyboards/system76/launch_beta_1/rules.mk +++ b/keyboards/system76/launch_beta_1/rules.mk @@ -4,8 +4,10 @@ MCU = atmega32u4 # Allow flashing with usbasp AVRDUDE_MCU = $(MCU) -# Processor frequency -F_CPU = 16000000 +# CPU frequency divided by two since AVR is at 3.3V +F_CPU = 8000000 +# External oscillator is 16Mhz +F_USB = 16000000 # Bootloader selection # Teensy halfkay diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index 8319b34e94d..46a65c27aae 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c @@ -917,8 +917,14 @@ static void setup_mcu(void) { MCUSR &= ~_BV(WDRF); wdt_disable(); +// HACK for System76 boards with AVR at 3.3V and crystal at 16 MHz +#if (F_CPU == 8000000 && F_USB == 16000000) + /* Divide clock by 2 */ + clock_prescale_set(clock_div_2); +#else /* Disable clock division */ clock_prescale_set(clock_div_1); +#endif } /** \brief Setup USB