cpu/samd5x: work around errata when (re-)initializing DFLL
When a previously disabled DFLL gets enabled again, the frequency will be incorrect. Follow the procedure outlined in the errata sheet, section 2.8.3 to work around the issue. This fixes wake from standby.
This commit is contained in:
parent
660b1a9b5f
commit
f6139ae346
@ -64,9 +64,14 @@ static void dfll_init(void)
|
|||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
OSCCTRL->DFLLCTRLB.reg = reg;
|
/* workaround for Errata 2.8.3 DFLLVAL.FINE Value When DFLL48M Re-enabled */
|
||||||
OSCCTRL->DFLLCTRLA.reg = OSCCTRL_DFLLCTRLA_ENABLE;
|
OSCCTRL->DFLLMUL.reg = 0; /* Write new DFLLMULL configuration */
|
||||||
|
OSCCTRL->DFLLCTRLB.reg = 0; /* Select Open loop configuration */
|
||||||
|
OSCCTRL->DFLLCTRLA.bit.ENABLE = 1; /* Enable DFLL */
|
||||||
|
OSCCTRL->DFLLVAL.reg = OSCCTRL->DFLLVAL.reg; /* Reload DFLLVAL register */
|
||||||
|
OSCCTRL->DFLLCTRLB.reg = reg; /* Write final DFLL configuration */
|
||||||
|
|
||||||
|
OSCCTRL->DFLLCTRLA.reg = OSCCTRL_DFLLCTRLA_ENABLE;
|
||||||
while (!OSCCTRL->STATUS.bit.DFLLRDY) {}
|
while (!OSCCTRL->STATUS.bit.DFLLRDY) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,8 +157,12 @@ void cpu_pm_cb_enter(int deep)
|
|||||||
|
|
||||||
void cpu_pm_cb_leave(int deep)
|
void cpu_pm_cb_leave(int deep)
|
||||||
{
|
{
|
||||||
(void) deep;
|
|
||||||
/* will be called after wake-up */
|
/* will be called after wake-up */
|
||||||
|
|
||||||
|
if (deep) {
|
||||||
|
/* DFLL needs to be re-initialized to work around errata 2.8.3 */
|
||||||
|
dfll_init();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user