|
|
@@ -891,19 +891,19 @@ void ResetHandler(void) |
|
|
|
SIM_CLKDIV1 = SIM_CLKDIV1_OUTDIV1(0) | SIM_CLKDIV1_OUTDIV2(3) | SIM_CLKDIV1_OUTDIV4(7); |
|
|
|
SIM_CLKDIV2 = SIM_CLKDIV2_USBDIV(4); |
|
|
|
#elif F_CPU == 216000000 |
|
|
|
// config divisors: 216 MHz core, 54 MHz bus, 27 MHz flash, USB = not feasible |
|
|
|
// config divisors: 216 MHz core, 54 MHz bus, 27 MHz flash, USB = IRC48M |
|
|
|
// TODO: gradual ramp-up for HSRUN mode |
|
|
|
SIM_CLKDIV1 = SIM_CLKDIV1_OUTDIV1(0) | SIM_CLKDIV1_OUTDIV2(3) | SIM_CLKDIV1_OUTDIV4(7); |
|
|
|
SIM_CLKDIV2 = SIM_CLKDIV2_USBDIV(8) | SIM_CLKDIV2_USBFRAC; |
|
|
|
SIM_CLKDIV2 = SIM_CLKDIV2_USBDIV(0); |
|
|
|
#elif F_CPU == 192000000 |
|
|
|
// config divisors: 192 MHz core, 48 MHz bus, 27.4 MHz flash, USB = 192 / 4 |
|
|
|
// TODO: gradual ramp-up for HSRUN mode |
|
|
|
SIM_CLKDIV1 = SIM_CLKDIV1_OUTDIV1(0) | SIM_CLKDIV1_OUTDIV2(3) | SIM_CLKDIV1_OUTDIV4(6); |
|
|
|
SIM_CLKDIV2 = SIM_CLKDIV2_USBDIV(3); |
|
|
|
#elif F_CPU == 180000000 |
|
|
|
// config divisors: 180 MHz core, 60 MHz bus, 25.7 MHz flash, USB = not feasible |
|
|
|
// config divisors: 180 MHz core, 60 MHz bus, 25.7 MHz flash, USB = IRC48M |
|
|
|
SIM_CLKDIV1 = SIM_CLKDIV1_OUTDIV1(0) | SIM_CLKDIV1_OUTDIV2(2) | SIM_CLKDIV1_OUTDIV4(6); |
|
|
|
SIM_CLKDIV2 = SIM_CLKDIV2_USBDIV(6) | SIM_CLKDIV2_USBFRAC; |
|
|
|
SIM_CLKDIV2 = SIM_CLKDIV2_USBDIV(0); |
|
|
|
#elif F_CPU == 168000000 |
|
|
|
// config divisors: 168 MHz core, 56 MHz bus, 28 MHz flash, USB = 168 * 2 / 7 |
|
|
|
SIM_CLKDIV1 = SIM_CLKDIV1_OUTDIV1(0) | SIM_CLKDIV1_OUTDIV2(2) | SIM_CLKDIV1_OUTDIV4(5); |
|
|
@@ -988,8 +988,11 @@ void ResetHandler(void) |
|
|
|
// now we're in PEE mode |
|
|
|
// USB uses PLL clock, trace is CPU clock, CLKOUT=OSCERCLK0 |
|
|
|
#if defined(KINETISK) |
|
|
|
SIM_SOPT2 = SIM_SOPT2_USBSRC | SIM_SOPT2_PLLFLLSEL | SIM_SOPT2_TRACECLKSEL |
|
|
|
| SIM_SOPT2_CLKOUTSEL(6); |
|
|
|
#if F_CPU == 216000000 || F_CPU == 180000000 |
|
|
|
SIM_SOPT2 = SIM_SOPT2_USBSRC | SIM_SOPT2_IRC48SEL | SIM_SOPT2_TRACECLKSEL | SIM_SOPT2_CLKOUTSEL(6); |
|
|
|
#else |
|
|
|
SIM_SOPT2 = SIM_SOPT2_USBSRC | SIM_SOPT2_PLLFLLSEL | SIM_SOPT2_TRACECLKSEL | SIM_SOPT2_CLKOUTSEL(6); |
|
|
|
#endif |
|
|
|
#elif defined(KINETISL) |
|
|
|
SIM_SOPT2 = SIM_SOPT2_USBSRC | SIM_SOPT2_PLLFLLSEL | SIM_SOPT2_CLKOUTSEL(6) |
|
|
|
| SIM_SOPT2_UART0SRC(1) | SIM_SOPT2_TPMSRC(1); |