diff --git a/cpu/samd5x/cpu.c b/cpu/samd5x/cpu.c index 54555b2dc1..734123dbeb 100644 --- a/cpu/samd5x/cpu.c +++ b/cpu/samd5x/cpu.c @@ -203,4 +203,9 @@ void cpu_init(void) /* trigger static peripheral initialization */ periph_init(); + + /* set ONDEMAND bit after all clocks have been configured */ + /* This is to avoid setting the source for the main clock to ONDEMAND before using it. */ + OSCCTRL->DFLLCTRLA.reg |= OSCCTRL_DFLLCTRLA_ONDEMAND; + OSCCTRL->Dpll[0].DPLLCTRLA.reg |= OSCCTRL_DPLLCTRLA_ONDEMAND; }