|
|
|
|
|
|
|
|
UART0_C2 = UART_C2_TE; |
|
|
UART0_C2 = UART_C2_TE; |
|
|
PORTB_PCR17 = PORT_PCR_MUX(3); |
|
|
PORTB_PCR17 = PORT_PCR_MUX(3); |
|
|
#endif |
|
|
#endif |
|
|
#ifdef KINETISK |
|
|
|
|
|
// if the RTC oscillator isn't enabled, get it started early |
|
|
|
|
|
|
|
|
#if defined(KINETISK) && !defined(__MK66FX1M0__) |
|
|
|
|
|
// If the RTC oscillator isn't enabled, get it started early. |
|
|
|
|
|
// But don't do this early on Teensy 3.6 - RTC_CR depends on 3.3V+VBAT |
|
|
|
|
|
// which may be ~0.4V "behind" 3.3V if the power ramps up slowly. |
|
|
if (!(RTC_CR & RTC_CR_OSCE)) { |
|
|
if (!(RTC_CR & RTC_CR_OSCE)) { |
|
|
RTC_SR = 0; |
|
|
RTC_SR = 0; |
|
|
RTC_CR = RTC_CR_SC16P | RTC_CR_SC4P | RTC_CR_OSCE; |
|
|
RTC_CR = RTC_CR_SC16P | RTC_CR_SC4P | RTC_CR_OSCE; |
|
|
|
|
|
|
|
|
SMC_PMCTRL = SMC_PMCTRL_RUNM(2); // VLPR mode :-) |
|
|
SMC_PMCTRL = SMC_PMCTRL_RUNM(2); // VLPR mode :-) |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#if defined(__MK66FX1M0__) |
|
|
|
|
|
// If the RTC oscillator isn't enabled, get it started. For Teensy 3.6 |
|
|
|
|
|
// we don't do this early. See comment above about slow rising power. |
|
|
|
|
|
if (!(RTC_CR & RTC_CR_OSCE)) { |
|
|
|
|
|
RTC_SR = 0; |
|
|
|
|
|
RTC_CR = RTC_CR_SC16P | RTC_CR_SC4P | RTC_CR_OSCE; |
|
|
|
|
|
} |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
// initialize the SysTick counter |
|
|
// initialize the SysTick counter |
|
|
SYST_RVR = (F_CPU / 1000) - 1; |
|
|
SYST_RVR = (F_CPU / 1000) - 1; |
|
|
SYST_CVR = 0; |
|
|
SYST_CVR = 0; |