|
|
|
@ -38,38 +38,58 @@
|
|
|
|
|
#define CORE_CONF_CLK_XOSC1_FREQUENCY 12000000
|
|
|
|
|
|
|
|
|
|
// XOSC32K Config
|
|
|
|
|
#define CORE_CONF_CLK_XOSC32K_ENABLE (0)
|
|
|
|
|
#define CORE_CONF_CLK_XOSC32K_ENABLE (1)
|
|
|
|
|
#define CORE_CONF_CLK_XOSC32K_CGM CORE_CONF_CLK_XOSC32KCTRL_CGM_STD_MODE
|
|
|
|
|
#define CORE_CONF_CLK_XOSC32K_WRTLOCK (0)
|
|
|
|
|
#define CORE_CONF_CLK_XOSC32K_STARTUP_TIME CORE_CONF_CLK_XOSC32KCTRL_STARTUP_62592us
|
|
|
|
|
#define CORE_CONF_CLK_XOSC32K_ONDEMAND (0)
|
|
|
|
|
#define CORE_CONF_CLK_XOSC32K_ONDEMAND (1)
|
|
|
|
|
#define CORE_CONF_CLK_XOSC32K_RUNSTDBY (0)
|
|
|
|
|
#define CORE_CONF_CLK_XOSC32K_EN1K (0)
|
|
|
|
|
#define CORE_CONF_CLK_XOSC32K_EN32K (0)
|
|
|
|
|
#define CORE_CONF_CLK_XOSC32K_XTALEN (0)
|
|
|
|
|
#define CORE_CONF_CLK_XOSC32K_EN32K (1)
|
|
|
|
|
#define CORE_CONF_CLK_XOSC32K_XTALEN (1)
|
|
|
|
|
#define CORE_CONF_CLK_XOSC32K_CFDPRESC (0)
|
|
|
|
|
#define CORE_CONF_CLK_XOSC32K_CFDEN (0)
|
|
|
|
|
#define CORE_CONF_CLK_XOSC32K_SWBACK (0)
|
|
|
|
|
#define CORE_CONF_CLK_XOSC32K_WRTLOCK (0)
|
|
|
|
|
|
|
|
|
|
// DFLL Config
|
|
|
|
|
#define CORE_CONF_CLK_DFLL_ENABLE (0)
|
|
|
|
|
#define CORE_CONF_CLK_DFLL_RUNSTDBY (0)
|
|
|
|
|
#define CORE_CONF_CLK_DFLL_ENABLE (1)
|
|
|
|
|
#define CORE_CONF_CLK_DFLL_ONDEMAND (0)
|
|
|
|
|
#define CORE_CONF_CLK_DFLL_RUNSTDBY (0)
|
|
|
|
|
#define CORE_CONF_CLK_DFLL_WAITLOCK (0)
|
|
|
|
|
#define CORE_CONF_CLK_DFLL_BPLKC (0)
|
|
|
|
|
#define CORE_CONF_CLK_DFLL_QLDIS (0)
|
|
|
|
|
#define CORE_CONF_CLK_DFLL_CCDIS (0)
|
|
|
|
|
#define CORE_CONF_CLK_DFLL_USBCRM (0)
|
|
|
|
|
#define CORE_CONF_CLK_DFLL_CCDIS (1)
|
|
|
|
|
#define CORE_CONF_CLK_DFLL_USBCRM (1)
|
|
|
|
|
#define CORE_CONF_CLK_DFLL_LLAW (0)
|
|
|
|
|
#define CORE_CONF_CLK_DFLL_STABLE_FCALIB CORE_CONF_CLK_DFLLCTRL_STABLE_FCALIB_NOT_FIXED
|
|
|
|
|
#define CORE_CONF_CLK_DFLL_MODE CORE_CONF_CLK_DFLLCTRL_MODE_OPEN_LOOP
|
|
|
|
|
/**
|
|
|
|
|
* CORE_CONF_CLK_DFLL_MODE Options
|
|
|
|
|
* - CORE_CONF_CLK_DFLLCTRL_MODE_OPEN_LOOP: 0x00
|
|
|
|
|
* - CORE_CONF_CLK_DFLLCTRL_MODE_CLOSED_LOOP: 0x01
|
|
|
|
|
*/
|
|
|
|
|
#define CORE_CONF_CLK_DFLL_MODE CORE_CONF_CLK_DFLLCTRL_MODE_CLOSED_LOOP
|
|
|
|
|
#define CORE_CONF_CLK_DFLL_DIFF_VAL 0
|
|
|
|
|
#define CORE_CONF_CLK_DFLL_COARSE_VAL 31
|
|
|
|
|
#define CORE_CONF_CLK_DFLL_COARSE_VAL (0x1f / 4)
|
|
|
|
|
#define CORE_CONF_CLK_DFLL_FINE_VAL 128
|
|
|
|
|
#define CORE_CONF_CLK_DFLL_CSTEP_VAL 1
|
|
|
|
|
#define CORE_CONF_CLK_DFLL_FSTEP_VAL 1
|
|
|
|
|
#define CORE_CONF_CLK_DFLL_MUL_VAL 1
|
|
|
|
|
#define CORE_CONF_CLK_DFLL_GCLK_SRC GCLK_PCHCTRL_GEN_GCLK3_Val
|
|
|
|
|
#define CORE_CONF_CLK_DFLL_MUL_VAL (48000000)
|
|
|
|
|
/**
|
|
|
|
|
* CORE_CONF_CLK_DFLL_GCLK_SRC Options
|
|
|
|
|
* - Generic clock generator: 0
|
|
|
|
|
* - Generic clock generator: 1
|
|
|
|
|
* - Generic clock generator: 2
|
|
|
|
|
* - Generic clock generator: 3
|
|
|
|
|
* - Generic clock generator: 4
|
|
|
|
|
* - Generic clock generator: 5
|
|
|
|
|
* - Generic clock generator: 6
|
|
|
|
|
* - Generic clock generator: 7
|
|
|
|
|
* - Generic clock generator: 8
|
|
|
|
|
* - Generic clock generator: 9
|
|
|
|
|
* - Generic clock generator: 10
|
|
|
|
|
* - Generic clock generator: 11
|
|
|
|
|
*/
|
|
|
|
|
#define CORE_CONF_CLK_DFLL_GCLK_SRC 3
|
|
|
|
|
#define CORE_CONF_CLK_DFLL_OVERWRITE_CAL 0
|
|
|
|
|
|
|
|
|
|
// DPLL0 Config
|
|
|
|
@ -81,7 +101,7 @@
|
|
|
|
|
#define CORE_CONF_CLK_DPLL0_DIV_VAL (5)
|
|
|
|
|
#define CORE_CONF_CLK_DPLL0_DCOEN 0
|
|
|
|
|
#define CORE_CONF_CLK_DPLL0_DCOFILTER CORE_CONF_CLK_DPLLCTRL_DCOFILTER_3210KHZ
|
|
|
|
|
#define CORE_CONF_CLK_DPLL0_LBYPASS 0
|
|
|
|
|
#define CORE_CONF_CLK_DPLL0_LBYPASS 1
|
|
|
|
|
#define CORE_CONF_CLK_DPLL0_LTIME 0
|
|
|
|
|
#define CORE_CONF_CLK_DPLL0_WUF 0
|
|
|
|
|
#define CORE_CONF_CLK_DPLL0_GCLK_SRC GCLK_GENCTRL_SRC_XOSC0
|
|
|
|
@ -111,6 +131,43 @@
|
|
|
|
|
#define CORE_CONF_CLK_DPLL0_FILTER 0x0
|
|
|
|
|
|
|
|
|
|
// DPLL1 Config
|
|
|
|
|
#define CORE_CONF_CLK_DPLL1_ENABLE (0)
|
|
|
|
|
#define CORE_CONF_CLK_DPLL1_ONDEMAND (0)
|
|
|
|
|
#define CORE_CONF_CLK_DPLL1_RUNSTDBY (0)
|
|
|
|
|
#define CORE_CONF_CLK_DPLL1_LDRFRAC_VAL 0
|
|
|
|
|
#define CORE_CONF_CLK_DPLL1_LDR_VAL (0)
|
|
|
|
|
#define CORE_CONF_CLK_DPLL1_DIV_VAL (0)
|
|
|
|
|
#define CORE_CONF_CLK_DPLL1_DCOEN 0
|
|
|
|
|
#define CORE_CONF_CLK_DPLL1_DCOFILTER CORE_CONF_CLK_DPLLCTRL_DCOFILTER_3210KHZ
|
|
|
|
|
#define CORE_CONF_CLK_DPLL1_LBYPASS 0
|
|
|
|
|
#define CORE_CONF_CLK_DPLL1_LTIME 0
|
|
|
|
|
#define CORE_CONF_CLK_DPLL1_WUF 0
|
|
|
|
|
#define CORE_CONF_CLK_DPLL1_GCLK_SRC GCLK_GENCTRL_SRC_XOSC0
|
|
|
|
|
#define CORE_CONF_CLK_DPLL1_REFCLK CORE_CONF_CLK_DPLLCTRL_REFCLK_XOSC0
|
|
|
|
|
/**
|
|
|
|
|
* pg. 732 of the datasheet
|
|
|
|
|
* FILTER[3:0] | PLL Bandwidth (fn) | Damping Factor
|
|
|
|
|
* 0x0 | 92.7 kHz | 0.76
|
|
|
|
|
* 0x1 | 131 kHz | 1.08
|
|
|
|
|
* 0x2 | 46.4 kHz | 0.38
|
|
|
|
|
* 0x3 | 65.6 kHz | 0.54
|
|
|
|
|
* 0x4 | 131 kHz | 0.56
|
|
|
|
|
* 0x5 | 185 kHz | 0.79
|
|
|
|
|
* 0x6 | 65.6 kHz | 0.28
|
|
|
|
|
* 0x7 | 92.7 kHz | 0.39
|
|
|
|
|
* 0x8 | 46.4 kHz | 1.49
|
|
|
|
|
* 0x9 | 65.6 kHz | 2.11
|
|
|
|
|
* 0xA | 23.2 kHz | 0.75
|
|
|
|
|
* 0xB | 32.8 kHz | 1.06
|
|
|
|
|
* 0xC | 65.6 kHz | 1.07
|
|
|
|
|
* 0xD | 92.7 kHz | 1.51
|
|
|
|
|
* 0xE | 32.8 kHz | 0.53
|
|
|
|
|
* 0xF | 46.4 kHz | 0.75
|
|
|
|
|
*
|
|
|
|
|
* When in doubt, leave this at its default.
|
|
|
|
|
*/
|
|
|
|
|
#define CORE_CONF_CLK_DPLL1_FILTER 0x0
|
|
|
|
|
|
|
|
|
|
// GCLK Generators Config
|
|
|
|
|
#define CORE_CONF_GCLK_0_ENABLE 1
|
|
|
|
|
#define CORE_CONF_GCLK_0_RUN_IN_STANDBY 1
|
|
|
|
@ -139,9 +196,9 @@
|
|
|
|
|
#define CORE_CONF_GCLK_2_OUTPUT_OFF_VALUE 0
|
|
|
|
|
#define CORE_CONF_GCLK_2_IDC 0
|
|
|
|
|
|
|
|
|
|
#define CORE_CONF_GCLK_3_ENABLE 0
|
|
|
|
|
#define CORE_CONF_GCLK_3_ENABLE 1
|
|
|
|
|
#define CORE_CONF_GCLK_3_RUN_IN_STANDBY 0
|
|
|
|
|
#define CORE_CONF_GCLK_3_CLOCK_SOURCE GCLK_GENCTRL_SRC_XOSC0
|
|
|
|
|
#define CORE_CONF_GCLK_3_CLOCK_SOURCE GCLK_GENCTRL_SRC_XOSC32K
|
|
|
|
|
#define CORE_CONF_GCLK_3_DIV_VAL 1
|
|
|
|
|
#define CORE_CONF_GCLK_3_DIVSEL 0
|
|
|
|
|
#define CORE_CONF_GCLK_3_OUTPUT_ENABLE 0
|
|
|
|
|