瀏覽代碼

Improve startup behavior on Teensy 3.6 with external slowly rising power

teensy4-core
PaulStoffregen 5 年之前
父節點
當前提交
1b1f95315f
共有 1 個檔案被更改,包括 13 行新增2 行删除
  1. +13
    -2
      teensy3/mk20dx128.c

+ 13
- 2
teensy3/mk20dx128.c 查看文件

@@ -745,8 +745,10 @@ void ResetHandler(void)
UART0_C2 = UART_C2_TE;
PORTB_PCR17 = PORT_PCR_MUX(3);
#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)) {
RTC_SR = 0;
RTC_CR = RTC_CR_SC16P | RTC_CR_SC4P | RTC_CR_OSCE;
@@ -1100,6 +1102,15 @@ void ResetHandler(void)
SMC_PMCTRL = SMC_PMCTRL_RUNM(2); // VLPR mode :-)
#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
SYST_RVR = (F_CPU / 1000) - 1;
SYST_CVR = 0;

Loading…
取消
儲存