mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #14678 from dylad/cpu/saml1x/rtt-init-fix
cpu/saml1x: fix RTT issue in init process
This commit is contained in:
commit
be3667bfdd
@ -135,9 +135,21 @@ void cpu_init(void)
|
||||
#endif
|
||||
#ifdef MODULE_PERIPH_GPIO
|
||||
| MCLK_APBAMASK_PORT
|
||||
#endif
|
||||
#ifdef MODULE_PERIPH_RTC_RTT
|
||||
| MCLK_APBAMASK_RTC
|
||||
#endif
|
||||
;
|
||||
|
||||
|
||||
/* Disable the RTC module to prevent synchronization issues during CPU init
|
||||
if the RTC was running from a previous boot (e.g wakeup from backup)
|
||||
as the module will be re-init during the boot process */
|
||||
if (RTC->MODE2.CTRLA.bit.ENABLE && IS_ACTIVE(MODULE_PERIPH_RTC_RTT)) {
|
||||
while (RTC->MODE2.SYNCBUSY.reg) {}
|
||||
RTC->MODE2.CTRLA.bit.ENABLE = 0;
|
||||
while (RTC->MODE2.SYNCBUSY.reg) {}
|
||||
}
|
||||
/* Software reset the GCLK module to ensure it is re-initialized correctly */
|
||||
GCLK->CTRLA.reg = GCLK_CTRLA_SWRST;
|
||||
while (GCLK->CTRLA.reg & GCLK_CTRLA_SWRST) {}
|
||||
|
Loading…
Reference in New Issue
Block a user