Browse Source

Merge pull request #148 from duff2013/master

Set FlexBus Clock Divider to correct value for 16, 8, 4 MHz
main
Paul Stoffregen 8 years ago
parent
commit
2d37d6e087
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      teensy3/mk20dx128.c

+ 3
- 3
teensy3/mk20dx128.c View File

#elif F_CPU == 16000000 #elif F_CPU == 16000000
// config divisors: 16 MHz core, 16 MHz bus, 16 MHz flash // config divisors: 16 MHz core, 16 MHz bus, 16 MHz flash
#if defined(KINETISK) #if defined(KINETISK)
SIM_CLKDIV1 = SIM_CLKDIV1_OUTDIV1(0) | SIM_CLKDIV1_OUTDIV2(0) | SIM_CLKDIV1_OUTDIV4(0);
SIM_CLKDIV1 = SIM_CLKDIV1_OUTDIV1(0) | SIM_CLKDIV1_OUTDIV2(0) | SIM_CLKDIV1_OUTDIV3(0) | SIM_CLKDIV1_OUTDIV4(0);
#elif defined(KINETISL) #elif defined(KINETISL)
SIM_CLKDIV1 = SIM_CLKDIV1_OUTDIV1(0) | SIM_CLKDIV1_OUTDIV4(0); SIM_CLKDIV1 = SIM_CLKDIV1_OUTDIV1(0) | SIM_CLKDIV1_OUTDIV4(0);
#endif #endif
#elif F_CPU == 8000000 #elif F_CPU == 8000000
// config divisors: 8 MHz core, 8 MHz bus, 8 MHz flash // config divisors: 8 MHz core, 8 MHz bus, 8 MHz flash
#if defined(KINETISK) #if defined(KINETISK)
SIM_CLKDIV1 = SIM_CLKDIV1_OUTDIV1(1) | SIM_CLKDIV1_OUTDIV2(1) | SIM_CLKDIV1_OUTDIV4(1);
SIM_CLKDIV1 = SIM_CLKDIV1_OUTDIV1(1) | SIM_CLKDIV1_OUTDIV2(1) | SIM_CLKDIV1_OUTDIV3(1) | SIM_CLKDIV1_OUTDIV4(1);
#elif defined(KINETISL) #elif defined(KINETISL)
SIM_CLKDIV1 = SIM_CLKDIV1_OUTDIV1(1) | SIM_CLKDIV1_OUTDIV4(0); SIM_CLKDIV1 = SIM_CLKDIV1_OUTDIV1(1) | SIM_CLKDIV1_OUTDIV4(0);
#endif #endif
// here we can go into vlpr? // here we can go into vlpr?
// config divisors: 4 MHz core, 4 MHz bus, 4 MHz flash // config divisors: 4 MHz core, 4 MHz bus, 4 MHz flash
#if defined(KINETISK) #if defined(KINETISK)
SIM_CLKDIV1 = SIM_CLKDIV1_OUTDIV1(3) | SIM_CLKDIV1_OUTDIV2(3) | SIM_CLKDIV1_OUTDIV4(3);
SIM_CLKDIV1 = SIM_CLKDIV1_OUTDIV1(3) | SIM_CLKDIV1_OUTDIV2(3) | SIM_CLKDIV1_OUTDIV3(3) | SIM_CLKDIV1_OUTDIV4(3);
#elif defined(KINETISL) #elif defined(KINETISL)
SIM_CLKDIV1 = SIM_CLKDIV1_OUTDIV1(3) | SIM_CLKDIV1_OUTDIV4(0); SIM_CLKDIV1 = SIM_CLKDIV1_OUTDIV1(3) | SIM_CLKDIV1_OUTDIV4(0);
#endif #endif

Loading…
Cancel
Save