[riot-notifications] [RIOT-OS/RIOT] cpu/sam0: add support for SAMD5x/SAME5x (#11305)

Dylan Laduranty notifications at github.com
Thu May 23 15:42:38 CEST 2019


dylad commented on this pull request.



> +    while (!(GCLK->PCHCTRL[OSCCTRL_GCLK_ID_FDPLL0].reg & GCLK_PCHCTRL_CHEN)) {}
+
+    GCLK->PCHCTRL[OSCCTRL_GCLK_ID_FDPLL032K].reg = GCLK_PCHCTRL_GEN(1)
+                             | GCLK_PCHCTRL_CHEN;
+    while (!(GCLK->PCHCTRL[OSCCTRL_GCLK_ID_FDPLL032K].reg & GCLK_PCHCTRL_CHEN)) {}
+}
+
+static void dpll0_init(uint32_t f_cpu)
+{
+    const uint32_t LDR = ((f_cpu * 16) / 32768);
+
+    OSCCTRL->Dpll[0].DPLLRATIO.reg = OSCCTRL_DPLLRATIO_LDRFRAC(LDR % 16)
+                       | OSCCTRL_DPLLRATIO_LDR((LDR / 16) - 1);
+
+    OSCCTRL->Dpll[0].DPLLCTRLB.reg = OSCCTRL_DPLLCTRLB_REFCLK_XOSC32
+                       | OSCCTRL_DPLLCTRLB_DIV(1)

It doesn't hurt but it is completely useless because you are setting the divider for XOSC but you are using XOSC32 ;)
check Figure 28-2. DPLL Block Diagram of the datasheet 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11305#discussion_r286948661
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190523/7cc900bb/attachment.html>


More information about the notifications mailing list