summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Shawcroft <scott.shawcroft@gmail.com>2018-06-06 12:02:17 -0700
committerScott Shawcroft <scott.shawcroft@gmail.com>2018-06-08 12:56:32 -0700
commit383bf9a59e1672684169b4afe57671a639fe12ad (patch)
treed45ac25a2fb236d5e4c93aea926cdd38b0013cc3
parent07a8899c726a53011ead19d4e92cd8ccc09c1e03 (diff)
Wait for the DFLL to be stable.
-rw-r--r--ports/atmel-samd/peripherals/samd21/clocks.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ports/atmel-samd/peripherals/samd21/clocks.c b/ports/atmel-samd/peripherals/samd21/clocks.c
index 51b7ad993..422290e8b 100644
--- a/ports/atmel-samd/peripherals/samd21/clocks.c
+++ b/ports/atmel-samd/peripherals/samd21/clocks.c
@@ -130,6 +130,9 @@ static void init_clock_source_dfll48m_xosc(void) {
SYSCTRL_DFLLCTRL_ENABLE;
while (!SYSCTRL->PCLKSR.bit.DFLLRDY) {}
while (GCLK->STATUS.bit.SYNCBUSY) {}
+
+ // Wait for the fine lock on the DFLL.
+ while (!SYSCTRL->PCLKSR.bit.DFLLLCKC || !SYSCTRL->PCLKSR.bit.DFLLLCKF) {}
}
static void init_clock_source_dfll48m_usb(void) {