Added LF clock starting code to SysInit.

pull/2234/head
Głąbek, Andrzej 2016-06-15 21:43:38 +01:00
parent df6bd2f66c
commit 082fd409ce
2 changed files with 20 additions and 0 deletions

View File

@ -94,6 +94,16 @@ void SystemInit(void)
}
*(uint32_t volatile *)0x4006EC14 = 0xC0;
}
// Start the external 32khz crystal oscillator.
NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos);
NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
NRF_CLOCK->TASKS_LFCLKSTART = 1;
// Wait for the external oscillator to start up.
while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0) {
// Do nothing.
}
}

View File

@ -187,6 +187,16 @@ void SystemInit(void)
#endif
SystemCoreClockUpdate();
// Start the external 32khz crystal oscillator.
NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos);
NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
NRF_CLOCK->TASKS_LFCLKSTART = 1;
// Wait for the external oscillator to start up.
while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0) {
// Do nothing.
}
}