[riot-notifications] [RIOT-OS/RIOT] cpu/sam0_common: RTC & RTT cleanup (#11689)

Dylan Laduranty notifications at github.com
Tue Jun 18 10:57:46 CEST 2019


dylad requested changes on this pull request.

Last changes and we're good with saml1x and saml21. I'll test on samd21 asap.

> +                           | OSC32KCTRL_OSC32K_EN32K
+                           | OSC32KCTRL_OSC32K_CALIB(osc32kcal)
+                           | OSC32KCTRL_OSC32K_ENABLE;
+
+    /* Wait OSC32K Ready */
+    while (!OSC32KCTRL->STATUS.bit.OSC32KRDY) {}
+#endif /* INTERNAL_OSC32_SOURCE */
+}
+
+static void _xosc32k_setup(void)
+{
+#if EXTERNAL_OSC32_SOURCE
+    /* RTC uses External 32,768KHz Oscillator */
+    OSC32KCTRL->XOSC32K.reg = OSC32KCTRL_XOSC32K_XTALEN
+                            | OSC32KCTRL_XOSC32K_RUNSTDBY
+                            | OSC32KCTRL_XOSC32K_ENABLE;

SAML10/SAML11 datasheet states that either the 1kHz or 32kHz must feed the RTC module. So It is better to add `| OSC32KCTRL_XOSC32K_EN32K` by default here otherwise RTC driver may get stuck because there is no clock output from OSC32K and thus peripheral is not feeded.

> +                           | OSC32KCTRL_OSC32K_EN32K
+                           | OSC32KCTRL_OSC32K_CALIB(osc32kcal)
+                           | OSC32KCTRL_OSC32K_ENABLE;
+
+    /* Wait OSC32K Ready */
+    while (!OSC32KCTRL->STATUS.bit.OSC32KRDY) {}
+#endif /* INTERNAL_OSC32_SOURCE */
+}
+
+static void _xosc32k_setup(void)
+{
+#if EXTERNAL_OSC32_SOURCE
+    /* RTC uses External 32,768KHz Oscillator */
+    OSC32KCTRL->XOSC32K.reg = OSC32KCTRL_XOSC32K_XTALEN
+                            | OSC32KCTRL_XOSC32K_RUNSTDBY
+                            | OSC32KCTRL_XOSC32K_ENABLE;

Same as SAML1X, add `| OSC32KCTRL_XOSC32K_EN32K` as default

-- 
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/11689#pullrequestreview-250947460
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190618/cce3d8d1/attachment.html>


More information about the notifications mailing list