[riot-notifications] [RIOT-OS/RIOT] sam0_common: make RTC implementation common across all sam0 MCUs (#11317)

Dylan Laduranty notifications at github.com
Fri Apr 12 09:26:38 CEST 2019


dylad commented on this pull request.



>  
-    /* Software Reset the RTC */
-    RTC->MODE2.CTRLA.bit.SWRST = 1;
-    /* Wait end of reset */
-    while (RTC->MODE2.CTRLA.bit.SWRST);
+void rtc_init(void)
+{
+    /* DISABLE RTC MASTER */
+    rtc_poweroff();
+
+    rtc_clock_setup();

@benpicco I have no strong opinion about `reset` yet. But rtc_poweroff() is mandatary for at least SAML21.
CTRLA register at least is "Enable-Protected" which means we cannot modify it after the ENABLE bit has beent set. This is why we must use `rtc_poweroff();` before configuring our rtc.
Try to run the current code on SAML21, it should hang.

-- 
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/11317#discussion_r274787523
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190412/a9372073/attachment.html>


More information about the notifications mailing list