atmel-samd: Stop relying on an external crystal.
This commit is contained in:
parent
23112a6434
commit
acc4fe4d7d
|
@ -203,7 +203,8 @@ uint32_t system_clock_source_get_hz(
|
||||||
_system_dfll_wait_for_sync();
|
_system_dfll_wait_for_sync();
|
||||||
|
|
||||||
/* Check if operating in closed loop mode */
|
/* Check if operating in closed loop mode */
|
||||||
if (_system_clock_inst.dfll.control & SYSCTRL_DFLLCTRL_MODE) {
|
if ((_system_clock_inst.dfll.control & SYSCTRL_DFLLCTRL_MODE) &&
|
||||||
|
!( _system_clock_inst.dfll.control & SYSCTRL_DFLLCTRL_USBCRM )) {
|
||||||
return system_gclk_chan_get_hz(SYSCTRL_GCLK_ID_DFLL48) *
|
return system_gclk_chan_get_hz(SYSCTRL_GCLK_ID_DFLL48) *
|
||||||
(_system_clock_inst.dfll.mul & 0xffff);
|
(_system_clock_inst.dfll.mul & 0xffff);
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
# define CONF_CLOCK_XOSC_RUN_IN_STANDBY false
|
# define CONF_CLOCK_XOSC_RUN_IN_STANDBY false
|
||||||
|
|
||||||
/* SYSTEM_CLOCK_SOURCE_XOSC32K configuration - External 32KHz crystal/clock oscillator */
|
/* SYSTEM_CLOCK_SOURCE_XOSC32K configuration - External 32KHz crystal/clock oscillator */
|
||||||
# define CONF_CLOCK_XOSC32K_ENABLE true
|
# define CONF_CLOCK_XOSC32K_ENABLE false
|
||||||
# define CONF_CLOCK_XOSC32K_EXTERNAL_CRYSTAL SYSTEM_CLOCK_EXTERNAL_CRYSTAL
|
# define CONF_CLOCK_XOSC32K_EXTERNAL_CRYSTAL SYSTEM_CLOCK_EXTERNAL_CRYSTAL
|
||||||
# define CONF_CLOCK_XOSC32K_STARTUP_TIME SYSTEM_XOSC32K_STARTUP_65536
|
# define CONF_CLOCK_XOSC32K_STARTUP_TIME SYSTEM_XOSC32K_STARTUP_65536
|
||||||
# define CONF_CLOCK_XOSC32K_AUTO_AMPLITUDE_CONTROL false
|
# define CONF_CLOCK_XOSC32K_AUTO_AMPLITUDE_CONTROL false
|
||||||
|
@ -89,8 +89,9 @@
|
||||||
# define CONF_CLOCK_OSC32K_RUN_IN_STANDBY false
|
# define CONF_CLOCK_OSC32K_RUN_IN_STANDBY false
|
||||||
|
|
||||||
/* SYSTEM_CLOCK_SOURCE_DFLL configuration - Digital Frequency Locked Loop */
|
/* SYSTEM_CLOCK_SOURCE_DFLL configuration - Digital Frequency Locked Loop */
|
||||||
|
// USB Clock Source fixed at DFLL.
|
||||||
# define CONF_CLOCK_DFLL_ENABLE true
|
# define CONF_CLOCK_DFLL_ENABLE true
|
||||||
# define CONF_CLOCK_DFLL_LOOP_MODE SYSTEM_CLOCK_DFLL_LOOP_MODE_CLOSED
|
# define CONF_CLOCK_DFLL_LOOP_MODE SYSTEM_CLOCK_DFLL_LOOP_MODE_USB_RECOVERY
|
||||||
# define CONF_CLOCK_DFLL_ON_DEMAND true
|
# define CONF_CLOCK_DFLL_ON_DEMAND true
|
||||||
|
|
||||||
/* DFLL open loop mode configuration */
|
/* DFLL open loop mode configuration */
|
||||||
|
@ -139,7 +140,7 @@
|
||||||
# define CONF_CLOCK_GCLK_0_OUTPUT_ENABLE false
|
# define CONF_CLOCK_GCLK_0_OUTPUT_ENABLE false
|
||||||
|
|
||||||
/* Configure GCLK generator 1 */
|
/* Configure GCLK generator 1 */
|
||||||
# define CONF_CLOCK_GCLK_1_ENABLE true
|
# define CONF_CLOCK_GCLK_1_ENABLE false
|
||||||
# define CONF_CLOCK_GCLK_1_RUN_IN_STANDBY false
|
# define CONF_CLOCK_GCLK_1_RUN_IN_STANDBY false
|
||||||
# define CONF_CLOCK_GCLK_1_CLOCK_SOURCE SYSTEM_CLOCK_SOURCE_XOSC32K
|
# define CONF_CLOCK_GCLK_1_CLOCK_SOURCE SYSTEM_CLOCK_SOURCE_XOSC32K
|
||||||
# define CONF_CLOCK_GCLK_1_PRESCALER 1
|
# define CONF_CLOCK_GCLK_1_PRESCALER 1
|
||||||
|
@ -153,7 +154,7 @@
|
||||||
# define CONF_CLOCK_GCLK_2_OUTPUT_ENABLE false
|
# define CONF_CLOCK_GCLK_2_OUTPUT_ENABLE false
|
||||||
|
|
||||||
/* Configure GCLK generator 3 */
|
/* Configure GCLK generator 3 */
|
||||||
# define CONF_CLOCK_GCLK_3_ENABLE true
|
# define CONF_CLOCK_GCLK_3_ENABLE false
|
||||||
# define CONF_CLOCK_GCLK_3_RUN_IN_STANDBY false
|
# define CONF_CLOCK_GCLK_3_RUN_IN_STANDBY false
|
||||||
# define CONF_CLOCK_GCLK_3_CLOCK_SOURCE SYSTEM_CLOCK_SOURCE_OSC8M
|
# define CONF_CLOCK_GCLK_3_CLOCK_SOURCE SYSTEM_CLOCK_SOURCE_OSC8M
|
||||||
# define CONF_CLOCK_GCLK_3_PRESCALER 1
|
# define CONF_CLOCK_GCLK_3_PRESCALER 1
|
||||||
|
|
Loading…
Reference in New Issue